@mcp-b/webmcp-local-relay.
Configure your MCP client
Add the relay server to your MCP client configuration. This works with Claude Desktop, Cursor, Windsurf, Claude Code, or any client that speaks MCP over stdio.For Claude Desktop, you can also download the
.mcpb bundle from GitHub
Releases and double-click to install. No
terminal required.Add the embed script to your page
The relay discovers tools through a hidden iframe injected byembed.js. Add a single script tag to your page:
document.modelContext, they are picked up automatically.
If you are new to WebMCP, register tools first with @mcp-b/global, then load the embed script:
Verify the connection
Once the relay is running and your page has loadedembed.js, your AI agent has access to four management tools:
Tools also register as first-class MCP tools using their original name. When multiple tabs register a tool with the same name, the relay appends a short tab-ID suffix for disambiguation (e.g.
search_ed93, search_a1b2).
Ask your agent to list sources or tools to confirm the connection is working. Try webmcp.sh as a test target; it registers tools for SQL queries, entity management, navigation, and more.

webmcp.sh: a live demo app with WebMCP tools you can relay to any desktop agent
Use a custom port
The relay defaults to WebSocket port9333 on 127.0.0.1. If you need a different port, configure both sides:
Relay CLI:
Restrict allowed origins
By default, the relay accepts connections from any browser page (*). For production or shared machines, restrict which origins can register tools:
--widget-origin flag validates the host page origin reported in the browser handshake. It does not restrict local processes from connecting to the WebSocket.
Handle multiple MCP clients
If you start a second relay instance while one is already running, the second instance detects the port conflict (EADDRINUSE) and falls back to client mode. In client mode it connects as a WebSocket client to the existing server relay and proxies tool operations through it.
If the server relay stops, the client promotes itself back to server mode. This lets multiple MCP clients share the same browser connections without manual configuration.
Troubleshoot common issues
If the relay is temporarily unavailable, the embed widget reconnects automatically with exponential backoff (500 ms to 3 s, up to 100 attempts).
Related pages
- Local Relay Reference for the full CLI options and architecture details
- Transports and Bridges for how the relay fits into the WebMCP transport layer
- Desktop Agent Relay Tutorial for a step-by-step walkthrough from scratch
