The chrome-devtools-mcp package includes a CLI interface that allows you to interact with the browser directly from your terminal. This is particularly useful for debugging or when you want an agent to generate scripts that automate browser actions.
Install the package globally to make the chrome-devtools command available:
npm i chrome-devtools-mcp@latest -g chrome-devtools status # check if install worked.
The CLI enables unrestricted filesystem access by default. Use --workspace to limit file tools to specific directories. Repeat the flag for more than one directory. --allow-unrestricted-paths still works on its own for compatibility, but it cannot be combined with --workspace.
chrome-devtools start --workspace=/path/to/project --workspace=/path/to/output
The chrome-devtools-cli skill teaches your agent how to use the CLI. Plugin installs include this skill. To install it manually, copy the skill folder into the skills directory of your agent:
# Example for Claude Code. Use the skills directory of your agent. mkdir -p ~/.claude/skills cp -R "$(npm root -g)/chrome-devtools-mcp/skills/chrome-devtools-cli" ~/.claude/skills/
See Skills for all skills and installation options.
[!NOTE] Copy the skill again each time you update the CLI. See Keep skills up to date.
The CLI acts as a client to a background chrome-devtools-mcp daemon (uses Unix sockets on Linux/Mac and named pipes on Windows).
list_pages), the CLI automatically starts the MCP server and the browser in the background if they aren't already running.start, stop, and status. The start command forwards all subsequent arguments to the underlying MCP server (e.g., --headless, --userDataDir) but not all args are supported. Run chrome-devtools start --help for supported args. Headless is enabled by default. Isolated is enabled by default unless --userDataDir is provided.stop. Start it with --idleTimeout and a duration in seconds, minutes or hours (e.g., chrome-devtools start --idleTimeout=30m, or 90s, 2h) to close the browser it launched (along with all open pages) after that long without a tool call, or disconnect while leaving the browser open when using --browserUrl, --wsEndpoint or --autoConnect, and exit the daemon shortly afterwards (status does not count as a tool call). The next tool command starts a new daemon with only the default flags and the discovered config file: flags passed to start apply only to that daemon, so re-run start with your flags if you need them, or set "idleTimeout": "30m" in a discovered configuration file to apply it to every daemon.# Check if the daemon is running chrome-devtools status # Navigate page 1 to a URL chrome-devtools navigate_page 1 --url "https://google.com" # Take a screenshot of page 1 and save it to a file chrome-devtools take_screenshot 1 --filePath screenshot.png # Stop the background daemon when finished chrome-devtools stop
The CLI supports all tools available in the MCP server even if they require a flag to activate in the MCP server (see Tool reference).
chrome-devtools <tool> [arguments] [flags]
<pageId> as their first positional argument.--filePath, --fullPage).New Page and Navigation:
chrome-devtools new_page "https://example.com" chrome-devtools navigate_page 1 --url "https://web.dev"
Interaction:
# Click an element by its UID from a snapshot on page 1 chrome-devtools click 1 "element-uid-123" # Fill a form field on page 1 chrome-devtools fill 1 "input-uid-456" "search query"
Script Evaluation:
--categoryExtensions and --pageIdRouting are enabled:--pageId <number>: chrome-devtools evaluate_script "() => document.title" --pageId 1--serviceWorkerId <string>: chrome-devtools evaluate_script "() => self.registration.scope" --serviceWorkerId sw-1# Evaluate a JavaScript expression on page 1 chrome-devtools evaluate_script "() => document.title" --pageId 1 # Evaluate inside an extension service worker chrome-devtools evaluate_script "() => self.registration.scope" --serviceWorkerId sw-1
Analysis:
# Run a Lighthouse audit on page 1 (defaults to navigation mode) chrome-devtools lighthouse_audit 1 --mode snapshot
Logpoints:
# Set a logpoint on page 1 chrome-devtools set_logpoints 1 "src/app.ts:42 'total', cart.total" # Remove all logpoints on page 1 chrome-devtools set_logpoints 1
By default, the CLI outputs a human-readable summary of the tool's result. For programmatic use, you can request raw JSON:
chrome-devtools list_pages --output-format=json
The CLI waits up to 180 seconds for a tool call. Pass --rpc-timeout with a duration in seconds, minutes or hours (e.g., 90s, 5m, 1h) to wait for a different time, for example for a Lighthouse audit of a heavy page or a large heap snapshot:
chrome-devtools lighthouse_audit 1 --rpc-timeout=5m
A tool's own --timeout does not change how long the CLI waits. For --timeout values close to or above 180 seconds, also pass a longer --rpc-timeout.
When the time runs out, or when you stop the CLI (e.g., with Ctrl+C), the daemon cancels the tool call. A call that still waits for its turn or for the browser does not run. A tool that is already running is not interrupted: its result is discarded, and later calls that cannot run at the same time wait until it finishes. A cancelled call no longer counts as activity for --idleTimeout.
If the CLI hangs or fails to connect, try stopping the background process:
chrome-devtools stop
For more verbose logs, set the NODE_DEBUG environment variable. The background process does not write to the terminal, so restart it with --logFile to capture its logs in a file:
NODE_DEBUG=* chrome-devtools start --logFile=/tmp/chrome-devtools.log chrome-devtools list_pages
Implemented in scripts/generate-cli.ts. Some commands are excluded from CLI generation such as wait_for and fill_form.
chrome-devtools-mcp args are also filtered in src/bin/chrome-devtools.ts because not all args make sense in a CLI interface.
By default, all commands share one daemon and browser. Pass --sessionId=<id> or set CHROME_DEVTOOLS_SESSION_ID to scope start, status, stop, and tool calls to an isolated daemon and browser. Session IDs use hex digits and dashes (such as a UUID); --sessionId overrides CHROME_DEVTOOLS_SESSION_ID.
SESSION_ID=$(uuidgen) chrome-devtools start --sessionId="$SESSION_ID" chrome-devtools list_pages --sessionId="$SESSION_ID" chrome-devtools stop --sessionId="$SESSION_ID"