browser-debug-mcp-bridge
v1.10.0
Published
Chrome Extension + Node.js MCP server for browser debugging
Downloads
48
Maintainers
Readme
Browser Debug MCP Bridge
Chrome Extension + local Node.js MCP runtime for real-browser debugging.
It captures telemetry from an actual browser session (console, network, navigation, UI events), stores it locally, and exposes debugging tools through MCP to your AI client.
What You Can Do
- Inspect real sessions instead of synthetic test runs
- Query recent errors, failed requests, and event timelines
- Run targeted live capture (DOM subtree/document, styles, layout)
- Pull live in-memory console logs with server-side filters (
url,tabId,levels,contains) - Query targeted API calls with optional sanitized request/response bodies
- Wait deterministically for the next matching API request during repro flows
- Correlate user actions with network/runtime failures
- Keep privacy controls enabled (safe mode, allowlist, redaction)
How It Works
- Chrome extension captures session telemetry.
- Local server ingests via HTTP/WebSocket on
127.0.0.1:8065. - Data is persisted in local SQLite.
- MCP stdio server exposes tools to your AI client.
Requirements
- Node.js
>=20 - npm (for no-repo quick mode)
- pnpm
>=9(for local repo mode) - Chrome (Developer Mode to load unpacked extension)
Setup Modes
Recommended for Most Users: No-Repo Quick Setup
Use this when you want to install and run quickly without cloning this repository.
- Install runtime globally:
npm i -g browser-debug-mcp-bridge- Download the latest extension asset
chrome-extension-dist.tgzfrom:
https://github.com/RobertoM80/browser-debug-mcp-bridge/releases/latest
Extract the archive and load extension in Chrome:
Open
chrome://extensionsEnable Developer mode
Click Load unpacked
Select the extracted extension folder
Configure MCP host with direct Node launch (recommended):
Find npm global root:
npm root -gUse script path:
<NPM_GLOBAL_ROOT>/browser-debug-mcp-bridge/scripts/mcp-start.cjsAlternative quick runtime (secondary):
npx -y browser-debug-mcp-bridgeLocal Repo Setup (Contributors/Customization)
Use this when you need local development, customization, or source-level debugging.
git clone https://github.com/RobertoM80/browser-debug-mcp-bridge.git
cd browser-debug-mcp-bridge
pnpm install
pnpm nx build mcp-server
pnpm nx build chrome-extensionLoad extension:
- Open
chrome://extensions - Enable Developer mode
- Click Load unpacked
- Select
dist/apps/chrome-extension
Start MCP runtime:
node scripts/mcp-start.cjsMCP Client Configuration
If you are using local repo mode, generate ready-to-paste snippets:
pnpm mcp:print-configOpenAI (Codex CLI / Codex in VS Code)
Best-practice launch path: use direct node launch to the installed script path.
Edit ~/.codex/config.toml (Windows: C:\Users\<you>\.codex\config.toml) and add:
[mcp_servers.browser_debug]
command = "node"
args = ["C:\\Users\\<you>\\AppData\\Roaming\\npm\\node_modules\\browser-debug-mcp-bridge\\scripts\\mcp-start.cjs"]local repo mode alternative:
[mcp_servers.browser_debug]
command = "node"
args = ["C:\\ABSOLUTE\\PATH\\TO\\browser-debug-mcp-bridge\\scripts\\mcp-start.cjs"]npm quick mode (secondary):
[mcp_servers.browser_debug]
command = "npx"
args = ["-y", "browser-debug-mcp-bridge"]OpenCode
Use JSON MCP config:
{
"mcpServers": {
"browser-debug": {
"command": "node",
"args": [
"C:\\Users\\<you>\\AppData\\Roaming\\npm\\node_modules\\browser-debug-mcp-bridge\\scripts\\mcp-start.cjs"
]
}
}
}VS Code (any MCP host expecting command/args)
Use the same values:
command:nodeargs:[ "<NPM_GLOBAL_ROOT>/browser-debug-mcp-bridge/scripts/mcp-start.cjs" ]
If your VS Code MCP host uses JSON, reuse the OpenCode JSON block above.
First End-to-End Check
- Start MCP host/client (so it launches this server).
- Open extension popup, allowlist domain, start a session.
- Ask your AI client to run:
{ "name": "list_sessions", "arguments": { "sinceMinutes": 60 } }- Pick a session where
liveConnection.connectedistrue. - Run query tools first (
get_session_summary,get_recent_events,get_network_failures). - Use live tools (
get_dom_document,capture_ui_snapshot,get_live_console_logs) only on connected sessions.
Session Scope and URL Filtering
- Sessions start bound to the active tab only.
- Telemetry from unbound tabs is rejected to avoid cross-tab contamination.
- Use the popup
Session Tabspanel to explicitly add/remove tabs from the active session. - If all bound tabs are removed/closed, the session auto-stops.
MCP query tools support sessionId, url, or both:
sessionIdonly: filter by sessionurlonly: filter by URL origin across sessions (for examplehttp://localhost:3000)sessionId + url: intersection (only rows matching both)
Supported tools:
get_recent_eventsget_navigation_historyget_console_eventsget_network_failuresget_network_calls
Example: URL-only query
{
"name": "get_recent_events",
"arguments": { "url": "http://localhost:3000", "limit": 50 }
}Example: session + URL intersection
{
"name": "get_network_failures",
"arguments": { "sessionId": "sess_123", "url": "http://localhost:3000", "limit": 20 }
}Live Console Logs (Non-Persistent)
get_live_console_logs reads from extension in-memory ring buffers (session-scoped), so this live stream can be filtered without DB scanning.
sessionIdis required- optional filters:
url(origin),tabId,levels,contains,sinceTs - supports substring filters like
"[auth]"directly server-side - results are bounded by
limitand buffer capacity
Capture scope:
- Captured from page context:
console.log,console.info,console.warn,console.error,console.debug,console.trace - Runtime JS exceptions are included as
error-level live entries - Browser-internal/DevTools UI-only rows are not guaranteed
Example:
{
"name": "get_live_console_logs",
"arguments": {
"sessionId": "sess_123",
"url": "http://localhost:3000",
"levels": ["info", "error"],
"contains": "[auth]",
"limit": 100
}
}Port and Startup Behavior
Default port is 8065.
- Launcher enforces a single-instance startup lock to avoid concurrent launch races.
- On Windows, launcher tries automatic stale bridge recovery first.
- If port is still occupied, startup fails with
MCP_STARTUP_PORT_IN_USE. - In that case, free/reserve port
8065for this bridge and restart. - Launcher reports
Startedonly after/healthbecomes reachable on127.0.0.1:8065. - In
mcp-stdiomode, bridge lifecycle is tied to the host and should stop when host transport closes. - If a stale process still remains, stop it explicitly with
node scripts/mcp-start.cjs --stop. - Optional: set
MCP_STARTUP_TIMEOUT_MS(default15000) for slower machines.
Runtime Storage
By default, the launcher and server store local runtime state in a user-local app-data directory, not in the repo or package root.
- Windows:
%LOCALAPPDATA%\\browser-debug-mcp-bridge - macOS:
~/Library/Application Support/browser-debug-mcp-bridge - Linux:
$XDG_STATE_HOME/browser-debug-mcp-bridgeor$XDG_DATA_HOME/browser-debug-mcp-bridge - Fallback:
~/.local/share/browser-debug-mcp-bridge
This keeps SQLite data, snapshot assets, exports, and launcher lock files out of host app roots. To override it explicitly, set DATA_DIR.
Useful Windows command:
netstat -ano | findstr :8065Stop command:
node scripts/mcp-start.cjs --stopCommon Failure Signals
LIVE_SESSION_DISCONNECTED: session exists in DB but no active extension transport. Fix: restart/reconnect extension session, then use aliveConnection.connected = truesession id.MCP_STARTUP_PORT_IN_USE: required MCP port is blocked. Fix: stop the process using that port and restart bridge.
Useful Commands
pnpm typecheck
pnpm lint
pnpm test
pnpm test:e2e
pnpm test:e2e:head
pnpm test:e2e:smoke
pnpm test:e2e:full
pnpm build
pnpm docs:ci
pnpm verify
node scripts/mcp-start.cjs --stopE2E commands run headless by default. Use pnpm test:e2e:head only for local headed debugging.
CI lanes:
- Pull requests and pushes to
main:verify+ Playwright smoke + Playwright full. - Nightly:
verify+ Playwright full + runtime/healthsmoke check.
Optional one-shot local setup:
# Windows
./install.ps1# macOS/Linux
bash ./install.shTooling Docs
Repository Layout
apps/
mcp-server/ Fastify + WebSocket ingest + MCP server
chrome-extension/ MV3 extension (background/content/injected)
viewer/ Optional UI
libs/
shared/ Shared schemas/types/utils
redaction/ Privacy redaction engine
selectors/ Selector generation
mcp-contracts/ MCP tool contracts and schemas