Browser Control MCP Server
Provides CDP-based control of Brave Browser with the same unified toolset for tab management, navigation, page interaction, screenshots, device emulation, network monitoring, and performance tracing.
Provides CDP-based control of Google Chrome, enabling tab and navigation management, JavaScript execution, page content extraction, real mouse and keyboard interaction, form filling, screenshots, PDF generation, device emulation, file uploads, dialog handling, accessibility tree inspection, network and console monitoring, and performance tracing.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Browser Control MCP Server Open example.com and take a full-page screenshot"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Browser Control MCP Server v3.1.0
Unified CDP-based browser control for AI agents via MCP (Model Context Protocol). Works with Chrome, Comet, Edge, Brave, and any Chromium-based browser.
Why CDP?
Previous versions (v1/v2) used AppleScript + JavaScript injection — limited to macOS and unable to access native browser features. This v3.0 upgrade uses the Chrome DevTools Protocol (CDP) directly over WebSocket, providing:
Cross-platform: macOS, Linux, Windows, WSL, Docker
36 tools (up from 11 original / 26 JS-injected)
Real input events: Click, type, drag via the browser engine (not DOM simulation)
Accessibility tree: Full semantic page structure for AI understanding
Network monitoring: Capture requests/responses with body extraction
Performance tracing: CPU profiling and rendering analysis
Device emulation: Mobile viewports, user agents, touch, DPR
File upload: Native file input handling via CDP
PDF generation: Print pages to PDF
Screenshot: Full-page, element, and viewport screenshots
Dialog handling: Alert, confirm, prompt auto-handling
Related MCP server: dev-browser-mcp
Quick Start
1. Install Dependencies
cd /path/to/browser-control-mcp-oss
npm install2. Launch Your Browser with CDP Enabled
macOS (Recommended) — Wrapper Apps:
Pre-built wrapper apps launch your browser with CDP enabled automatically. Just click to open like any normal app:
Wrapper App | Browser | CDP Port | Location |
Google Chrome CDP.app | Chrome | 9222 |
|
Comet CDP.app | Comet | 9223 |
|
These wrappers use your existing browser profile (no --user-data-dir isolation). If the browser is already running, they bring it to the front.
macOS (Manual):
# Chrome
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--remote-debugging-port=9222 \
--user-data-dir=/tmp/chrome-debug
# Comet
/Applications/Comet.app/Contents/MacOS/Comet \
--remote-debugging-port=9223 \
--user-data-dir=/tmp/comet-debug
# Edge
/Applications/Microsoft\ Edge.app/Contents/MacOS/Microsoft\ Edge \
--remote-debugging-port=9222 \
--user-data-dir=/tmp/edge-debug
# Brave
/Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser \
--remote-debugging-port=9222 \
--user-data-dir=/tmp/brave-debugLinux:
# Chrome
google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug
# Edge
microsoft-edge --remote-debugging-port=9222 --user-data-dir=/tmp/edge-debug
# Brave
brave-browser --remote-debugging-port=9222 --user-data-dir=/tmp/brave-debugWindows (PowerShell):
# Chrome
& "C:\Program Files\Google\Chrome\Application\chrome.exe" `
--remote-debugging-port=9222 `
--user-data-dir="$env:TEMP\chrome-debug"
# Edge
& "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" `
--remote-debugging-port=9222 `
--user-data-dir="$env:TEMP\edge-debug"Docker (headless):
docker run -d -p 9222:9222 \
chromedp/headless-shell:latest \
--remote-debugging-address=0.0.0.0 \
--remote-debugging-port=92223. Configure in Claude Code (.claude.json)
{
"mcpServers": {
"chrome-control": {
"type": "stdio",
"command": "node",
"args": [
"/path/to/browser-control-mcp-oss/server/index.js",
"--browser", "chrome"
]
},
"comet-control": {
"type": "stdio",
"command": "node",
"args": [
"/path/to/browser-control-mcp-oss/server/index.js",
"--browser", "comet"
]
}
}
}4. CLI Arguments
Argument | Default | Description |
|
| Browser preset: chrome, comet, edge, brave |
|
| CDP debugging port |
|
| CDP host (use for Docker/remote) |
Tool Reference (36 Tools)
Tab & Navigation (10 tools)
Tool | Description |
| Check CDP connection status, browser version, tab count |
| List all open tabs with IDs, titles, URLs |
| Get the active tab |
| Navigate to a URL (with optional wait-for-load) |
| Open a new tab (optional URL) |
| Close a tab by ID |
| Activate/focus a tab by ID |
| Reload (with optional cache bypass) |
| Navigate back in history |
| Navigate forward in history |
JavaScript & Content (2 tools)
Tool | Description |
| Run JS in page context (returns value, awaits promises) |
| Get page as HTML or extracted text |
Interaction (10 tools)
Tool | Description |
| Real CDP mouse click on element (left/right/double-click) |
| Set input value (React-compatible via native setter) |
| Fill multiple fields at once |
| Type character-by-character via keyboard events |
| Real mouse hover over element |
| Press keyboard keys (Enter, Tab, Escape, arrows, etc.) |
| Select dropdown option by value |
| Scroll page or specific element |
| Drag from source to target element with realistic movement |
| Wait for element, JS condition, or timeout |
Visual & Export (4 tools)
Tool | Description |
| Screenshot: viewport, full-page, or element (PNG/JPEG/WebP) |
| Structured text DOM snapshot (for AI parsing) |
| Generate PDF of current page |
| Set viewport dimensions |
Device & Files (3 tools)
Tool | Description |
| Device emulation: presets (iPhone 14, iPad, Pixel 7, Galaxy S23) or custom viewport/UA/DPR/touch |
| Upload files to |
| Accept/dismiss alert, confirm, prompt dialogs |
Accessibility (1 tool)
Tool | Description |
| Full accessibility tree — semantic roles, names, states. Ideal for AI page understanding |
Monitoring (4 tools)
Tool | Description |
| Get captured console.log/warn/error messages |
| Start network capture; retrieve requests with status, URL, type |
| Get response body for a captured network request |
| Get cookies for current page or specific URLs |
Performance (2 tools)
Tool | Description |
| Start CPU/rendering performance trace |
| Stop trace and get summary with top events by duration |
Device Emulation Presets
Preset | Width | Height | DPR | Mobile |
| 390 | 844 | 3 | Yes |
| 430 | 932 | 3 | Yes |
| 810 | 1080 | 2 | Yes |
| 1024 | 1366 | 2 | Yes |
| 412 | 915 | 2.625 | Yes |
| 360 | 780 | 3 | Yes |
Key Modifier Flags (for press_key)
Modifier | Value |
Alt | 1 |
Ctrl | 2 |
Meta/Cmd | 4 |
Shift | 8 |
Combine with addition: Ctrl+Shift = 2 + 8 = 10
Architecture
Claude Code ──stdio──> MCP Server ──WebSocket──> Browser CDP
(index.js) (port 9222)
│
├── Per-page WS connections (tab control)
└── Browser-level WS (tracing, browser ops)One unified codebase serves Chrome, Comet, Edge, Brave via
--browserflagCDP HTTP API (
/json/list,/json/new,/json/close) for tab managementPer-page WebSocket for page-specific commands (DOM, Input, Runtime)
Browser-level WebSocket for cross-page operations (Tracing, Browser)
Auto-enabled domains: Runtime (console capture) and Page (navigation events) enabled on connection
Network domain: Enabled on demand when
network_requestsis called withstart: true
Error Responses (v3.1+)
Every tool error returns a structured payload so consumer agents can decide retry strategy programmatically — no string parsing required:
{
"error": "CDP connection lost: Inspector detached (reason=target closed)",
"tool": "execute_javascript",
"reason_code": "inspector_detached",
"recoverable": true,
"next_action": "Call list_tabs and retry — the next request will reconnect lazily.",
"cdp_extra": { "cdp_reason": "target closed" }
}Field | Meaning |
| Human-readable message (unchanged from earlier versions) |
| Machine-readable cause — switch on this, not the string |
|
|
| Concrete remediation hint for the failing |
| Optional raw CDP context (e.g. close code, detach reason) |
Transport failures (a Chrome extension attaching via
chrome.debugger.attach, a closed tab, a quit browser) now fail in
< 50 ms instead of hanging for 30 s, and the next tool call
transparently re-establishes the CDP connection (lazy reconnect — no
manual restart needed).
Full reason_code taxonomy and recommended consumer-agent retry logic:
docs/RESILIENCE.md. Release notes:
CHANGELOG.md.
Troubleshooting
"ECONNREFUSED" Error
The browser is not running with CDP enabled. Launch it with --remote-debugging-port=9222.
"Page not found" Error
The target tab may have been closed. Call list_tabs to get current tab IDs.
Port Already in Use
Another browser instance is using port 9222. Either close it or use a different port:
node server/index.js --browser chrome --port 9223Using with Existing Browser Profile
By default, --user-data-dir creates a separate profile. To use your existing profile, omit the flag — but note that only one Chrome instance can run at a time with CDP.
Remote/Docker CDP
For remote browsers or Docker containers, use the --host argument:
node server/index.js --browser chrome --host 192.168.1.100 --port 9222Claude Code Skills (Powered by This Server)
A Claude Code skill consumes this CDP server for intelligent browser workflows:
Skill | Version | Purpose | Command |
cdp-dev-companion | v1.0.0 | Active development: verify code changes, test user flows, explore apps, delegate to AI assistants, iterate autonomously |
|
Skills are defined in ~/.claude/commands/ and invoked as slash commands in Claude Code sessions.
Multi-Browser Strategy
Browser | Recommended Port | Primary Use |
Chrome | 9222 | Dev server testing (localhost), visual verification, production site testing |
Comet | 9223 | AI assistant delegation, multi-AI orchestration, side-by-side research |
Both browsers use this same unified server. The MCP tool prefix determines targeting:
mcp__chrome-control__<tool>— Chromemcp__comet-control__<tool>— Comet
Version History
Version | Date | Changes |
1.0 | 2024 | Original AppleScript-based, 11 tools, macOS only |
2.0 | 2026-03-16 | JS injection enhancement, 26 tools, macOS only |
3.0 | 2026-03-17 | Full CDP rewrite, 36 tools, cross-platform |
3.0.1 | 2026-03-18 | Documentation: added wrapper apps, skills reference, multi-browser strategy |
3.1.0 | 2026-05-14 | Resilience layer: handle WebSocket close/error + |
Requirements
Node.js: 18.0+ (uses
node:httpbuilt-in)Browser: Any Chromium-based browser with
--remote-debugging-portflagDependencies:
ws(WebSocket client),@modelcontextprotocol/sdk
License
MIT. See LICENSE.
Built by LostMind AI.
Available Tools
36 toolsclickC
Click an element using real CDP mouse events (works with any framework)
Inputs: selector (required), tabId, button, clickCount.
close_tabB
Close a tab in Google Chrome
Inputs: tabId (required).
console_messagesC
Get captured console messages from the page
Inputs: clear, tabId.
dragC
Drag from one element/position to another
Inputs: sourceSelector (required), targetSelector (required), tabId.
emulateB
Emulate a mobile device or custom viewport (user agent, dimensions, touch, DPR)
Inputs: tabId, width, device, height, +3 more.
execute_javascriptC
Execute JavaScript in the page context
Inputs: code (required), tabId.
fillA
Fill an input field with text (clears existing value, React-compatible)
Inputs: value (required), selector (required), tabId.
fill_formB
Fill multiple form fields at once
Inputs: fields (required), tabId.
get_accessibility_treeB
Get the full accessibility tree of the page (ideal for AI understanding of page structure)
Inputs: tabId.
get_cookiesB
Get cookies for the current page or a specific URL
Inputs: urls, tabId.
get_current_tabB
Get the active tab in Google Chrome
Inputs: no named parameters.
get_page_contentC
Get the HTML content or text of the current page
Inputs: tabId, format.
get_response_bodyC
Get the response body of a captured network request
Inputs: requestId (required), tabId.
go_backC
Navigate back in browser history
Inputs: tabId.
go_forwardC
Navigate forward in browser history
Inputs: tabId.
handle_dialogC
Handle a JavaScript dialog (alert, confirm, prompt)
Inputs: accept (required), tabId, promptText.
health_checkA
Check if Google Chrome is running with CDP and accessible
Inputs: no named parameters.
hoverB
Hover over an element using real mouse movement
Inputs: selector (required), tabId.
list_tabsB
List all open tabs in Google Chrome
Inputs: no named parameters.
network_requestsB
Get captured network requests (must call once to start capturing)
Inputs: clear, start, tabId.
new_tabC
Open a new tab in Google Chrome
Inputs: url.
open_urlB
Navigate a tab to a URL in Google Chrome
Inputs: url (required), tabId, waitForLoad.
performance_start_traceC
Start a performance trace (CPU profiling, rendering, etc.)
Inputs: categories.
performance_stop_traceB
Stop performance trace and return results
Inputs: no named parameters.
press_keyC
Press a keyboard key (Enter, Tab, Escape, ArrowDown, etc.)
Inputs: key (required), tabId, modifiers.
print_to_pdfC
Generate a PDF of the current page
Inputs: tabId, landscape, printBackground.
reload_tabB
Reload the current or specified tab
Inputs: tabId, ignoreCache.
resize_windowC
Resize the browser viewport
Inputs: width (required), height (required), tabId.
scrollC
Scroll the page or a specific element
Inputs: y (required), x, tabId, selector.
select_optionC
Select an option in a dropdown
Inputs: value (required), selector (required), tabId.
switch_to_tabB
Activate/focus a tab in Google Chrome
Inputs: tabId (required).
take_screenshotC
Capture a screenshot of the page (returns base64 PNG)
Inputs: tabId, format, quality, fullPage, +1 more.
take_snapshotB
Get a structured text snapshot of the page DOM (useful for AI understanding)
Inputs: tabId.
type_textB
Type text character-by-character using real keyboard events (triggers all JS handlers)
Inputs: text (required), tabId, selector.
upload_fileC
Upload file(s) to a file input element
Inputs: files (required), selector (required), tabId.
wait_forB
Wait for an element to appear, a condition, or a timeout
Inputs: tabId, timeout, selector, condition.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 36 tools
Most tools have clearly distinct purposes (navigation, tab management, input, capture, network inspection), and the verb-based names make selection straightforward. The main overlap is between get_accessibility_tree, take_snapshot, and get_page_content, which all return some form of page representation and could be confused by an agent choosing 'how to read the page'.
The set is overwhelmingly snake_case with verb_noun structure (open_url, close_tab, switch_to_tab, take_screenshot, handle_dialog). A handful of deviations exist — bare imperatives like click, fill, hover, drag, scroll, emulate, and noun-only names like console_messages, network_requests, and health_check — but they remain readable and predictable within their groups.
36 tools is heavy for a single server and pushes past the comfortable range, with some redundancy in the page-reading subset. However, browser automation genuinely spans navigation, tabs, input primitives, capture, network, console, emulation, and performance, so most tools do map to a real capability rather than bloat.
The surface covers the full browser lifecycle well: navigation back/forward, tab CRUD, interaction (click, fill, type, drag, scroll, keys, select), captures, dialogs, uploads, cookies, console, network, emulation, and performance tracing. Gaps remain around cookie mutation (only get_cookies, no set/delete/clear) and frame/iframe handling, which agents will hit on login and embedded-content scenarios.
Maintenance
Related MCP Connectors
Cloud browser, web extraction, screenshots, and remote CDP tools for AI agents.
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Give AI agents a real cloud Chrome: open sessions, navigate, read pages, click, type and screenshot.
Cloud browsers for AI agents: saved logins, residential IPs, live human takeover, 57 browser tools.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI agents to control a browser with 30 tools for navigation, interaction, extraction, and tab management, supporting human-like browser automation.368 npmMIT
- AlicenseAqualityDmaintenanceEnables AI agents to control a persistent Chromium browser or attach to an existing Chrome with sandboxed JavaScript and structured tools for web interaction and automation.16MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to control, read, and verify a live Chrome browser through 46 schema-validated MCP tools, including DOM pruning, coordinate-aware interaction, and trusted CDP input events.41AGPL 3.0
- AlicenseBqualityBmaintenanceEnables AI agents and developers to automate real Chrome/Chromium browsers through the Chrome DevTools Protocol, with token-efficient snapshots, multi-action batching, shadow DOM traversal, system-page control, extension management, and network/WebSocket inspection.951MIT