@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:
navigator.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 three management tools:
| Tool | What it does |
|---|---|
webmcp_list_sources | Lists connected browser tabs with metadata (tab ID, origin, URL, title, tool count) |
webmcp_list_tools | Lists all relayed tools with source info |
webmcp_call_tool | Invokes a relayed tool by name (for clients that do not support dynamic tool registration) |
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.

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
| Problem | Fix |
|---|---|
No sources connected | Confirm the page loaded embed.js and the relay process is running |
No tools listed | Confirm tools are registered on the page before embed.js loads. If tools register after load, ensure your runtime emits tool-change notifications |
Tool not found | The tab reloaded or disconnected. Call webmcp_list_tools to refresh |
| Connection blocked | Verify --widget-origin matches your host page origin and the relay port matches data-relay-port |
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
