feat: add experimental WebMCP fast path via Chrome CDP#416
Conversation
|
@alectimison-maker is attempting to deploy a commit to the esokullu's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Adds an experimental Chrome-only WebMCP fast path while preserving existing browser interaction fallbacks.
Changes:
- Adds CDP-based WebMCP discovery and invocation.
- Integrates permission, confirmation, trust-boundary, and completion handling.
- Adds fixtures, regression coverage, documentation, and a real-Chrome smoke test.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/chrome/src/cdp/cdp-client.js |
Implements WebMCP sessions, discovery, invocation, and cleanup. |
src/chrome/src/agent/agent.js |
Integrates execution, confirmation, routing, and lifecycle handling. |
src/chrome/src/agent/tools.js |
Defines and gates WebMCP agent tools. |
src/chrome/src/agent/permission-gate.js |
Classifies WebMCP permissions and untrusted results. |
src/chrome/src/agent/completion-invariant.js |
Requires post-invocation verification. |
src/firefox/src/agent/agent.js |
Returns explicit unsupported results. |
src/firefox/src/agent/tools.js |
Mirrors schemas and gating definitions. |
src/firefox/src/agent/permission-gate.js |
Mirrors security classifications. |
src/firefox/src/agent/completion-invariant.js |
Maintains completion parity. |
test/run.js |
Adds WebMCP regression tests. |
test/webmcp-e2e.py |
Adds a real-Chrome CDP smoke test. |
test/fixtures/webmcp-page.html |
Provides registered WebMCP fixture tools. |
test/README.md |
Documents smoke-test execution. |
README.md |
Documents availability and permissions. |
docs/architecture.md |
Describes the WebMCP architecture. |
docs/security-model.md |
Documents security boundaries. |
docs/prompt-injection-defense.md |
Classifies WebMCP data as untrusted. |
docs/privacy-and-data-flow.md |
Documents catalog and model data flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (name === 'execute_webmcp_tool') { | ||
| return this._fallbackSubmitConfirmationInfo( | ||
| normalizeHost(args?._webMcpTargetUrl) || await fallbackHostForPrompt(), | ||
| name, | ||
| 'page-registered WebMCP callback', |
|
wow thank you this is amazing! we've been thinking about this: #305 |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Because every token counts, especially with smaller local models, I'd like to land this as an explicitly opt-in setting under Settings > Advanced rather than enabling it by default. That keeps the default surface lean for users on tight token budgets, while still making the fast path available for those who want it. I do hope WebMCP gains ground soon — we'd love to be an early cheerleader. If there's an official icon or support announcement we can use, happy to add it to the website. I didn't see one linked in the PR, so feel free to point me to it. |
Summary
This pull request adds an experimental, opt-in WebMCP fast path to WebBrain. When the user enables Experimental WebMCP under Settings → General → Advanced, supporting Chrome pages let the agent discover and invoke structured capabilities registered by the page through Chrome DevTools Protocol instead of relying exclusively on screenshots, accessibility-tree targeting, or DOM interaction. The setting is off by default, so ordinary runs do not receive WebMCP tool schemas or prompt guidance.
The existing browser interaction stack remains the fallback for pages that do not expose WebMCP tools.
Motivation
WebBrain already supports visual, accessibility-tree, DOM, and limited observed-API interaction paths. Those approaches remain important, but they can be inefficient or brittle when a site offers an explicit machine-readable operation. WebMCP provides a browser-native way for a cooperating page to publish structured tool names, descriptions, input schemas, and callbacks while preserving the user's active browser session and page state.
This implementation follows the experimental Chrome CDP
WebMCPdomain and deliberately treats the page as an untrusted security principal.What changed
Chrome CDP integration
WebMCP.enableandWebMCP.disable.WebMCP.toolsAddedandWebMCP.toolsRemovedevents.WebMCP.invokeTooland consumes asynchronousWebMCP.toolRespondedevents.Agent tools and routing
list_webmcp_toolsfor bounded, paginated capability discovery.execute_webmcp_toolfor invoking a catalog entry through an opaquewmcp_*identifier.Security and trust boundaries
readOnlyannotations as an authorization boundary.Browser compatibility
Documentation
Updated the README and architecture, privacy/data-flow, prompt-injection, security-model, and testing documentation to describe:
Testing
Main unit suite
node test/run.jsThe WebMCP coverage includes:
Prompt-injection corpus
node test/security/injection-corpus.mjsExisting browser fixtures
npm run test:fixturesReal Chrome WebMCP smoke test
python test/webmcp-e2e.pyagainst the included local fixture, using Chrome 150 withWebMCPTesting,DevToolsWebMCPSupportenabled:Packaging and static validation
npm run build:zipsuccessfully produced Chrome, Edge, and Firefox packages.git diff --checkpassed.CI harness
npm run test:ciLocal validation
No local test failures remain after merging current
main.Notes
WebMCP is experimental and only accelerates cooperating pages that register tools. It is not a general mechanism for reading arbitrary backend databases or bypassing site authorization. When the API or a relevant tool is unavailable, WebBrain continues through its established accessibility-tree, DOM, screenshot, and observed-API paths.