Repository navigation
feat(chrome-devtools): route autoConnect through OpenClaw extension relay - #250
Conversation
…elay When the OpenClaw Chrome-extension relay is paired and live on this host, rewrite chrome-devtools-mcp --autoConnect to --wsEndpoint/--wsHeaders against the relay's loopback CDP endpoint. Same signed-in Chrome, but no per-session "Allow remote debugging?" dialog (Chrome M144+). Best-effort: missing secret, dead relay, or unpaired extension falls back to plain autoConnect. Opt out with MCPORTER_DISABLE_CHROME_DEVTOOLS_RELAY=1; override the loopback relay URL with MCPORTER_CHROME_DEVTOOLS_RELAY_URL. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Codex review: found issues before merge. Reviewed August 2, 2026, 4:39 AM ET / 08:39 UTC. ClawSweeper reviewWhat this changesThis PR adds a best-effort stdio-launch rewrite that sends Merge readiness⛔ Blocked by patch quality or review findings - 8 items remain Keep this PR open for maintainer review: its local relay probe establishes only liveness and pairing, while the PR itself says a companion OpenClaw change is needed for a required CDP method. Without a capability or version gate, an existing paired relay can replace working Priority: P2 Review scores
Verification
How this fits togetherMCPorter turns configured MCP server definitions into stdio child processes and connects an MCP client to them. This change intercepts Chrome DevTools MCP launch arguments, probes a local OpenClaw relay, and either supplies relay CDP credentials or preserves the existing Chrome auto-connect path. flowchart LR
A[MCP server definition] --> B[Stdio launch preparation]
B --> C[Chrome DevTools command detection]
C --> D[Local relay token and liveness probe]
D -->|paired relay detected| E[Relay CDP launch arguments]
D -->|unavailable or unpaired| F[Existing auto-connect arguments]
E --> G[chrome-devtools-mcp process]
F --> G
G --> H[MCP client connection]
Decision needed
Why: The feature changes the default launch route for existing Chrome DevTools users and depends on a separately evolving OpenClaw relay protocol; source inspection cannot choose the permanent compatibility contract. Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Require an explicit relay capability or supported-version contract before rewriting launch arguments, with a narrow fallback for unsupported relays, and leave the release-note entry to the release owner. Do we have a high-confidence way to reproduce the issue? Yes for the proposed patch: use a paired relay that returns 200 from Is this the best way to solve the issue? No. A 200 liveness response is not enough to replace an established launch path when the PR identifies a required companion protocol change; capability/version gating or a controlled fallback is safer. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e056f77bd2bf. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 15d679c6f4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } | ||
| const wsEndpoint = `ws://${base.host}/cdp`; | ||
| const rewritten = args.filter((arg) => !AUTO_CONNECT_FLAGS.has(arg)); | ||
| rewritten.push('--wsEndpoint', wsEndpoint, '--wsHeaders', JSON.stringify({ Authorization: `Bearer ${token}` })); |
There was a problem hiding this comment.
Avoid exposing the relay token in child argv
On multi-user hosts where process arguments are readable (for example via ps or /proc), this puts the OpenClaw relay secret into the long-lived chrome-devtools-mcp argv. Any local user who can read argv can reuse the Bearer token against the loopback /cdp relay and drive the signed-in browser, even though the secret file itself was protected; please avoid passing the token as a CLI argument or avoid auto-enabling the relay when headers can only be supplied this way.
Useful? React with 👍 / 👎.
| if (relay.applied) { | ||
| logger.info(`Routing chrome-devtools-mcp through the OpenClaw extension relay at ${relay.endpoint} (no dialog).`); | ||
| } | ||
| const commandArgs = [...relay.args]; |
There was a problem hiding this comment.
Retry autoConnect when the relay spawn fails
When the probe succeeds but the subsequent WebSocket attach fails after spawning chrome-devtools-mcp (for example because the relay restarts, the extension disconnects, or the /cdp endpoint rejects the connection), this path has already replaced the original --autoConnect args and the catch below only closes and rethrows. That turns an otherwise usable plain auto-connect launch into a hard failure, contrary to the best-effort fallback behavior; retry once with the original args when relay.applied connection fails.
Useful? React with 👍 / 👎.
Summary
Chrome M144+ shows a per-session "Allow remote debugging?" dialog for
chrome-devtools-mcp --autoConnect, with no way to persist approval (upstream closed the request as not-planned). The OpenClaw Chrome-extension relay drives the same signed-in Chrome over a loopback CDP endpoint viachrome.debugger— no dialog at all.This adds a best-effort rewrite in the stdio transport: when a server command is
chrome-devtools-mcpwith--autoConnectand a paired OpenClaw relay answers on this host, the args become--wsEndpoint ws://127.0.0.1:18799/cdp --wsHeaders '{"Authorization":"Bearer <host-local secret>"}'.~/.openclaw/credentials/browser-extension-relay.secret(orOPENCLAW_STATE_DIR) + authenticatedGET /json/versionreturning 200 within 750 ms. 503 (relay up, extension unpaired) keeps plain autoConnect.MCPORTER_CHROME_DEVTOOLS_RELAY_URL(loopback http only — the Bearer token rides plain headers). Opt out:MCPORTER_DISABLE_CHROME_DEVTOOLS_RELAY=1.Target.getBrowserContexts).Testing
pnpm check+ full suite: 848 passed, 3 skipped.tests/chrome-devtools-relay.test.ts: rewrite shape, custom loopback URL, non-loopback rejection, missing-secret / dead-relay / unrelated-command fallbacks.mcporter call --stdio npx --stdio-arg -y --stdio-arg chrome-devtools-mcp@latest --stdio-arg --autoConnect --tool list_pageslisted the real Chrome's shared tabs with zero dialogs; the daemon-spawned process argv shows the rewritten--wsEndpointargs.🤖 Generated with Claude Code