Skip to content

Business-Maps/bifrost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@businessmaps/bifrost

CI npm

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.

Bifrost Terminal

Requirements: Node.js 18+ · ws (installed automatically)

Install

npm i -g @businessmaps/bifrost

Then register it with your MCP client. For example:

claude mcp add --transport stdio bifrost -- bifrost --no-auth

Note: The --no-auth flag is currently recommended because there is an unresolved issue with token authentication when MCP clients launch the daemon. Without it the client has no way to read the token printed to stderr.

The MCP client starts the daemon automatically.

Usage

Install the client library in your browser app:

npm i @businessmaps/bifrost-browser

Or use a CDN:

<script src="https://unpkg.com/@businessmaps/bifrost-browser"></script>

TypeScript types are included out of the box — no @types package needed.

Then register your tools:

import { BifrostBrowser } from "@businessmaps/bifrost-browser";

const bridge = new BifrostBrowser({
  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 — the token is sent via the Sec-WebSocket-Protocol header during the WebSocket handshake. 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 only)
--help, -h        Show this message
--version, -v     Show version

Dev

git clone https://github.com/Business-Maps/mcp.git && cd mcp
npm install
npm test

Architecture · Client API · Contributing

License

Apache 2.0

About

A daemon that allows you to connect AI tools to browser web apps by spawning a local MCP server that communicates with your website through JSON-RPC

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors