Skip to content

fix(mcp): make the HTTP fallback work and stop it masking bridge errors - #44

Merged
KazKozDev merged 1 commit into
mainfrom
fix/mcp-http-fallback
Oct 8, 2026
Merged

KazKozDev merged 1 commit into
mainfrom
fix/mcp-http-fallback

Conversation

@KazKozDev

Copy link
Copy Markdown
Owner

What this changes

  • The MCP server's HTTP fallback now reaches the bridge. Browser tools go to /v1/tools/call under their tool names, and a goal goes to /v1/tasks and /v1/tasks/:id/wait.
  • The fallback is taken only when the socket cannot be opened. If the bridge was reached, its answer — including an error or a timeout — is what the client gets.

Why

callHttp posted the extension's request types (browser.snapshot) to /v1/tools/call, which takes tool names (browser_snapshot). Every one of the ten tools came back Unknown tool: browser.…, so the fallback had never worked.

callBridge also fell back on any socket failure. Two consequences:

  • A real error from the bridge ("extension is not connected", a failed click) was replaced by the fallback's "Unknown tool", which points at the wrong thing. I hit this while the extension was reloading.
  • After a socket timeout the same request would be sent again over HTTP: a second click, a second form submission. This one is from reading the code; I did not reproduce a double action.

How it was verified

  • ./scripts/check.sh passes locally
  • New scripts/mcp-smoke.mjs, run from check.sh. It drives the real mcp-server.js over stdio in three set-ups: no socket and a real bridge (all ten tools must be recognised), no socket and a recording HTTP server (routes and bodies for a goal and a click), socket open and bridge answering with an error (no HTTP request may follow).
  • The script fails on main with browser_snapshot over HTTP: Unknown tool: browser.snapshot. It stops at that first assertion, so the third set-up was not separately shown to fail on main.
  • With the extension loaded in Chrome, browser_snapshot through the MCP server still returns a snapshot over the socket.
  • No browser eval run. The HTTP path was not exercised with a live extension, only against a bridge with none attached.

Notes

  • weboperator-mcp on npm is still 1.5.1 with the broken fallback; this reaches users with the next publish.

🤖 Generated with Claude Code

The MCP server falls back to the bridge's HTTP API when the socket fails.
It sent the extension's request types (`browser.snapshot`) to
`/v1/tools/call`, which takes tool names (`browser_snapshot`), so every
tool came back "Unknown tool" and the fallback had never worked.

It was also taken on any socket failure, including an error the bridge
itself returned. The real error was then replaced by the retry's, and a
socket timeout would have sent the same action a second time. The
fallback now runs only when the socket cannot be opened.

scripts/mcp-smoke.mjs drives the real mcp-server.js over stdio against a
real bridge and a recording HTTP server, and runs from check.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T16:31:12.046788Z 9241658 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@KazKozDev
KazKozDev merged commit ba18de0 into main Oct 8, 2026
4 checks passed
@KazKozDev
KazKozDev deleted the fix/mcp-http-fallback branch October 8, 2026 16:45
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.

1 participant