Chrome Control MCP — Browser Control

Configuration Location

~/.claude.json (not ~/.claude/settings.json):

1
2
3
4
5
6
7
8
{
  "chrome-control": {
    "command": "node",
    "args": [
      "/usr/local/node-v24.14.0-linux-x64/lib/node_modules/mcp-chrome-bridge/dist/mcp/mcp-server-stdio.js"
    ]
  }
}

Process Architecture (process tree)

1
2
3
4
5
6
systemd(1)
  └─ chrome(92439)  ← Chrome main process
       ├─ mcp-chrome-bridge(92929, process name: MainThread)
       │    └─ listening on 127.0.0.1:12306 (HTTP)
       ├─ chrome(92508)  ← renderer/GPU/network child processes
       └─ ...

Key facts

  • Who starts mcp-chrome-bridge? — Chrome does. Chrome reads the Native Messaging Host configuration (/etc/opt/chrome/native-messaging-hosts/com.chromemcp.nativehost.json) and automatically launches mcp-chrome-bridge as a child process at startup.
  • Shared or one per Claude session? — Shared. There is only one daemon. It has been running since July 19, and all Claude sessions connect to the same 127.0.0.1:12306.
  • Are Chrome and mcp-chrome-bridge independent processes? — They have a parent-child relationship. Chrome is the parent; mcp-chrome-bridge is the child.

Three-tier Interaction Architecture

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
┌─ Claude Code ───────────────────────────┐
│  chrome-control MCP tools                │
└──────────┬──────────────────────────────┘
           │ ① HTTP (127.0.0.1:12306/mcp)
           ▼
┌─ mcp-chrome-bridge daemon ──────────────┐
│  Child process of Chrome, PID 92929      │
│  Does two things at once:                │
│    • HTTP service (port 12306)           │
│    • Native Messaging communication      │
└──────────┬──────────────────────────────┘
           │ ② Native Messaging (stdin/stdout pipe)
           ▼
┌─ Chrome Extension ──────────────────────┐
│  Name: chrome-mcp-server                 │
│  Version: 1.0.0                          │
│  ID: hbdgbgagpkpjffpklnamcljpakneikee    │
│  Type: persistent background Service Worker │
│  chrome.runtime.connectNative()           │
└──────────┬──────────────────────────────┘
           │ ③ CDP (Chrome DevTools Protocol)
           ▼
┌─ Chrome browser ────────────────────────┐
│  Open tabs, page content, DOM            │
└─────────────────────────────────────────┘

Native Messaging Protocol

This is the standard mechanism for communication between a Chrome extension and a local program. It is a pipe, not a network port.

Registration

The Native Messaging Host configuration file tells Chrome how to start the local program:

/etc/opt/chrome/native-messaging-hosts/com.chromemcp.nativehost.json

1
2
3
4
5
6
7
8
{
  "name": "com.chromemcp.nativehost",
  "path": "/usr/local/.../mcp-chrome-bridge/dist/run_host.sh",
  "type": "stdio",
  "allowed_origins": [
    "chrome-extension://hbdgbgagpkpjffpklnamcljpakneikee/"
  ]
}
  • type: "stdio" — communicates over stdin/stdout
  • path — the program Chrome should launch
  • allowed_origins — only the specified extension may connect

Message format

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
┌──────────┬─────────────────────────────┐
│ 4 bytes  │         JSON data            │
│ (length) │   (UTF-8 encoded JSON string)│
│ little-  │                              │
│ endian   │                              │
├──────────┼─────────────────────────────┤
│  0x1A    │ {"type":"request",...}       │
│  0x00    │                              │
│  0x00    │                              │
│  0x00    │                              │
└──────────┴─────────────────────────────┘
  1. Write a 4-byte little-endian integer indicating the length of the JSON that follows.
  2. Write the JSON string.
  3. The receiver reads 4 bytes to get the length, then reads exactly that many bytes of JSON.

Chrome Extension API

The Chrome extension establishes a connection with chrome.runtime.connectNative('com.chromemcp.nativehost'), which returns a Port object. It communicates through port.postMessage() and port.onMessage.

Full Request Flow (using get_windows_and_tabs as an example)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Step 1: Claude calls the chrome-control get_windows_and_tabs tool
         ↓
Step 2: The mcp-chrome-bridge MCP Server (stdio CLI) receives the call
         ↓  HTTP POST (127.0.0.1:12306/mcp)
Step 3: The mcp-chrome-bridge daemon (port 12306) receives the request
         ↓  forwards it internally to the Native Messaging Host module
Step 4: The Native Messaging Host serializes the request to JSON
         ↓  writes it to stdout in Native Messaging format
Step 5: The Chrome extension's stdin receives the message
         ↓  parses the JSON and recognizes the get_windows_and_tabs command
Step 6: The extension queries Chrome for window/tab information via CDP
         ↓  CDP requests: Target.getTargets, Browser.getWindowForTarget, etc.
Step 7: Chrome returns the CDP response
         ↓  the extension receives the window/tab data
Step 8: The extension serializes the result to JSON
         ↓  writes it to stdout in Native Messaging format
Step 9: mcp-chrome-bridge's stdin receives the response
         ↓  parses the JSON and prepares the HTTP response
Step 10: The daemon returns HTTP 200 + JSON data
          ↓
Step 11: The MCP Server receives the response and returns it to Claude
          ↓
Step 12: Claude receives the window/tab list

Simplified data flow

1
2
3
Claude → HTTP → mcp-chrome-bridge → stdin/stdout → Chrome extension → CDP → Chrome
                                                                              ↓
Claude ← HTTP ← mcp-chrome-bridge ← stdin/stdout ← Chrome extension ← CDP ← 

Network Ports

PortProcessPurpose
12306MainThread (mcp-chrome-bridge)HTTP MCP endpoint for Claude
(none)Chrome extensionCommunicates over stdin/stdout, no network

Installation (other machines)

Prerequisites

  • Node.js 20+
  • npm / pnpm
  • Chrome browser

Steps

1. Install mcp-chrome-bridge globally

1
npm install -g mcp-chrome-bridge

The postinstall script runs automatically and registers the user-level Native Messaging Host.

2. Register the Native Messaging Host

1
2
3
4
5
6
7
8
# Auto-detect installed browsers and register
mcp-chrome-bridge register --detect

# Or specify a browser
mcp-chrome-bridge register --browser chrome

# System-level installation (all users)
sudo mcp-chrome-bridge register -s

After registration, a configuration file is created at ~/.config/google-chrome/NativeMessagingHosts/com.chromemcp.nativehost.json.

3. Install the Chrome extension

Install the chrome-mcp-server extension from the Chrome Web Store:

1
https://chromewebstore.google.com/detail/chrome-mcp-server/hbdgbgagpkpjffpklnamcljpakneikee

In the extension management page, confirm the extension ID is hbdgbgagpkpjffpklnamcljpakneikee and that the Service Worker is running in the background.

4. Verify the installation

1
2
# Run diagnostics
mcp-chrome-bridge doctor

Confirm that the key items are all [OK]:

1
2
3
4
5
[OK] Installation: mcp-chrome-bridge@1.0.31
[OK] Host files: run_host.sh is executable
[OK] Chrome manifest: NativeMessagingHosts/com.chromemcp.nativehost.json
[OK] Port config: http://127.0.0.1:12306/mcp
[OK] Connectivity: GET http://127.0.0.1:12306/ping -> 200

5. Configure ~/.claude.json

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
  "mcpServers": {
    "chrome-control": {
      "command": "node",
      "args": [
        "mcp-chrome-stdio"
      ]
    }
  }
}

mcp-chrome-bridge registers the mcp-chrome-stdio command automatically after installation. An absolute path also works:

1
/usr/local/node-v24.14.0-linux-x64/lib/node_modules/mcp-chrome-bridge/dist/mcp/mcp-server-stdio.js

Find the exact path with npm list -g mcp-chrome-bridge.

6. Restart Chrome and Claude Code

When Chrome restarts, it automatically launches the mcp-chrome-bridge child process, which listens on port 12306. After Claude Code restarts, the chrome-control tools are available.

How It Works

LayerProtocolComponents
Claude → bridgeHTTP (port 12306)MCP Server ↔ mcp-chrome-bridge daemon
Bridge → Chrome extensionNative Messaging (stdin/stdout)Daemon ↔ Chrome Extension
Extension → pageCDP (Chrome DevTools Protocol)The extension controls browser tabs through CDP

Key points

  • No --remote-debugging-port startup flag is required.
  • No socket/pipe files are involved.
  • Native Messaging uses a stdin/stdout pipe; the message format is [4-byte length][JSON].
  • The Chrome extension uses CDP internally to access tabs — the same protocol used by DevTools.

What It Can Do

Tab management

ToolDescription
get_windows_and_tabsList all windows and tabs, including URLs and titles
chrome_switch_tabSwitch to a specific tab
chrome_close_tabsClose specified tabs
chrome_navigateNavigate the current tab to a new URL, refresh the page, or go back/forward

Page reading

ToolDescription
chrome_read_pageRead the page’s accessibility tree to get the page structure and visible elements. Can filter to interactive elements only (buttons/links/inputs) and can extract plain text
chrome_get_web_contentGet visible text or HTML content, with CSS selector support for specific regions
chrome_screenshotCapture a screenshot of the current page or a specific element

Page interaction

ToolDescription
chrome_click_elementClick an element (CSS selector, XPath, element ref, or viewport coordinates). Supports left/right/middle button, double-click, and modifier keys (Ctrl/Shift/Alt)
chrome_fill_or_selectFill forms (inputs, textareas, selects, checkboxes, radio buttons)
chrome_keyboardSimulate keyboard input (single keys, shortcuts like Ctrl+C, text input), optionally targeting a specific element
chrome_computerCombined operations: mouse click/drag/scroll, keyboard input, wait, zoom, screenshot
chrome_upload_fileUpload files through a file picker (local path, URL download, or base64 data)
chrome_handle_dialogHandle JavaScript dialogs (alert/confirm/prompt) by accepting or dismissing

JavaScript execution

ToolDescription
chrome_javascriptExecute arbitrary JavaScript in the page context, with top-level await support and a return value

Forms and network

ToolDescription
chrome_network_captureStart/stop capturing network requests, including request/response details and optional response bodies
chrome_consoleCapture page console output (log/warn/error) in Buffer or snapshot mode
chrome_network_requestSend network requests directly from the browser with the browser’s cookies and context

GIF recording

ToolDescription
chrome_gif_recorderRecord a tab interaction as an animated GIF. Supports fixed-FPS mode and auto-capture mode (captures a frame after each action), with configurable FPS, duration, size, click indicators, and action labels

Performance analysis

ToolDescription
performance_start_traceStart a performance trace, with optional page reload and auto-stop duration
performance_stop_traceStop the trace and export the Trace JSON
performance_analyze_insightAnalyze the recorded trace and produce performance insights

Browser management

ToolDescription
chrome_bookmark_searchSearch bookmarks
chrome_bookmark_addAdd a bookmark
chrome_bookmark_deleteDelete a bookmark
chrome_historySearch browsing history
chrome_handle_downloadWait for and get download details

What It Cannot Do

  • Access pages that are not open
  • Read browsing history, bookmarks, or passwords
  • Install extensions or change browser settings
  • Access the content of closed tabs

Limitations

JavaScript cannot run when CDP is occupied

The chrome-mcp-server extension itself holds the CDP connection. When CDP is occupied, chrome_javascript falls back to chrome.scripting.executeScript (isolated world), but in practice the fallback also fails to return results. This means that in some scenarios you cannot extract data in bulk through JavaScript.

No structured data extraction tools

Missing capabilityImpact
Built-in DOM query / CSS selector data extractionList pages (such as torrent lists) only yield plain text, requiring an external Python script for a second parsing pass
No page.$$eval() equivalentThere is no Playwright/Puppeteer-style way to run a selector on the page and return structured JSON
Unstructured return valueschrome_get_web_content and chrome_read_page both return plain text, so tabular data loses its row/column structure

Scenario comparison

Scenariochrome-controlPlaywright/Puppeteer
Clicking, filling forms, navigation✅ Convenient✅ Convenient
Reading visible page text✅ Works✅ Works
Bulk list extraction❌ Needs external parsing✅ One line with page.$$eval()
Operating on already-logged-in pages✅ Native support❌ You handle cookies yourself
Screenshots✅✅

Workarounds

If you need bulk data extraction, consider a dedicated browser automation MCP:

1
claude mcp add playwright -- npx -y @playwright/mcp

Or use a Python + Playwright script and bypass the MCP layer entirely.

Session Reuse

Login state (cookies/session) in Chrome is inherited automatically. For a site already logged in in a tab (such as M-Team), operating in that tab’s context carries the login state.

FAQ

The Chrome Control MCP server is not connected

1
The Chrome control MCP server is currently not connected

Possible causes:

  • The configuration in ~/.claude.json was modified or deleted
  • The mcp-chrome-bridge daemon is not running (nothing is listening on port 12306)
  • The Chrome extension is disabled or uninstalled
  • The mcp-chrome-bridge child process did not start correctly after Chrome restarted

Resolution:

  1. Confirm the chrome-control configuration exists in ~/.claude.json
  2. Check whether port 12306 is listening: ss -tlnp | grep 12306
  3. Check whether the Chrome extension hbdgbgagpkpjffpklnamcljpakneikee is enabled
  4. Restart Chrome (this also restarts the mcp-chrome-bridge child process)
  5. Restart Claude Code

Tool calls fail with “Failed to connect to MCP server” / “Already connected to a transport”

Symptoms: All chrome-control tool calls fail with Failed to connect to MCP server, while claude mcp list still shows ✔ Connected.

Root cause (diagnosed on 2026-08-12): In mcp-chrome-bridge 1.0.31, the daemon (dist/server/index.js) uses a singleton MCP Server (getMcpServer() in dist/mcp/mcp-server.js) to connect every new transport in the /mcp and /sse routes. The MCP SDK’s Protocol.connect() allows only one transport (protocol.js throws “Already connected to a transport”). Once a client disconnects abnormally and the transport does not fire onclose, the singleton is stuck forever, and all subsequent connections are rejected. The daemon’s stderr log fills with ERR_HTTP_HEADERS_SENT (the old log grew beyond 200 MB).

Fix (patched in dist/):

  1. dist/mcp/mcp-server.js: add a createMcpServer() factory that returns an independent Server instance with tools registered each time
  2. dist/server/index.js: change the /mcp and /sse routes to use createMcpServer() (instead of getMcpServer()), giving each connection its own Server
  3. dist/server/index.js GET /mcp route: remove the manual SSE header pre-write (setHeader/flushHeaders) and hand header writing entirely to the SDK transport after reply.hijack(), eliminating ERR_HTTP_HEADERS_SENT

Verification: single end-to-end connection ✓, 3 concurrent clients all connected ✓, zero errors in the log ✓.

Note: The patch modifies the compiled dist/ output directly, so upgrading the npm package overwrites it. Re-apply the patch after upgrading. The backup made during the fix has been deleted; back up with cp before changing anything.

Recovery steps:

  1. Kill the broken daemon (the Chrome extension will automatically reconnect and start a new one):
    1
    2
    
    ss -tlnp | grep 12306   # find the pid
    kill <pid>
    
  2. If a session still cannot connect (its stdio client cached the old connection), restart that Claude session or reconnect via /mcp.

Chrome does not respond to operations

If an operation hangs and never returns, possible causes:

  • A dialog is open on the page (alert/confirm/prompt)
  • The page is still loading
  • An unclosed modal is present

Resolution: use chrome_handle_dialog to handle dialogs, or close them manually and retry.

Element not found

If chrome_read_page does not return the target element:

  • The element is outside the viewport; scroll to it with scroll_to and retry
  • The element is inside an iframe; specify frameId
  • The page is a dynamically loaded SPA; wait for the data to load before reading

Relationship with Other MCPs

MCPConfiguration filePurposeStartup
chrome-control~/.claude.jsonBrowser controlChrome launches it as a child process at startup
browsermcp~/.claude/settings.jsonGeneral browser controlStarted on demand
mysql~/.claude/settings.jsonMySQL databaseStarted on demand

The three run independently and do not affect each other.

@playwright/mcp

Configuration

Installation (already installed):

1
claude mcp add playwright -- npx -y @playwright/mcp --browser chrome --user-data-dir /home/tianbao/.config/google-chrome --headless

Key parameters:

ParameterValueDescription
--browser chromechromeUse the system-installed Chrome instead of Playwright’s bundled Chromium
--user-data-dirExisting Chrome profile dirReuse the existing Chrome user data (cookies, login state, and extensions all inherited)
--headlessHeadless modeNo visible browser window, saves resources; remove it to run with a UI

Comparison with chrome-control

Featurechrome-control@playwright/mcp
Attach to existing browser✅ Attaches to the Chrome you are using❌ Starts its own instance
Reuse login state✅ Inherited automatically✅ Inherited via --user-data-dir
JavaScript execution❌ CDP is occupied by the extension✅ Fully functional
CDP conflicts❌ Conflicts with chrome-mcp-server✅ Exclusive CDP
Data extractionPlain text, needs a second passReturns structured JSON directly
DOM queriesNo built-in tool✅ Arbitrary queries with page.evaluate()
StartupChrome child process, always runningOn demand (npx)

Installation (other machines)

1
2
3
4
5
6
7
8
9
# 1. Install (requires Node.js)
npm install -g @playwright/mcp  # or use it on demand via npx

# 2. Add to Claude Code
claude mcp add playwright -- npx -y @playwright/mcp \
  --browser chrome \
  --user-data-dir /home/tianbao/.config/google-chrome

# 3. For a visible browser window (debugging), remove --headless or add --headed
CC BY-NC-ND 4.0