Skip to content

feat(chrome-devtools): route autoConnect through OpenClaw extension relay - #250

Merged
steipete merged 1 commit into
mainfrom
claude/mcp-devtools-alert-workaround-5b5ee6
Aug 2, 2026
Merged

steipete merged 1 commit into
mainfrom
claude/mcp-devtools-alert-workaround-5b5ee6

Conversation

@steipete

@steipete steipete commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

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 via chrome.debugger — no dialog at all.

This adds a best-effort rewrite in the stdio transport: when a server command is chrome-devtools-mcp with --autoConnect and 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>"}'.

  • Detection: relay secret at ~/.openclaw/credentials/browser-extension-relay.secret (or OPENCLAW_STATE_DIR) + authenticated GET /json/version returning 200 within 750 ms. 503 (relay up, extension unpaired) keeps plain autoConnect.
  • Relay URL override: MCPORTER_CHROME_DEVTOOLS_RELAY_URL (loopback http only — the Bearer token rides plain headers). Opt out: MCPORTER_DISABLE_CHROME_DEVTOOLS_RELAY=1.
  • Any failure (no secret, dead relay, bad URL) leaves the original args untouched.
  • Companion change: feat(browser): relay CDP compat for Puppeteer clients (chrome-devtools-mcp) openclaw#117915 teaches the relay the one CDP method Puppeteer needs (Target.getBrowserContexts).

Testing

  • pnpm check + full suite: 848 passed, 3 skipped.
  • New tests/chrome-devtools-relay.test.ts: rewrite shape, custom loopback URL, non-loopback rejection, missing-secret / dead-relay / unrelated-command fallbacks.
  • Live on macOS with a paired relay: mcporter call --stdio npx --stdio-arg -y --stdio-arg chrome-devtools-mcp@latest --stdio-arg --autoConnect --tool list_pages listed the real Chrome's shared tabs with zero dialogs; the daemon-spawned process argv shows the rewritten --wsEndpoint args.
  • Codex autoreview clean (0 findings).

🤖 Generated with Claude Code

…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]>
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 2, 2026, 4:39 AM ET / 08:39 UTC.

ClawSweeper review

What this changes

This PR adds a best-effort stdio-launch rewrite that sends chrome-devtools-mcp --autoConnect through a paired local OpenClaw Chrome-extension relay, with opt-out and loopback-only override settings.

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 --autoConnect arguments and then fail without retrying them.

Priority: P2
Reviewed head: 15d679c6f4501d11ede0e547570c87d1439f8363
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has focused tests and green platform builds, but a source-proven compatibility gap can turn an existing working launch mode into a failed connection.
Proof confidence 🌊 off-meta tidepool Not applicable: The author is a repository collaborator, so the external-contributor proof gate does not apply; the PR body nevertheless reports a live paired-relay macOS run.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The author is a repository collaborator, so the external-contributor proof gate does not apply; the PR body nevertheless reports a live paired-relay macOS run.
Evidence reviewed 6 items Relay liveness is not a capability check: The proposed rewrite accepts any authenticated HTTP 200 from /json/version and immediately replaces every auto-connect flag with relay endpoint arguments; it does not establish the relay supports the CDP methods required by the launched server.
No startup fallback after rewrite: The current stdio transport closes and rethrows a child connection failure, so an unsupported relay does not retry the original --autoConnect launch.
Companion relay requirement: The PR description says the OpenClaw relay needs a companion change for Target.getBrowserContexts, which directly demonstrates that a paired live relay is not by itself a sufficient compatibility condition.
Findings 2 actionable findings [P1] Preserve auto-connect for unsupported relays
[P3] Leave release notes to the release owner
Security None None.

How this fits together

MCPorter 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]
Loading

Decision needed

Question Recommendation
Should MCPorter automatically prefer a locally installed OpenClaw relay, and what capability or minimum-version contract must be satisfied before it replaces existing --autoConnect behavior? Gate on advertised relay capability: Merge only after the relay exposes or proves the required CDP capability and MCPorter preserves the existing launch path for unsupported installed relay versions.

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

  • Preserve auto-connect for unsupported relays (P1) - A 200 /json/version response proves only that a paired relay is live. The PR states that Target.getBrowserContexts needs a companion relay change, yet this branch rewrites every paired installation before checking that capability; an older relay will then fail during child connection and MCPorter does not retry the original --autoConnect arguments. Gate the rewrite on a compatible relay capability/version or add a narrow fallback.
  • Leave release notes to the release owner (P3) - CHANGELOG.md is release-owned under the repository review policy. Remove this PR-owned unreleased release-note entry and let the release process select and word the note.
  • Resolve merge risk (P1) - A paired but older OpenClaw relay can return 200, trigger the rewrite, and lack the required CDP method; MCPorter then fails the child connection instead of restoring the existing auto-connect path.
  • Resolve merge risk (P1) - This introduces a default cross-product dependency on the installed OpenClaw relay, so compatibility must be defined across upgrades rather than inferred from relay liveness.
  • Complete next step (P2) - A maintainer must set the cross-project relay capability and upgrade contract before any automated repair can safely change this default launch behavior.
  • Improve patch quality - Define and test a relay capability or minimum-version gate that preserves auto-connect for older relays.
  • Improve patch quality - Remove the release-owned changelog entry from the branch.

Findings

  • [P1] Preserve auto-connect for unsupported relays — src/chrome-devtools-relay.ts:122
  • [P3] Leave release notes to the release owner — CHANGELOG.md:7
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 261 added, 1 removed across 5 files The implementation adds a new launch-routing module and focused tests, while also touching user documentation and a release-owned changelog.
CI platforms 3 build jobs passed GitHub reports successful macOS, Ubuntu, and Windows builds, but those checks do not prove compatibility with previously installed OpenClaw relay versions.

Merge-risk options

Maintainer options:

  1. Add capability-gated fallback (recommended)
    Require a relay capability/version signal before rewriting and keep the current auto-connect path when the installed relay cannot satisfy the Chrome DevTools MCP protocol.
  2. Adopt a documented minimum relay baseline
    Maintainers may intentionally accept the upgrade coupling only if the required OpenClaw relay release and user-visible upgrade behavior are documented and validated.

Technical review

Best 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 /json/version but lacks Target.getBrowserContexts; source shows MCPorter rewrites the arguments and current transport source shows no retry of the original launch after connection failure.

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:

  • [P1] Preserve auto-connect for unsupported relays — src/chrome-devtools-relay.ts:122
    A 200 /json/version response proves only that a paired relay is live. The PR states that Target.getBrowserContexts needs a companion relay change, yet this branch rewrites every paired installation before checking that capability; an older relay will then fail during child connection and MCPorter does not retry the original --autoConnect arguments. Gate the rewrite on a compatible relay capability/version or add a narrow fallback.
    Confidence: 0.96
  • [P3] Leave release notes to the release owner — CHANGELOG.md:7
    CHANGELOG.md is release-owned under the repository review policy. Remove this PR-owned unreleased release-note entry and let the release process select and word the note.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against e056f77bd2bf.

Labels

Label changes:

  • add P2: This is a useful Chrome DevTools workflow improvement with a bounded but real compatibility risk for paired existing installations.
  • add merge-risk: 🚨 compatibility: A successful relay liveness probe can replace established auto-connect behavior even when the installed relay lacks a required CDP capability.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The author is a repository collaborator, so the external-contributor proof gate does not apply; the PR body nevertheless reports a live paired-relay macOS run.

Label justifications:

  • P2: This is a useful Chrome DevTools workflow improvement with a bounded but real compatibility risk for paired existing installations.
  • merge-risk: 🚨 compatibility: A successful relay liveness probe can replace established auto-connect behavior even when the installed relay lacks a required CDP capability.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The author is a repository collaborator, so the external-contributor proof gate does not apply; the PR body nevertheless reports a live paired-relay macOS run.

Evidence

What I checked:

  • Relay liveness is not a capability check: The proposed rewrite accepts any authenticated HTTP 200 from /json/version and immediately replaces every auto-connect flag with relay endpoint arguments; it does not establish the relay supports the CDP methods required by the launched server. (src/chrome-devtools-relay.ts:122, 15d679c6f450)
  • No startup fallback after rewrite: The current stdio transport closes and rethrows a child connection failure, so an unsupported relay does not retry the original --autoConnect launch. (src/runtime/transport.ts:78, e056f77bd2bf)
  • Companion relay requirement: The PR description says the OpenClaw relay needs a companion change for Target.getBrowserContexts, which directly demonstrates that a paired live relay is not by itself a sufficient compatibility condition. (15d679c6f450)
  • Current documented behavior: Current main documents the existing --autoConnect compatibility patch and opt-out, but does not document a relay capability/version contract. (README.md:415, e056f77bd2bf)
  • Current-area provenance: The current transport layout was most recently refactored by Peter Steinberger in the merged runtime modularization work; the available history also shows Umut Keltek as the recent transport-fallback contributor. (src/runtime/transport.ts:47, 69c98e88127c)
  • Release-note ownership: The repository policy makes CHANGELOG.md release-owned; the PR adds an unreleased 0.12.4 entry even though normal PRs should leave release notes to the release process. (CHANGELOG.md:3, e056f77bd2bf)

Likely related people:

  • steipete: Peter Steinberger authored the latest merged transport modularization and is also connected to the Chrome DevTools integration path under review. (role: recent area contributor; confidence: high; commits: 69c98e88127c; files: src/runtime/transport.ts)
  • umutkeltek: Umut Keltek authored the recent SSE transport reliability fix, making them a useful adjacent routing contact for stdio/transport fallback behavior. (role: recent adjacent transport contributor; confidence: medium; commits: 57cf3b19aba6; files: src/runtime/transport.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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}` }));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment thread src/runtime/transport.ts
if (relay.applied) {
logger.info(`Routing chrome-devtools-mcp through the OpenClaw extension relay at ${relay.endpoint} (no dialog).`);
}
const commandArgs = [...relay.args];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@steipete
steipete merged commit e1689c3 into main Aug 2, 2026
9 checks passed
@vincentkoc
vincentkoc deleted the claude/mcp-devtools-alert-workaround-5b5ee6 branch September 25, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant