Skip to main content

chrome-mcp

English | 简体中文

A Model Context Protocol server for browser automation, powered by DrissionPage.

Lets MCP clients (Claude Desktop, Claude Code, Cursor, etc.) drive a real Chromium browser through a minimal 7-tool surface — all sharing one "current tab" pointer.

Why

  • Zero learning curve for agents. Facade tools (execute_js, run_cdp, navigate, capture) speak only universal knowledge — JavaScript, the CDP protocol, URLs. No niche-library syntax required for the 90% cases.
  • Full power underneath. run_drission_code is the complete-capability base: execute DrissionPage Python code in-process with page / browser / context (persistent dict) / switch_tab() / tabs() / relaunch() injected — loops, waits, multi-tab orchestration, anything one tool call can't express.
  • One pointer, always in sync. Switch tabs via DrissionPage code or Target.createTarget/Target.activateTarget CDP commands — every tool follows. (Call tools serially per session; the shared pointer is not concurrency-safe.)
  • Multi-instance safe. Per-process isolation (atomic port allocation via socket.bind + PID/UUID private user-data dirs) — spawn N servers, zero conflicts.
  • Self-documenting. get_manual returns a compact built-in cheat sheet (DrissionPage locator syntax, error-prone CDP recipes, capture workflow, launch options) — agents fetch it on demand, zero token cost otherwise.

Installation

uv tool install chrome-mcp
# or
uvx chrome-mcp
# or
pip install chrome-mcp

Requires Python ≥ 3.10 and a local Chromium-based browser.

Usage

Add to your MCP client config (e.g. claude_desktop_config.json). Two equivalent forms:

{
  "mcpServers": {
    "chrome": {
      "command": "chrome-mcp"
    }
  }
}

Or run on the fly with uvx (no install needed):

{
  "mcpServers": {
    "chrome": {
      "command": "uvx",
      "args": ["chrome-mcp"]
    }
  }
}

A typical agent flow:

navigate("https://httpbin.org/get")                  → returns tab list
execute_js("return document.body.innerText")         → page data as JSON
capture(action="start", url_filter="api/")
... trigger requests ...
capture(action="get")                                → overview inline,
                                                       full bodies in $TMPDIR/chrome-mcp-captures/*.json

Tools

Tool Description
navigate Navigate in current tab, or open a new tab (new_tab) and switch the pointer to it. Returns the full tab list
execute_js Run JavaScript in the current tab (must return the result). preset: "dom_tree" outputs a DOM structure tree without writing the template
run_cdp Raw CDP passthrough to the current tab. Target.createTarget / activateTarget auto-switch the pointer — no attachToTarget needed
run_drission_code Full-capability base: execute DrissionPage Python code with injected page/browser/context/switch_tab()/tabs()/relaunch()
capture Network capture in one tool: action = start / get / stop. Overview returned inline; full data (with bodies) saved to $TMPDIR/chrome-mcp-captures/capture_*.json
get_manual Return the built-in authoring manual (locator syntax, CDP recipes, capture workflow, launch options)
close_browser Close the browser instance

Launch options

Customize browser startup via command-line args:

{
  "mcpServers": {
    "chrome": {
      "command": "chrome-mcp",
      "args": ["--headless", "--proxy", "http://127.0.0.1:7890", "--arg", "--lang=zh-CN"]
    }
  }
}
Arg Description
--headless Run browser headless
--proxy URL Proxy server
--user-agent UA Custom User-Agent
--user-data PATH User data dir to reuse login state. ⚠️ Conflicts if your system Chrome is using the same profile
--browser-path PATH Path to a specific browser binary
--incognito Incognito mode
--no-imgs Don't load images. ⚠️ May be ignored by recent Chrome versions — reliable alternative: run_cdp("Network.setBlockedURLs", {"urls": ["*.png", "*.jpg"]})
--arg ARG Pass through any Chrome flag (repeatable)

Options can also be changed mid-session (destructive, restarts the browser) from inside run_drission_code:

return relaunch(headless=True, user_agent="Mozilla/5.0 ...")

Testing

8 scenario suites run against the real MCP stdio protocol (each spawns an independent server + headless browser — itself a multi-instance concurrency test):

uv run python tests/run_all.py            # full regression
uv run python tests/run_all.py --only smoke,c

Covers: data extraction (DOM tree/pagination/iframes), form interaction (DP actions + CDP input sequences), network capture (filters/timing traps/body fidelity), multi-tab pointer consistency, CDP capabilities (screenshots/emulation/cookies), lifecycle (relaunch/kill-recovery), and real-site scenarios (httpbin/TLS).

License

GPL-3.0-only

Release files for chrome-mcp 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chrome-mcp 0.2.0
File Size Uploaded
chrome_mcp-0.2.0.tar.gz 70.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chrome-mcp 0.2.0
File Interpreter ABI Platform
chrome_mcp-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 104.9 kB

Release files / chrome_mcp-0.2.0.tar.gz

Download URL chrome_mcp-0.2.0.tar.gz
Size 70.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ad5724ad40890b487001b071c2ebc621d78d500696b214ff3a09fcdfb36dce3e
BLAKE2b-256 checksum
How to use checksums
a18aaf99c4396fd6bbee05c3a241ff97557a84f74ff0996863a1c7afcd0adb30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / chrome_mcp-0.2.0-py3-none-any.whl

Download URL chrome_mcp-0.2.0-py3-none-any.whl
Size 34.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6faab861ff48297a4ddb697d1c95c2fa0065979d456120e79aa0cfff98c7d900
BLAKE2b-256 checksum
How to use checksums
5652966f861f1cc3a184e1aad98f22f7152cdcd30212d2b6c7a3a394113ce199
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.3.0

2 release files

0.2.1

2 release files

This release

0.2.0 This release

2 release files

0.1.2

2 release files

0.1.1

1 release file

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page