Skip to content

feat(mcp): offer page-registered WebMCP tools as MCP tools - #42632

Closed
Dmitry Gozman (dgozman) wants to merge 3 commits into
microsoft:mainfrom
dgozman:webmcp-dynamic-tools
Closed

feat(mcp): offer page-registered WebMCP tools as MCP tools#42632
Dmitry Gozman (dgozman) wants to merge 3 commits into
microsoft:mainfrom
dgozman:webmcp-dynamic-tools

Conversation

@dgozman

Copy link
Copy Markdown
Collaborator

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.

  • Named webmcp_<tool>, sanitized and deduplicated. The prefix keeps a page from shadowing a built-in tool.
  • notifications/tools/list_changed is sent when the current tab's tools change, or when the current tab changes. The server now declares tools.listChanged.
  • Descriptions are prefixed with [UNTRUSTED: ...], plus [READ-ONLY] or [CONSEQUENTIAL: ...] when the page annotates them. readOnlyHint / destructiveHint are mapped through.
  • Only the current tab contributes tools. With three tabs open, the client sees one tab's tools.
  • A tool the page no longer registers fails with a stale-tool error, and a tool that answers with isError fails the MCP call rather than reporting success.

Notes

  • ServerBackend gains two optional members, dynamicTools() and onToolListChanged(), so the test-runner backend is untouched.
  • listTools can run before the browser exists, since the backend is created lazily on the first tool call. It then returns the static tools only.
  • The CLI is unaffected: the daemon drives BrowserBackend directly and never serves a tool list.

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.
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Test results for "MCP"

8492 passed, 1440 skipped


Merge workflow run.

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