How WebMCP works (Architecture)
mainWebMCP acts as a bridge between an MCP client and a website using a localhost-only WebSocket server. This prevents external access while allowing your local browser to communicate with your local MCP client.
The Request Flow:
- MCP Client sends a request to the MCP Server.
- MCP Server forwards the request to the WebSocket Server.
- WebSocket Server forwards the request to the Web Page.
- The Web Page executes the tool/resource and sends the result back through the same path.
Key Concepts:
- Scoping: Tools are scoped by domain name to prevent collisions.
- Unified List: The MCP client sees all tools from all connected websites as a single list, using channel prefixes to keep them organized.
- Security: Authentication is handled via a registration token exchange. Once a website registers, the token is deleted.