The Core API
WebMCP centers around one key method:navigator.modelContext.registerTool(). This browser API lets you expose JavaScript functions as structured tools that AI agents can discover and call.
WebMCP vs MCP
WebMCP is inspired by Anthropic’s Model Context Protocol (MCP) but adapted for web browsers:| Aspect | MCP | WebMCP |
|---|---|---|
| Environment | Backend servers | Browser |
| Use case | Server-to-agent | Human-in-the-loop |
| Authentication | OAuth 2.1 | Inherits user session |
| API | MCP SDK | navigator.modelContext |
- Use MCP for backend services and server-to-agent communication
- Use WebMCP for browser-based tools where users are present
MCP-B: The Reference Implementation
Since browsers don’t yet natively supportnavigator.modelContext, MCP-B provides a polyfill that:
- Implements the W3C API - Adds
navigator.modelContextto any browser - Bridges to MCP - Translates WebMCP tools to MCP format for compatibility with existing AI frameworks
