@mcp-b/global (which installs BrowserMcpServer as navigator.modelContext). For background on this distinction, see Strict Core vs MCP-B Extensions.
Register a prompt
A prompt is a reusable message template that AI clients can discover and invoke with arguments.React
Use theuseWebMCPPrompt hook from @mcp-b/react-webmcp. It handles registration and cleanup on unmount.
Register a resource
A resource exposes readable data (configuration, documents, state) to AI clients.React
Use theuseWebMCPResource hook from @mcp-b/react-webmcp.
Use sampling and elicitation
Sampling lets your page request LLM completions from the connected client. Elicitation lets your page request structured input from the user through the client. Both methods delegate to the MCP SDK and require an active transport connection. See the@mcp-b/webmcp-ts-sdk reference for parameter and return type details.
React
@mcp-b/react-webmcp provides useSampling and useElicitation hooks that manage loading state, errors, and request counts.
