Skip to main content

MCP server that gives AI agents real-time access to browser runtime errors, console logs, and page diagnostics via a Chrome Extension.

Project description

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

Browse any website. 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.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

browser_runtime_mcp-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

browser_runtime_mcp-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file browser_runtime_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: browser_runtime_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for browser_runtime_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9c874279f6012b291b91e436183070870ebd21968e8495adb18a74910a9cf447
MD5 8f0a67daf2788782d2b5957ef0464340
BLAKE2b-256 fb811ccf1f478ee7f043fff761379517001064c2a44ae4f57acb00804e4eecf6

See more details on using hashes here.

File details

Details for the file browser_runtime_mcp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for browser_runtime_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d2c2b005abe77e75ca5457ca73ca1afb7379d7c1e5445b8935c3209802bfb8d
MD5 fe8e010bc46d036723892c9bab9c12eb
BLAKE2b-256 725d7b9dacd66d53aa5bd3d057835030f46890810dd432874dadcc8a9e326c84

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page