@businessmaps/mcp
MCP server that lets AI tools call functions running in your browser.
The daemon sits between any MCP client and your browser tab. It speaks JSON-RPC over stdio on one side and WebSocket on the other. Your browser app connects, registers tools, and the AI can call them. No dependencies, just Node 18+.
Install
npm i -g @businessmaps/mcp
or without npm
curl -fsSL https://raw.githubusercontent.com/Business-Maps/mcp/main/install.sh | sh
Then register it with your MCP client. For example:
claude mcp add --transport stdio browser-bridge -- mcp-browser-bridge
The MCP client starts the daemon automatically.
Usage
Install the client library in your browser app:
npm i @businessmaps/mcp-client
Or use a CDN:
<script src="https://unpkg.com/@businessmaps/mcp-client"></script>
TypeScript types are included out of the box — no @types package needed.
Then register your tools:
import { McpBrowserBridge } from "@businessmaps/mcp-client";
const bridge = new McpBrowserBridge({
port: 3099,
token: "TOKEN", // printed to stderr when daemon starts
});
bridge.registerTools([
{
name: "get_selection",
description: "Returns the user's text selection",
inputSchema: { type: "object", properties: {} },
handler: async () => window.getSelection().toString(),
},
]);
bridge.connect();
Handlers run in the browser -- full access to DOM, Canvas, IndexedDB, Clipboard, fetch, etc.
There's a working live demo with five sample tools you can try right away.
Auth
The daemon generates a token on startup and prints it to stderr. Pass it to the client. Skip with --no-auth during local dev.
Multiple tabs
Each tab registers its own tools. Calls route to whoever owns the tool. Disconnecting a tab removes its tools.
Options
--port <port> WebSocket port (default: 3099)
--timeout <secs> Tool call timeout (default: 120)
--no-auth Disable token auth
Dev
git clone https://github.com/Business-Maps/mcp.git && cd mcp
npm test # no install needed, no deps
Architecture · Client API · Contributing
License
Apache 2.0