Add WebMCP discovery and invocation API - #359
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7f26744. Configure here.
sjmiller609
left a comment
There was a problem hiding this comment.
applicable to users not using WebMCP
-
Small fix:
server/runtime/playwright-daemon.ts:309-314— injectingwebmcpas a function parameter breaks existing Playwright code declaringconst webmcp,let webmcp, orclass webmcp. it now fails with a syntax error. Seems unlikely but easy fix? -
Note:
server/cmd/api/main.go:253-258— custom strict error handlers apply globally. malformed requests to every existing endpoint change from plaintext errors to JSON, even when WebMCP is unused. -
Note:
server/lib/cdpclient/cdpclient.go— the shared CDP transport was rewritten for all existing callers. Existing e2e tests look sufficient to cover this, keep in mind for the rollout.
only affects WebMCP users
-
server/lib/browsersurface/frames.go:119-129— a transientPage.enableorPage.getFrameTreefailure leaves the session permanently uninitialized. tools remain missing until the CDP connection is recreated. -
server/cmd/api/api/webmcp.go:75-82— the 1 MiB input limit is enforced only after the full body has been decoded and re-marshaled, so oversized requests can consume significant memory before rejection.

Summary
GET /webmcp/toolsandPOST /webmcp/invokeso callers can discover and invoke native page tools without managing browser protocol eventswebmcp.listTools()andwebmcp.invokeTool()helpers inside Playwright execution by routing through the same HTTP APIValidation
go vet ./...go test -race $(go list ./... | grep -v /e2e$)node --test runtime/*.test.ts-racerunsffa3dd0in 10/10 fresh real-image cycles across top-level, same-origin, OOPIF, and nested-OOPIF tools through both Playwright helpers and HTTPoutcome_unknown, completed-before-navigation results survive, and aborted navigation preserves the original registration