@mcp-b/webmcp-polyfill passes through to @w3c/webmcp-polyfill, which installs the standard document.modelContext surface when the browser does not provide one. It adds one thing: a temporary MCP-B layer for declarative tools and their SubmitEvent extensions, kept until the official polyfill ships them. Existing browser contexts and native SubmitEvent hooks are preserved; missing hooks are filled in.
When to use this package
- You need declarative tools in browsers without native support and do not want the full
@mcp-b/globalruntime.
When not to use this package
- You only use the imperative API (
registerTool,getTools,executeTool). Use@w3c/webmcp-polyfill. - You need prompts, resources, browser transport, or direct access to an MCP server. Use
@mcp-b/global. - You only need types at build time. Install
webmcp-types, the package Chrome’s Imperative API guide recommends.
Where it sits in the package graph
This package depends on@w3c/webmcp-polyfill as a normal npm dependency and adds the declarative layer on top. @mcp-b/global wraps it when MCP-B extensions are needed.
First step
Initialize the polyfill before your app registers tools. The reference page documents the installer and the temporary declarative layer. For prompts, resources, transports, or MCPoutputSchema, use the global runtime.
Related pages
Reference
Installer and temporary declarative layer.
First tool tutorial
Build your first browser tool.
Choose a runtime
Compare the three runtime strategies.
Test native and polyfill
Validate your code against both native and polyfilled paths.
