Skip to main content
@mcp-b/webmcp-ts-sdk exposes BrowserMcpServer, a thin WebMCP adapter that composes the official MCP TypeScript SDK v2 server. It does not subclass or fork McpServer.

When to use this package

  • You need direct control over the browser server instead of the automatic @mcp-b/global setup.
  • You need to mirror MCP tools to an existing document.modelContext.
  • You need to backfill tools from native Chrome or expose MCP-B prompts and resources.

When not to use this package

What changed in v2

Dynamic registration is no longer a reason to maintain a modified MCP server. SDK v2 owns dynamic tool, prompt, and resource registrations, plus MCP protocol and transport behavior. SDK v2 also owns schema conversion and validation. It accepts Standard Schema implementations such as Zod 4.2 or newer and wraps raw JSON Schema with fromJsonSchema. Zod 3 is unsupported. BrowserMcpServer retains only the WebMCP boundary:
BrowserMcpServer.connect(customTransport) remains on SDK v2’s legacy 2025-era route. Installing v2 does not make tab, iframe, or other custom transports speak MCP 2026-07-28. Instance-level sampling and elicitation requests live on browserServer.mcpServer.server. These SDK APIs are legacy-only and throw on modern-era v2 instances. See Supporting protocol revision 2026-07-28.
WebMCP can register an array-root input schema because arrays are JavaScript objects. MCP requires tool input schemas to have an object root. The adapter keeps those tools on WebMCP, omits them from the MCP tool list, and logs a warning.

Where it sits

@mcp-b/global creates the adapter with the current document.modelContext as its native target. The adapter mirrors browser-facing registrations down to that target and delegates MCP work to its composed v2 McpServer. The reference page describes the adapter methods and its native Chrome behavior. Use the Model Context Tool Inspector recommended by Chrome’s WebMCP documentation to inspect mirrored tools. The MCP TypeScript SDK v2 documentation owns the upstream server API.

Reference

BrowserMcpServer APIs, native mirroring, and backfill helpers.

Runtime layering

See how this layer fits between the polyfill and @mcp-b/global.

Strict core and extensions

Separate the standard browser API from MCP-B helpers.

WebMCP standard API

Consult the browser surface and its upstream specification.