Skip to main content
@mcp-b/webmcp-polyfill is deprecated. For the standard imperative API, install the W3C Community Group polyfill, @w3c/webmcp-polyfill.
@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/global runtime.

When not to use this package

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 MCP outputSchema, use the global runtime.

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.