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.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
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: Browser-Debugger
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.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
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
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to control and inspect a live Chrome browser for automated web debugging, performance analysis, and Lighthouse audits. It allows agents to capture screenshots, monitor network requests, and measure Core Web Vitals using plain-English prompts.2,099,626 npmApache 2.0
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to automate and debug real Chromium browsers with capabilities like screenshots, video recording, performance analysis, visual regression testing, and OCR text extraction.13-
- AlicenseAqualityDmaintenanceEnables AI agents to control a browser with 30 tools for navigation, interaction, extraction, and tab management, supporting human-like browser automation.3624 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