@pleaseai/chrome-devtools-cli
v0.3.1
Published
CLI wrapper for Chrome DevTools MCP - Control and inspect Chrome with command-line tools
Downloads
49
Maintainers
Readme
Chrome DevTools CLI
chrome-devtools-cli lets you control and inspect a live Chrome browser from the command line. It provides direct CLI access to the full power of Chrome DevTools for reliable automation, in-depth debugging, and performance analysis - perfect for developers, scripts, and CI/CD pipelines.
Inspired by Chrome DevTools MCP, this CLI tool provides similar browser automation capabilities with superior token efficiency (~58.9% reduction via TOON format) - ideal for LLM-powered automation workflows.
Features
- 🎯 Input Automation: Click, hover, fill forms, drag-and-drop, keyboard input
- 🧭 Navigation: Multi-page management, URL navigation, wait conditions
- 📱 Emulation: Device emulation, viewport resizing
- ⚡ Performance: Trace recording, performance analysis
- 🌐 Network: Request monitoring, inspection
- 🐛 Debugging: Console monitoring, script evaluation, screenshots, snapshots
- 🎨 Multiple Output Formats: JSON, TOON, or human-readable text
- 🔧 Flexible Browser Connection: Launch new instances or connect to existing Chrome
Installation
Homebrew (Recommended for macOS/Linux)
# Add tap
brew tap pleaseai/tap
# Install
brew install chrome-devtools-cli
# Or one-liner
brew install pleaseai/tap/chrome-devtools-cliUpdate:
brew upgrade chrome-devtools-cliBinary Download
Download pre-built binaries from GitHub Releases:
Quick Install (Recommended)
Auto-detects your platform and architecture:
curl -fsSL https://raw.githubusercontent.com/pleaseai/chrome-devtools-cli/main/install.sh | bashOr download and run the script manually:
curl -fsSL https://raw.githubusercontent.com/pleaseai/chrome-devtools-cli/main/install.sh -o install.sh
chmod +x install.sh
./install.shManual Installation
# macOS (Apple Silicon)
curl -L https://github.com/pleaseai/chrome-devtools-cli/releases/latest/download/chrome-devtools-darwin-arm64 -o chrome-devtools
chmod +x chrome-devtools
sudo mv chrome-devtools /usr/local/bin/
# macOS (Intel)
curl -L https://github.com/pleaseai/chrome-devtools-cli/releases/latest/download/chrome-devtools-darwin-x64 -o chrome-devtools
chmod +x chrome-devtools
sudo mv chrome-devtools /usr/local/bin/
# Linux (ARM64)
curl -L https://github.com/pleaseai/chrome-devtools-cli/releases/latest/download/chrome-devtools-linux-arm64 -o chrome-devtools
chmod +x chrome-devtools
sudo mv chrome-devtools /usr/local/bin/
# Linux (x64)
curl -L https://github.com/pleaseai/chrome-devtools-cli/releases/latest/download/chrome-devtools-linux-x64 -o chrome-devtools
chmod +x chrome-devtools
sudo mv chrome-devtools /usr/local/bin/npm/Bun
# Global installation
npm install -g @pleaseai/chrome-devtools-cli
# or
bun add -g @pleaseai/chrome-devtools-cliLocal Installation (as library)
npm install @pleaseai/chrome-devtools-cli
# or
bun add @pleaseai/chrome-devtools-cliClaude Code Plugin
Install as a plugin for Claude Code to get integrated skill documentation and automation support.
Add Marketplace
/plugin marketplace add pleaseai/claude-code-pluginsInstall Plugin
/plugin install chrome-devtools-cli@pleaseaiOnce installed, access comprehensive usage skills directly within Claude Code with automated guidance for browser automation, debugging, and performance testing workflows.
Quick Start
Launch Chrome and Navigate
# Open a new page
chrome-devtools nav new-page --url https://example.com
# Navigate current page
chrome-devtools nav navigate --url https://google.comTake a Screenshot
chrome-devtools debug screenshot --path screenshot.png --full-pageAnalyze Performance
chrome-devtools perf analyze --url https://example.com --format jsonMonitor Network Requests
# Start monitoring
chrome-devtools network start-monitoring
# List requests
chrome-devtools network list-requests --format toonUsage
Global Options
chrome-devtools [global-options] <command> [command-options]Global Options:
--browser-url <url>- Connect to running Chrome via port forwarding--ws-endpoint <endpoint>- WebSocket endpoint for Chrome--ws-headers <headers>- Custom WebSocket headers (JSON)--headless- Run in headless mode--executable-path <path>- Path to Chrome executable--isolated- Use temporary user data directory--channel <channel>- Chrome channel (stable|canary|beta|dev)--viewport <viewport>- Initial viewport size (e.g., 1280x720)--proxy-server <proxy>- Proxy server configuration--accept-insecure-certs- Ignore certificate errors--format <format>- Output format (json|toon|text)
Commands
Input Automation
Click on Element
chrome-devtools input click --uid <element-uid>
chrome-devtools input click --uid <element-uid> --dbl-clickHover over Element
chrome-devtools input hover --uid <element-uid>Fill Input Field
chrome-devtools input fill --uid <element-uid> --value "text"Press Keyboard Key
chrome-devtools input press-key --key Enter
chrome-devtools input press-key --key "Control+C"Drag and Drop
chrome-devtools input drag --from <source-uid> --to <target-uid>Upload File
chrome-devtools input upload-file --uid <input-uid> --file /path/to/file.pdfHandle Dialog
chrome-devtools input handle-dialog --action accept
chrome-devtools input handle-dialog --action dismiss
chrome-devtools input handle-dialog --action accept --prompt-text "my input"Navigation
List Pages
chrome-devtools nav list-pages
chrome-devtools nav list-pages --format jsonSelect Page
chrome-devtools nav select-page --index 0Close Page
chrome-devtools nav close-page --index 1Create New Page
chrome-devtools nav new-page --url https://example.com
chrome-devtools nav new-page --url https://example.com --timeout 30000Navigate Page
chrome-devtools nav navigate --url https://example.comWait for Element or Text
chrome-devtools nav wait-for --selector "#my-element"
chrome-devtools nav wait-for --text "Welcome"
chrome-devtools nav wait-for --selector ".button" --timeout 5000Emulation
Emulate Device
chrome-devtools emulate device --name "iPhone 13"
chrome-devtools emulate device --name "iPad Pro"Resize Viewport
chrome-devtools emulate resize --width 1920 --height 1080Performance
Start Performance Trace
chrome-devtools perf start-traceStop Performance Trace
chrome-devtools perf stop-trace --output trace.jsonAnalyze Performance
chrome-devtools perf analyze --url https://example.com
chrome-devtools perf analyze --url https://example.com --duration 5000 --format jsonNetwork
Start Monitoring
chrome-devtools network start-monitoringList Network Requests
chrome-devtools network list-requests
chrome-devtools network list-requests --limit 10 --offset 0 --format toonGet Request Details
chrome-devtools network get-request --id req-123Clear Request History
chrome-devtools network clearDebugging
Start Console Monitoring
chrome-devtools debug start-console-monitoringList Console Messages
chrome-devtools debug list-console
chrome-devtools debug list-console --types error,warning --format jsonGet Console Message
chrome-devtools debug get-console --id msg-123Clear Console History
chrome-devtools debug clear-consoleEvaluate JavaScript
chrome-devtools debug evaluate --script "document.title"
chrome-devtools debug evaluate --script "window.innerWidth" --format jsonTake Screenshot
chrome-devtools debug screenshot --path screenshot.png
chrome-devtools debug screenshot --path screenshot.jpg --type jpeg --quality 80
chrome-devtools debug screenshot --full-page --path full-page.pngTake Page Snapshot
chrome-devtools debug snapshot
chrome-devtools debug snapshot --verboseBrowser Management
Close Browser
chrome-devtools closeOutput Formats
Text (Default)
Human-readable output format for console display.
chrome-devtools nav list-pagesJSON
Standard JSON format for programmatic consumption.
chrome-devtools nav list-pages --format jsonTOON
Token-optimized format that reduces output size by ~58.9% compared to JSON, ideal for LLM processing.
chrome-devtools nav list-pages --format toonAdvanced Usage
Connecting to Existing Chrome Instance
Step 1: Start Chrome with Remote Debugging
macOS:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--remote-debugging-port=9222 \
--user-data-dir=/tmp/chrome-profileLinux:
/usr/bin/google-chrome \
--remote-debugging-port=9222 \
--user-data-dir=/tmp/chrome-profileWindows:
"C:\Program Files\Google\Chrome\Application\chrome.exe" ^
--remote-debugging-port=9222 ^
--user-data-dir="%TEMP%\chrome-profile"Step 2: Connect via CLI
chrome-devtools --browser-url http://127.0.0.1:9222 nav list-pagesUsing WebSocket Endpoint
# Get WebSocket URL from http://127.0.0.1:9222/json/version
chrome-devtools --ws-endpoint ws://127.0.0.1:9222/devtools/browser/<id> nav list-pagesHeadless Mode
chrome-devtools --headless nav new-page --url https://example.com
chrome-devtools --headless debug screenshot --path screenshot.pngCustom Chrome Channel
chrome-devtools --channel canary nav new-page --url https://example.com
chrome-devtools --channel beta perf analyze --url https://example.comIsolated Mode (Temporary Profile)
chrome-devtools --isolated nav new-page --url https://example.comExamples
Complete Automation Workflow
# 1. Start console and network monitoring
chrome-devtools debug start-console-monitoring
chrome-devtools network start-monitoring
# 2. Navigate to a page
chrome-devtools nav new-page --url https://example.com
# 3. Interact with the page
chrome-devtools input fill --uid input-email --value "[email protected]"
chrome-devtools input fill --uid input-password --value "password123"
chrome-devtools input click --uid button-login
# 4. Wait for navigation
chrome-devtools nav wait-for --text "Dashboard"
# 5. Take a screenshot
chrome-devtools debug screenshot --path dashboard.png
# 6. Get console errors
chrome-devtools debug list-console --types error --format json
# 7. Get network requests
chrome-devtools network list-requests --format toon
# 8. Clean up
chrome-devtools closePerformance Testing
# Analyze performance with trace
chrome-devtools perf start-trace
chrome-devtools nav new-page --url https://example.com
chrome-devtools nav wait-for --timeout 5000
chrome-devtools perf stop-trace --output trace.json
# Or use the combined analyze command
chrome-devtools perf analyze \
--url https://example.com \
--duration 10000 \
--format json > performance-report.jsonMobile Emulation Testing
# Test on iPhone
chrome-devtools emulate device --name "iPhone 13"
chrome-devtools nav new-page --url https://example.com
chrome-devtools debug screenshot --path mobile-view.png
# Test on iPad
chrome-devtools emulate device --name "iPad Pro"
chrome-devtools nav navigate --url https://example.com
chrome-devtools debug screenshot --path tablet-view.png
# Custom viewport
chrome-devtools emulate resize --width 375 --height 667Architecture
This CLI provides browser automation capabilities using:
- Puppeteer - Browser automation
- Commander.js - CLI framework
- @pleaseai/cli-toolkit - Output formatting and utilities
Project Structure
chrome-devtools-cli/
├── src/
│ ├── browser/ # Browser management utilities
│ ├── commands/ # Command implementations
│ │ ├── input.ts # Input automation
│ │ ├── navigation.ts # Navigation commands
│ │ ├── emulation.ts # Device emulation
│ │ ├── performance.ts # Performance analysis
│ │ ├── network.ts # Network inspection
│ │ └── debugging.ts # Debugging tools
│ ├── cli.ts # CLI entry point
│ ├── types.ts # TypeScript types
│ └── index.ts # Library exports
├── references/
│ └── chrome-devtools-mcp/ # Submodule reference
└── package.jsonAPI Reference
The CLI can also be used programmatically:
import {
click,
closeBrowser,
getBrowser,
navigatePage,
performanceAnalyzeInsight,
takeScreenshot,
} from '@pleaseai/chrome-devtools-cli'
// Navigate to a page
await navigatePage({ url: 'https://example.com' })
// Take a screenshot
const screenshot = await takeScreenshot({
path: 'screenshot.png',
fullPage: true,
})
// Analyze performance
const perfData = await performanceAnalyzeInsight({
url: 'https://example.com',
})
// Clean up
await closeBrowser()Comparison with Chrome DevTools MCP
| Feature | Chrome DevTools MCP | Chrome DevTools CLI | | -------------------- | ------------------------------- | --------------------------- | | Interface | MCP Server | CLI Commands | | Usage | AI Assistants (Claude, Copilot) | Command Line / Scripts | | Output Format | MCP Protocol | JSON / TOON / Text | | Token Efficiency | Standard | ~58.9% reduction (TOON) | | Browser Control | ✅ | ✅ | | Performance Analysis | ✅ | ✅ | | Network Inspection | ✅ | ✅ | | Debugging Tools | ✅ | ✅ | | Automation Scripts | ❌ | ✅ | | Programmatic API | ❌ | ✅ |
Requirements
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT © PleaseAI
Credits
This project is inspired by the excellent Chrome DevTools MCP by Google LLC.
Related Projects
- Chrome DevTools MCP - MCP server for Chrome DevTools
- @pleaseai/cli-toolkit - CLI utilities for LLM-focused tools
- Puppeteer - Headless Chrome Node.js API
Support
Author: Minsu Lee (@amondnet)
