Skip to main content
@mcp-b/webmcp-polyfill vendors the upstream WebMCP polyfill and installs its standard document.modelContext surface when the browser does not provide one. It provides browser-facing tool registration, discovery, and object-input execution. A temporary MCP-B layer adds declarative tools and their SubmitEvent extensions until upstream supports them. Existing browser contexts and native SubmitEvent hooks are preserved; missing hooks are filled in.

When to use this package

  • You want the upstream registerTool, getTools, and object-input executeTool APIs in browsers today.
  • You are building a site or reusable library that wants to stay close to the Community Group draft surface.
  • You want to pair runtime behavior with upstream webmcp-types declarations.

When not to use this package

  • 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 upstream webmcp-types directly.

Where it sits in the package graph

This package bundles the upstream polyfill source. @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 upstream installer, core API, and temporary declarative layer. For prompts, resources, transports, or MCP outputSchema, use the global runtime.

Reference

Upstream initialization and core runtime behavior.

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.