Skip to content

feat: support shared MCP server sessions - #2733

Closed
lmn451 wants to merge 2 commits into
ChromeDevTools:mainfrom
lmn451:feat/multi-client-shared-chrome
Closed

lmn451 wants to merge 2 commits into
ChromeDevTools:mainfrom
lmn451:feat/multi-client-shared-chrome

Conversation

@lmn451

@lmn451 lmn451 commented Sep 12, 2026 •

Copy link
Copy Markdown

Why

Addresses #2188. Multiple MCP clients need to drive one long-lived Chrome without spawning one Chrome-connected server per client, leaking orphaned processes, contending for profiles, or sharing selected-page and filesystem state.

What changed

  • add a loopback-only Streamable HTTP endpoint at http://127.0.0.1:<port>/mcp via --http-port
  • create an independent McpServer and McpContext for every HTTP session while sharing one process-level Chrome connection and page inventory
  • isolate selected pages, roots, named isolated contexts, DevTools resource loading, tracing/recording state, telemetry attribution, and per-client request mutexes
  • add --server-url / CHROME_DEVTOOLS_MCP_SERVER_URL as a transparent stdio-to-HTTP proxy for stdio-only clients
  • preserve existing stdio mode when neither option is supplied
  • support server-launched headed/headless Chrome, --auto-connect, and explicit remote-debugging --browser-url / --ws-endpoint modes

Lifecycle and security

  • bind only to 127.0.0.1; reject non-loopback Host and Origin
  • cap request bodies at 4 MiB and bound pending/established sessions
  • close only the addressed session on accepted DELETE; inactive sessions expire after 30 minutes while active requests/streams suspend expiry
  • drain active tools and stop session-owned traces, screencasts, and owned isolated browser contexts before disposal
  • document SSH port forwarding as the only remote-access path

Verification

  • npm run format
  • focused shared HTTP/proxy/browser/context/telemetry run: 169 passed
  • npm run test tests/http-server.test.ts tests/proxy.test.ts tests/http-multi-client.test.ts: 10 passed
  • npm run test -- --retry: final attempt 1,036 passed, 3 platform skips; earlier attempts hit existing extension teardown/network ordering flakes
  • live smoke: two named chrome-devtools-axi sessions opened separate tabs through one service, saw the same page inventory, and retained different selected pages

Companion

AXI upstream: kunchenguid/chrome-devtools-axi#139

Fork review PRs: lmn451#3 and lmn451/chrome-devtools-axi#1

Supersedes the narrower per-session-browser approach in #2730.

@artgas1

artgas1 commented Sep 15, 2026

Copy link
Copy Markdown

INFRA-1236 review checkpoint: I ran the repository-required generators and gates against 657b388. The implementation and focused/full tests pass, but the branch is missing two generated updates: npm run gen adds http_port_present and server_url_present to src/telemetry/flag_usage_metrics.json, and npm run test:notices fails until the bundled dependency notice snapshot adds content-type, eventsource-parser, and @hono/node-server. I reproduced and committed only those generated outputs here: artgas1@ef7c982 . After that commit: npm run gen is idempotent, npm run check-format passes, full npm test passes, npm run test:notices passes, and all five memory profiles remain below the 1% threshold (max 0.50%). Please cherry-pick ef7c982 or regenerate both files.

artgas1 added a commit to artgas1/chrome-devtools-mcp that referenced this pull request Sep 15, 2026
Adopt the canonical shared Streamable HTTP server implementation from upstream PR ChromeDevTools#2733, including direct AXI HTTP transport, generated metadata, notices, and awaited async test teardown.
@samiyac

samiyac commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Closing as the attached feature request #2188 is not yet confirmed. Also the changes required to address the FR are too large to be part of a single PR

@samiyac samiyac closed this Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants