Skip to content
AnswerWell geo Documentation

Research · 8 min read · Answerwell

Coding Agent Browser DevTools: MCP Server, CLI, Configuration, and Extensions

How AI coding agents connect to a live browser via MCP or CLI, configure flags, auto-connect, and debug extensions safely.

This page summarizes Chrome DevTools for agents documentation: a suite that brings Chrome DevTools into AI coding workflows through an MCP server, a terminal CLI, and agent skills. Both interfaces talk to the same engine—a persistent background daemon that uses the Chrome DevTools Protocol (CDP)—so agents can open pages, emulate users, inspect network and console output, run performance work, and (with the right flags) debug Chrome extensions.

Chrome DevTools for agents: what it gives a coding agent

Section titled “Chrome DevTools for agents: what it gives a coding agent”

Chrome DevTools for agents is described as a suite that connects your agent to a live Chrome instance using the Model Context Protocol (MCP), exposes a CLI for shell scripts, and ships agentic skills that teach multi-step tasks (accessibility, performance, and similar workflows).

Chrome DevTools for agents is a suite of tools that brings the power of Chrome DevTools to your AI coding workflows. By installing Chrome DevTools for agents, you gain access to: MCP Server… Chrome DevTools CLI… Agentic Skills…

— Google, Get started with Chrome DevTools for agents

Prerequisites from the same guide: Node.js (latest LTS) and npm, plus a current stable Chrome build. Any client that supports MCP (Antigravity, Gemini CLI, Claude Code, Cursor, Copilot, and others) can register the chrome-devtools-mcp package.

MCP server vs DevTools CLI: which interface to use

Section titled “MCP server vs DevTools CLI: which interface to use”

Choosing MCP or the CLI is a trade-off between exploration, token cost, and reusability.

Choosing between the CLI and the MCP server is an engineering decision about cost, context, and workflow.

— Google, Automate repeatable browser workflows with the Chrome DevTools CLI

Factor MCP server DevTools CLI
Context cost Every tool definition and JSON schema is injected into the agent’s system prompt each turn Agent loads a compact skill summary and pays token cost when it reads the full skill
Best fit Unknown issues; full toolbox; live introspection Known steps; scripts; CI without an MCP client
Reusability Tool calls live inside a conversation Scripts can be saved, rerun, and checked in

MCP server: Your agent connects over standard input/output using JSON-RPC and treats every browser tool as an interactive function call. CLI: Your agent executes shell commands directly against the same background daemon.

— Google, Automate repeatable browser workflows with the Chrome DevTools CLI

Use the MCP server when you are investigating an unknown issue, want dynamic problem-solving, or your IDE supports MCP. Use the CLI when you already know the steps, want token-efficient skills, or need terminal/CI automation without an LLM session (CLI guide).

CLI command pattern and persistent browser state

Section titled “CLI command pattern and persistent browser state”

Commands follow chrome-devtools <tool> [arguments] [flags]. The background server starts on first use; browser state persists across commands unless you close pages. Most actions need a page ID from list_pages and element UIDs from take_snapshot.

chrome-devtools new_page "https://example.com"
chrome-devtools list_pages
chrome-devtools take_snapshot 1
chrome-devtools fill 1 "1_4" "hello"
chrome-devtools list_console_messages 1 --types error

Pass --output-format=json for machine-readable output in scripts. Default output is plain Markdown-like text. For Lighthouse-only CI, Google recommends the standalone Lighthouse CLI rather than lighthouse_audit from the DevTools CLI (CLI guide).

MCP installation: JSON config and agent-specific commands

Section titled “MCP installation: JSON config and agent-specific commands”

For generic MCP clients, add an mcpServers entry that runs npx with chrome-devtools-mcp@latest (Get started):

{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": ["-y", "chrome-devtools-mcp@latest"]
}
}
}

Examples from the cluster for other environments:

  • Claude Code (plugin): marketplace and install steps in Chrome DevTools for agents and Get started.
  • Claude Code (MCP only): claude mcp add chrome-devtools --scope project -- npx chrome-devtools-mcp@latest --categoryExtensions --autoConnect (Build extensions with coding agents).
  • Codex: codex mcp add chrome-devtools -- npx chrome-devtools-mcp@latest (Get started).
  • Gemini CLI: gemini extensions install --auto-update https://github.com/ChromeDevTools/chrome-devtools-mcp or gemini mcp add chrome-devtools npx chrome-devtools-mcp@latest (Get started).

Antigravity 2.0 bundles DevTools for agents; slash commands such as /browser Navigate to the Google homepage can drive the browser sub-agent (Chrome DevTools for agents).

To verify setup, Google suggests prompting: check the performance of https://developers.chrome.com—the agent should open Chrome and record a performance trace (Get started).

Server configuration: browser connection, files, and tool categories

Section titled “Server configuration: browser connection, files, and tool categories”

Flags go in the args array of your MCP client config (Configuration).

Example for headless Canary:

{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": ["-y", "chrome-devtools-mcp@latest", "--headless", "--channel=canary"]
}
}
}

Connect to an existing browser (--autoConnect or --browser-url)

Section titled “Connect to an existing browser (--autoConnect or --browser-url)”

By default the server launches a new Chrome profile. To attach to your running browser (signed-in tabs, extensions, live state), use --autoConnect (Chrome 144+) after enabling remote debugging at chrome://inspect/#remote-debugging, or start Chrome with --remote-debugging-port and pass --browser-url=http://127.0.0.1:9222 (Configuration, auto-connect use cases).

For extension work and Google Sign-in flows, Google recommends --autoConnect so the agent uses your default profile instead of an isolated test profile (Build extensions with coding agents).

File-saving tools (screenshots, traces, extension load paths) are limited to MCP roots plus directories listed with --filesystemRoot / --workspace. Without roots, access defaults to the OS temp directory and other paths return “Access denied” (Configuration, Debug Chrome extensions with AI agents).

Important defaults from Configuration:

Flag Default Purpose
--categoryExtensions false Install, reload, trigger extension actions (pipe connection)
--categoryMemory / analysis needs --memoryDebugging Beyond take_heapsnapshot: compare snapshots, retaining paths (memory agents doc)
--categoryExperimentalWebmcp false list_webmcp_tools, execute_webmcp_tool (Chrome 149+, origin trial or flag)
--categoryExperimentalThirdParty false Page-exposed custom devtools tools (third-party tools)

Example for extension development:

"args": [
"chrome-devtools-mcp@latest",
"--categoryExtensions",
"--autoConnect",
"--filesystemRoot=/path/to/project"
]

Privacy-related defaults include usage statistics (--usageStatistics, opt out with --no-usage-statistics or CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS) and CrUX URL submission from performance traces (--performanceCrux, opt out with --no-performance-crux) (Configuration, auto-connect).

auto-connect: debug the tab you already have open

Section titled “auto-connect: debug the tab you already have open”

auto-connect lets the agent use your active Chrome instance—tabs, extensions, and session storage—after you enable remote debugging and add --autoConnect to MCP args.

Typical situations: SSO or VPN-protected dashboards where sandboxed agents cannot sign in; fixing a layout bug on the page where you already reproduced it; extension APIs that need your real profile.

Connect your AI agent directly to your active browser instance with the auto-connect feature. This allows your agent to bypass sandbox limitations by inheriting your current tabs, browser extensions, and live application state.

— Google, Connect your AI agent to your personal browser with auto-connect

Chrome prompts for permission when the agent connects; while automation is active, Chrome shows that it is controlled by automated test software (Build extensions with coding agents). Remote debugging must be allowed at the start of each new browser session.

With --categoryExtensions, agents can manage the extension lifecycle without manually loading unpacked builds on every change (Debug Chrome extensions with AI agents):

  • Install unpacked extensions from an absolute directory path
  • List, reload, uninstall by extension ID
  • Trigger default extension actions (e.g. toolbar click)

install_extension needs the folder inside configured workspace roots; otherwise add --filesystemRoot (extensions agents doc).

Modern Web Guidance and its chrome-extensions skill supply up-to-date APIs, best practices, and Chrome Web Store submission notes; Build extensions with coding agents pairs that skill with DevTools for agents so the agent can install, reload, and inspect popups, side panels, and service workers in a running Chrome instance.

Persist workflows: from MCP exploration to CLI scripts

Section titled “Persist workflows: from MCP exploration to CLI scripts”

After an MCP debugging session, you can ask the agent to emit a reusable shell script (new_page, take_snapshot, fill, click, list_console_messages) for regression checks, multi-viewport screenshots (emulate + take_screenshot), or CI smoke tests that exit non-zero on console errors (CLI guide).

  • Expecting extension tools without --categoryExtensions — the category is off by default; enable it and use a connection mode that supports pipe features (Configuration).
  • Installing extensions from paths outside workspace roots — add --filesystemRoot or ensure the MCP client exposes project roots (Debug Chrome extensions with AI agents).
  • Assuming heap analysis works out of the box — only take_heapsnapshot is available unless you pass --memoryDebugging (Analyze memory leaks with AI agents).
  • Using WebMCP tools without browser and flag requirements — enable --categoryExperimentalWebmcp and Chrome 149+ with WebMCP enabled on the page or browser (WebMCP debugging).
  • Connecting auto-connect for untrusted agents — the agent sees cookies, storage, and all open tabs (auto-connect).
  • Relying on MCP tool definitions in long sessions — for fixed flows, prefer CLI scripts to save context window and cost (CLI guide).

Pairing Modern Web Guidance with DevTools for agents is the documented pattern for modern code generation plus live verification (performance, a11y trees, console logs) (Modern Web Guidance overview).

  1. Install the MCP server using Get started with Chrome DevTools for agents and run the suggested performance prompt against https://developers.chrome.com to confirm the browser opens and records a trace.
  2. If you use extensions or signed-in flows, add --autoConnect, enable remote debugging per Configuration, and confirm Chrome shows the automation permission dialog once per session.
  3. For extension projects, enable --categoryExtensions, set --filesystemRoot to your unpacked extension directory, and follow Debug Chrome extensions with AI agents to list and reload the extension after a code change.
  4. For repeatable checks, generate or run a small chrome-devtools script per Automate repeatable browser workflows with the Chrome DevTools CLI and use --output-format=json if a pipeline parses results.
  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact sentence you are asking about, and we will fix or clarify it.