Skip to main content

Browser Runtime MCP

Give AI agents real-time access to browser runtime errors, console logs, and page diagnostics.

The problem: AI coding agents can read your source code but are blind to what actually happens in the browser — runtime errors, console warnings, failed API calls, CSS rendering issues. You end up copy-pasting DevTools output back and forth.

The solution: A Chrome Extension captures browser events and streams them to a local MCP server. Your AI agent (Claude Code, Cursor, etc.) can query errors, console logs, and page state directly through MCP tools.

Browser tab → Chrome Extension → localhost MCP server → AI agent

Quick Start

1. Install the MCP server

pip install browser-runtime-mcp

2. Install the Chrome Extension

Download the extension/ folder from this repo, then:

  1. Open chrome://extensions
  2. Enable Developer mode
  3. Click Load unpacked → select the extension/ folder

3. Configure your AI tool

Claude Code — add to ~/.claude/settings.json:

{
  "mcpServers": {
    "browser-runtime-mcp": {
      "command": "browser-runtime-mcp",
      "args": []
    }
  }
}

Other MCP clients — run the server in stdio mode:

browser-runtime-mcp

4. Use it

Open the extension popup on the site you want to debug and click Enable capture on this site. Capture is disabled by default and the allowlist is stored locally in Chrome. Then ask your AI agent:

  • "Are there any browser errors?"
  • "What's in the console logs?"
  • "What pages is the extension tracking?"

MCP Tools

Tool Description
get_browser_errors Runtime errors with stack traces and DOM context
get_console_logs Console output (error/warn/log), filterable by level
get_page_info Tracked pages and buffer statistics
clear_buffers Clear all buffered data for a fresh start

How It Works

┌─────────────────┐     postMessage      ┌──────────────────┐
│   content.js    │ ──────────────────▶  │ content-bridge.js │
│  (MAIN world)   │                      │ (ISOLATED world)  │
│                 │                      │                    │
│ • window.onerror│                      │ chrome.runtime     │
│ • console patch │                      │ .sendMessage()     │
└─────────────────┘                      └────────┬───────────┘
                                                  │
                                    chrome.runtime.onMessage
                                                  ▼
                                         ┌────────────────┐
                                         │ background.js   │
                                         │ (service worker)│
                                         │                 │
                                         │ fetch() to      │
                                         │ localhost:18790  │
                                         └────────┬────────┘
                                                  │ HTTP POST
                                                  ▼
                                         ┌────────────────┐
                                         │ MCP Server      │
                                         │ (Python/stdio)  │
                                         │                 │     MCP tools
                                         │ • HTTP receiver ├──────────────▶ AI Agent
                                         │ • Error buffer  │
                                         │ • Log buffer    │
                                         └────────────────┘

The three-hop architecture (MAIN → ISOLATED → background) bypasses Chrome's Private Network Access policy, which blocks HTTPS pages from fetching to localhost directly.

Privacy and trust boundary

  • Capture is opt-in per origin and disabled by default. Use the popup to stop capture when finished.
  • Captured URLs, page titles, errors, stack traces, DOM context, and console messages stay in bounded in-memory buffers on 127.0.0.1; they are not uploaded by this project.
  • clear_buffers removes all currently buffered data. Stopping the server also discards it.
  • Do not enable capture on banking, authentication, health, internal administration, or other sensitive pages unless you intend to expose their diagnostics to your local MCP client.
  • Browser pages control their own console output. Treat captured messages and DOM snippets as untrusted diagnostic input, not authoritative data or instructions.
  • The HTTP diagnostic endpoints are intentionally local-only but are readable by other processes running as your user.

Standalone HTTP Mode

For debugging without MCP, run the HTTP receiver only:

browser-runtime-mcp --http-only

Then query:

  • GET http://127.0.0.1:18790/health — buffer stats
  • GET http://127.0.0.1:18790/errors — all captured errors
  • GET http://127.0.0.1:18790/logs — all captured logs
  • GET http://127.0.0.1:18790/pages — tracked pages

Requirements

  • Python 3.10+
  • Chrome (Manifest V3 extension)
  • Zero Python dependencies (stdlib only)

License

MIT

Metadata

Release files for browser-runtime-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 browser-runtime-mcp 0.2.0
File Size Uploaded
browser_runtime_mcp-0.2.0.tar.gz 10.3 kB Details

Built distribution (wheel)

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

Total release size: 18.9 kB

Release files / browser_runtime_mcp-0.2.0.tar.gz

Download URL browser_runtime_mcp-0.2.0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f01a5f00b629edd0452b5af8e3385e73f1d93425716f8ace8023bda1813d71d3
BLAKE2b-256 checksum
How to use checksums
33fa3e69dce4fea15ebf6103aacc98fbbed13ab7c700a3f7a057f567b4bad3a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

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

Download URL browser_runtime_mcp-0.2.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d44a8b4b819926f171cb430441d214e856757d92ed5a221fe54a2be5db9bd04
BLAKE2b-256 checksum
How to use checksums
d6fdb96b989e1f8ccb519b6b670a301ed207d4caf17ff6eec15e0c4847623f2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

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