feat(mcp): offer page-registered WebMCP tools as MCP tools - #42632
Closed
Dmitry Gozman (dgozman) wants to merge 3 commits into
Closed
feat(mcp): offer page-registered WebMCP tools as MCP tools#42632Dmitry Gozman (dgozman) wants to merge 3 commits into
Dmitry Gozman (dgozman) wants to merge 3 commits into
Conversation
Pages can register tools for agents through the experimental WebMCP API. Surface them as browser_webmcp_list / browser_webmcp_call, and report their presence in the page status after a navigation.
Collect the page's WebMCP tools alongside the snapshot rather than on demand, so tools registered without a navigation are picked up. browser_webmcp_list now reports the cached listing without evaluating in the page.
Project the current tab's WebMCP tools onto MCP tools named webmcp_<tool> and notify the client when they change or when the current tab changes. Tool descriptions carry untrusted, read-only and consequential disclaimers, and a tool that answers with an error fails the call.
Contributor
Test results for "MCP"8492 passed, 1440 skipped Merge workflow run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on #42613, review that one first.
Summary
The current tab's WebMCP tools are now offered as MCP tools of their own, so a client can call them directly instead of going through
browser_webmcp_call.webmcp_<tool>, sanitized and deduplicated. The prefix keeps a page from shadowing a built-in tool.notifications/tools/list_changedis sent when the current tab's tools change, or when the current tab changes. The server now declarestools.listChanged.[UNTRUSTED: ...], plus[READ-ONLY]or[CONSEQUENTIAL: ...]when the page annotates them.readOnlyHint/destructiveHintare mapped through.isErrorfails the MCP call rather than reporting success.Notes
ServerBackendgains two optional members,dynamicTools()andonToolListChanged(), so the test-runner backend is untouched.listToolscan run before the browser exists, since the backend is created lazily on the first tool call. It then returns the static tools only.BrowserBackenddirectly and never serves a tool list.