Skip to main content
@mcp-b/react-webmcp is the full React surface for MCP-B. It covers tool registration, prompt and resource hooks, and client/provider APIs for consuming MCP servers from a React tree.

Version

The 4.0 release line aligns with the document-first WebMCP API. The core useWebMCP hook registers tools against the strict document.modelContext surface. Prompt and resource hooks require the BrowserMcpServer installed by @mcp-b/global. An internal fallback to the deprecated navigator.modelContext alias remains only for older preview runtimes; application code should not use it.

When to use this package

  • You want WebMCP tool, prompt, and resource registration from React.
  • You want JSON Schema or Standard JSON Schema input schemas in hook configuration.
  • You need client/provider hooks (McpClientProvider, useMcpClient) in addition to browser-exposed tools.

When not to use this package

  • You only need strict-core registerTool behavior. Use usewebmcp.

Where it sits in the package graph

This package combines two layers: useWebMCP works with native or polyfilled strict WebMCP, while prompt and resource hooks use the BrowserMcpServer from @mcp-b/global. React peer dependency: ^17.0.0 || ^18.0.0 || ^19.0.0.

First step

Choose the owner for the hooks you use: useWebMCP needs native WebMCP or an initialized strict polyfill; prompt and resource hooks need @mcp-b/global; client/provider hooks use their configured MCP client and transport without requiring a browser runtime. The reference page covers each surface.

Reference

Hook APIs, provider APIs, schema support, and return types.

Your first React tool

Guided tutorial for registering a React tool.

Register prompts and resources

Apply the full MCP-B React surface.

Strict core vs MCP-B extensions

Decide whether the full React surface is necessary.