Skip to main content
Glama
README.md
# chrome-mcp-hub

[![CI](https://github.com/saman-taghavi/chrome-mcp-hub/actions/workflows/ci.yml/badge.svg)](https://github.com/saman-taghavi/chrome-mcp-hub/actions/workflows/ci.yml)
[![npm version](https://img.shields.io/npm/v/chrome-mcp-hub.svg)](https://www.npmjs.com/package/chrome-mcp-hub)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
[![Docs](https://img.shields.io/badge/Docs-GitHub%20Pages-34d399)](https://saman-taghavi.github.io/chrome-mcp-hub/)

A zero-dependency, persistent **multi-agent Streamable HTTP & stdio MCP hub** for [`chrome-devtools-mcp`](https://github.com/ChromeDevTools/chrome-devtools-mcp) (`--autoConnect`) with a live frosted-glass control dashboard.

**Live Docs:** [saman-taghavi.github.io/chrome-mcp-hub](https://saman-taghavi.github.io/chrome-mcp-hub/)

Approve Chrome's *"Allow remote debugging?"* dialog **once**, and share that live browser session safely across **Claude Code, Antigravity, Cursor, Windsurf, and multiple concurrent subagents** — without repeat popups on every restart.

## Why

`chrome-devtools-mcp --autoConnect` runs over stdio, so every time an AI agent starts or restarts, it spawns a new process and triggers Chrome's remote debugging approval dialog again. When multiple agents run in parallel, they also compete over Chrome's shared active tab.

`chrome-mcp-hub` solves both:
- **One persistent child process** — keeps a single approved `chrome-devtools-mcp --autoConnect` connection alive across agent restarts.
- **Multi-agent safe** — tracks each agent's own `selectedPageId` per `Mcp-Session-Id` and serializes `tools/call` through a FIFO async queue so concurrent agents never hijack each other's active tab.
- **Live Glass Dashboard (`http://127.0.0.1:9333/`)** — real-time SSE feed of connected agents, recent tool calls, open tabs, debug logs, global **Pause / Resume** kill-switch, **Read-Only** mode, **per-agent Mute / Drop**, and **Protected Domains** blocklist.
- **Zero runtime dependencies** — pure Node.js 20+ built-ins (`http`, `child_process`, `readline`, `fs`, `crypto`).

## Quick Start

### Option 1 — One-line AI Agent Setup (fastest)
Paste this single line into **Claude Code, Antigravity, Cursor, OpenCode, Codex, Gemini CLI, or Pi**:

```text
Read https://saman-taghavi.github.io/chrome-mcp-hub/llms.txt and set up chrome-mcp-hub for all my coding agents.
```

### Option 2 — One-command Terminal Setup
1. In Chrome (144+), open `chrome://inspect/#remote-debugging` and toggle **Allow remote debugging** ON.
2. Auto-wire all detected harnesses and start the hub:
   ```bash
   npx -y chrome-mcp-hub install && npx -y chrome-mcp-hub
   ```
   Useful commands:
   ```bash
   npx -y chrome-mcp-hub install --dry-run   # preview detected configs
   npx -y chrome-mcp-hub status              # check live daemon health & sessions in terminal
   ```
   Options:
   - `--port <port>` (default `9333`, or `CHROME_MCP_PORT`)
   - `--channel <stable|canary|dev|beta>` (default `stable`)
   - `--read-only` (start with mutating browser actions blocked; persisted to `~/.config/chrome-mcp-hub/config.json`)
   - `--debug` (verbose structured logs, or `CHROME_MCP_DEBUG=1`)
   - `--log-file <path>` (append NDJSON logs to disk)
3. Open **http://127.0.0.1:9333/** for the live dashboard.
4. Point your AI clients to `http://127.0.0.1:9333/mcp` (pass `?client=<name>` for clear labels in the dashboard):

### Claude Code (`~/.claude.json`)
```json
{
  "mcpServers": {
    "chrome-devtools": {
      "type": "http",
      "url": "http://127.0.0.1:9333/mcp?client=claude-code"
    }
  }
}
```

### Antigravity (`~/.gemini/config/mcp_config.json`)
```json
{
  "mcpServers": {
    "chrome-devtools": {
      "url": "http://127.0.0.1:9333/mcp?client=antigravity"
    }
  }
}
```

### OpenCode (`opencode.json`)
```json
{
  "mcp": {
    "chrome-devtools": {
      "type": "remote",
      "url": "http://127.0.0.1:9333/mcp?client=opencode"
    }
  }
}
```

### Codex CLI (`~/.codex/config.toml`)
```toml
[mcp_servers.chrome-devtools]
url = "http://127.0.0.1:9333/mcp?client=codex"
```

### Cursor / Windsurf / Gemini CLI
```json
{
  "mcpServers": {
    "chrome-devtools": {
      "url": "http://127.0.0.1:9333/mcp?client=cursor"
    }
  }
}
```
*(Windsurf uses `"serverUrl"`; Gemini CLI uses `"httpUrl"`.)*

### Pi / OMP (`oh-my-pi`) / Zed / Cline / any stdio-only harness
Use the built-in `--stdio` bridge mode so stdio-only harnesses share the exact same live Chrome session:
```json
{
  "mcpServers": {
    "chrome-devtools": {
      "command": "npx",
      "args": ["-y", "chrome-mcp-hub", "--stdio", "--client=pi"]
    }
  }
}
```

## Security Model

`chrome-mcp-hub` **never bypasses** Chrome's security controls — you still enable `chrome://inspect/#remote-debugging` and approve Chrome's prompt once, and disabling it in Chrome revokes access immediately.

Built-in guards:
- **Loopback-only binding** (`127.0.0.1` — never exposed to LAN or the internet).
- **Strict CSRF protection**: `/mcp` rejects **any** request carrying a browser `Origin` header (`403`).
- **DNS-rebinding protection**: rejects any `Host` header other than `127.0.0.1:<port>` or `localhost:<port>` (`403`).
- **Dashboard API isolation**: `/api/*` requires same-origin localhost + `X-Dashboard-Action: 1`.
- **Protected Domains**: block sensitive domains (email, banking, password managers) from all agent tool calls.
- **Redacted logging**: form input values (`fill`, `fill_form`, `type_text`) are never written to call history or debug logs.

## Development & Tests

```bash
npm test
```

Runs the full security, CSRF, DNS-rebinding, read-only, pause/mute, protected-domain, and 3-agent concurrent isolation suite using a mock stdio MCP server (no Chrome required in CI).

## Author & License

Created by [Saman Taghavi Sani (@saman-taghavi)](https://github.com/saman-taghavi).

Licensed under the [MIT License](./LICENSE) — free to use, modify, and distribute with attribution.