chrome-devtools-mcp icon indicating copy to clipboard operation
chrome-devtools-mcp copied to clipboard

Support http transport

Open natorion opened this issue 5 months ago • 3 comments

Is your feature request related to a problem? Please describe.

Umbrella FR to track value and feasability of dedicated per-machine server with http transport.

Relevant issues: https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/2154 https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/1985 https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/1232 https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/316

Describe the solution you'd like

n/a

Describe alternatives you've considered

proxy servers

Additional context

No response

natorion avatar Jun 08 '26 13:06 natorion

Adding a concrete use case from production for the umbrella:

I run chrome-devtools-mcp against a long-lived Chrome on a dedicated VM (Linux, headed XFCE session, CDP on 127.0.0.1:9222), with multiple Claude Code clients on a separate VM that all want to drive the same browser. Today the only path is per-client ssh <vm> chrome-devtools-mcp --browserUrl http://127.0.0.1:9222 — one MCP process per Claude session, stdio over SSH.

Two failure modes this produces:

  1. Per-session orphan leak. When a Claude session ends abnormally (autoheal kill, context-limit, OOM-killed claude.exe), the SSH client reparents to PID 1 but sshd doesn't notice the dead TCP peer for hours (default ClientAliveInterval=0), so the remote chrome-devtools-mcp Node process keeps running. Each holds ~100MB–1.7GB RSS. Over 4 days I accumulated 62 stale procs (5.4 GiB) on an 8 GB VM, which then OOM-killed Chrome itself. Mitigated with ClientAliveInterval=60 + a code-side orphan reaper, but the structural cure would be a single long-lived MCP server.

  2. Tools/list registration race. Short claude --print runs occasionally settle before the SSH+Node cold-start finishes, so mcp__chrome-vm-cdp__* tools never register even though claude mcp list shows ✓ Connected. Mitigated by installing the binary globally (skipping npx -y …@latest resolution), but cold-start is still ~1.5 s — a long-lived daemon would have no cold-start at all.

Both go away with a dedicated long-lived server. @playwright/mcp already supports this with --host <ip> --port <port> --allowed-hosts <list> (binds an HTTP/SSE server; clients connect with --transport http <url>/mcp). I have that side running as a launchd daemon on a Mac mini today with a code-side SSH-forwarded port and the same shape would work cleanly for chrome-devtools-mcp — bind loopback (CDP is RCE-equivalent so must not be LAN-reachable), enforce Host-header allowlist, expose /mcp for streamable-HTTP clients, plus /sse for legacy SSE.

Happy to test a PR / preview build if it'd help. The "no per-machine server, only per-client stdio" assumption breaks down at multi-client scale.

Austin519 avatar Jun 20 '26 03:06 Austin519

@Austin519 I’m the author of ReadyRig, which exposes Chrome DevTools MCP through a shared HTTP service. I had this pattern tested against v0.6.8 on macOS: two protocol clients and 12 new sessions reused one MCP process, with browser navigation, snapshots and clicks working.

One important caveat from that test: disconnecting during an active request restarted the shared subprocess and briefly disrupted the other client. Browser tools were also absent during cold startup, and there’s no legacy SSE endpoint or gateway Host allowlist.

This was a short local test, not a reproduction of your Linux/SSH setup or four-day process buildup. Claude Code reported the endpoint as connected, but authenticated tool use wasn’t tested. It may be an experimental option for the shared-daemon part of your request; I can’t claim it fixes your disconnect/OOM case yet.

jo32 avatar Oct 02 '26 04:10 jo32

An update on the implementation we are maintaining in lmn451/chrome-devtools-mcp, and its scope relative to this request.

We proposed it upstream in #2733, which was closed because this feature request was not yet confirmed and the change was too large for a single PR. The shared-server implementation was subsequently merged into our fork's main through PR #3. We are keeping the fork synchronized with upstream while this capability remains fork-only; we are not assuming that HTTP support has been permanently rejected.

Why we are doing this

The target is multiple trusted MCP clients driving one long-lived Chrome through one service. Starting a separate Chrome-connected MCP backend for every conversation duplicates browser connections and server state, adds backend cold starts, and creates more processes to supervise. A generic HTTP wrapper also does not by itself give each client independent selected-page, roots, and tool-execution state.

This is closely related to @Austin519's shared-browser deployment described above. The intent is to address that architectural problem, not to claim we have reproduced or eliminated every failure in that specific Linux/SSH deployment.

What the implementation handles

  • Native Streamable HTTP: --http-port exposes /mcp. One service owns one shared BrowserManager/Chrome connection and page inventory.
  • Per-client MCP state: each HTTP session gets its own McpServer, McpContext, and transport, with separately scoped selected-page, roots, tracing/recording state, resource-loading context, and request mutex.
  • Stdio clients: --server-url or CHROME_DEVTOOLS_MCP_SERVER_URL runs a stdio-to-HTTP proxy. There can still be a small proxy process per stdio client, but it does not create another Chrome-connected backend. Existing standalone stdio mode remains available.
  • Session lifecycle: explicit session termination, idle-session expiry, bounded session/request resources, and cleanup of session-owned traces, recordings, and isolated browser contexts. Closing a session does not close the shared browser connection; the stdio proxy terminates its remote session when the client exits normally.
  • Local deployment guardrails: bind to 127.0.0.1, reject non-loopback Host/Origin, and cap request bodies. Remote access is documented through SSH port forwarding.

What it does not handle or guarantee

  • Not an internet-facing or untrusted multi-tenant service. There is no built-in authentication/authorization or TLS termination. Loopback checks are not a substitute for an authenticated remote-service design.
  • Not automatic browser/profile isolation. Chrome and the page inventory are shared. Per-client MCP state does not isolate cookies or storage by itself; named isolated browser contexts must be used when that separation is needed.
  • Not a global browser lock or automatic exclusive tab ownership. Requests are serialized per client, not across all clients. Clients targeting the same page or browser-global operations can still interfere.
  • Not a browser fleet or one Chrome process per client. That was the narrower approach in #2730; the current design deliberately shares Chrome.
  • Not a separate legacy /sse endpoint. This implements Streamable HTTP, which can itself use SSE responses.
  • Not a replacement for process supervision or a guarantee against every orphan/OOM case. Service-side session cleanup does not eliminate every client-side proxy/SSH process or cover arbitrary crashes. We are not presenting it as a reproduction of the four-day failure report above.

Implementation and deployment details are in the fork's advanced-usage guide.

I see that this umbrella is now assigned to @wolfib. We would like to coordinate on whether the one-service/shared-Chrome/per-client-MCP-session model fits the upstream direction, agree on the required session and security contract, and then identify smaller reviewable changes rather than resubmit the same large PR unchanged. Until an equivalent upstream capability is available, we are maintaining this scoped extension in the fork.

lmn451 avatar Oct 13 '26 17:10 lmn451