Skip to main content
Glama

Bridge Anything

A self-hosted bridge for agent communication, task delegation, and shared project memory.

The current development build exposes a local MCP server for messaging and project memory. See the technical design for the full roadmap.

Install the release CLI

Download the bridge-anything-<version>.tgz asset from GitHub Releases. With Node.js 22.18 or newer, install it into a local project:

npm install ./bridge-anything-0.2.0.tgz
npx bridge-anything --help

You can point MCP clients directly at the installed bridge-anything binary. Its arguments are mcp <config.json> <principal>. The examples below also work from a source checkout.

Related MCP server: Combined MCP Server

Run the local MCP server

Use Node.js 22.18 or newer. Install runtime dependencies with pnpm install.

Create a local configuration file. The database path is relative to the configuration file.

{
  "database": "./bridge.sqlite",
  "grants": {
    "claude": ["demo"],
    "codex": ["demo"]
  }
}

Configure a local MCP client to start node with these arguments:

/absolute/path/to/bridge-anything/src/cli.ts mcp /absolute/path/to/config.json claude

Use codex as the configured identity for the second client. Both processes must use the same database. The operator controls the client launch arguments and filesystem access. A user who can choose the identity or directly access the SQLite file has access beyond the MCP project grants.

Call send_message with a project, recipient, body, and retry key. The recipient can use inbox_list, reply with reply, and then call acknowledge. Use memory_put with expected version 0 to create a shared memory entry. Read its current version with memory_get before updating.

Test

pnpm test

The integration test starts two local processes with the MCP SDK and exercises message delivery and reply correlation. Platform verification is tracked independently of this fixture.

Run a task worker

Add a commands object to the local configuration. Each key must match a granted target identity. For a local fixture on macOS or Linux:

{
  "commands": {
    "codex": {"command": "/bin/cat", "cwd": ".", "timeoutMs": 2000}
  }
}

Run node src/cli.ts worker ./config.json to process the queue, or add --once to handle up to one queued task. Submit with delegate_task and retrieve the result with task_get. Commands use stdin by default. Configure an explicit inheritEnv array if a target needs environment variables. A configured command runs with the worker account's filesystem access. The fixture uses the target identity only to demonstrate the protocol.

Connect over HTTP

Add an http object to the same configuration:

{
  "http": {
    "port": 8870,
    "tokenEnvByPrincipal": {
      "claude": "BRIDGE_CLAUDE_TOKEN",
      "codex": "BRIDGE_CODEX_TOKEN"
    }
  }
}

Set an independently generated token for each configured identity. The server accepts tokens of at least 32 URL-safe characters. Run node src/cli.ts serve ./config.json and point a Streamable HTTP MCP client at http://127.0.0.1:8870/mcp with an Authorization: Bearer <token> header.

The server listens on IPv4 loopback. For remote access, terminate TLS at a trusted reverse proxy and forward the upstream Host as 127.0.0.1:8870. This entry point targets non-browser clients using configured Bearer tokens. For OAuth clients, configure an external authorization server as described below.

See the platform support matrix for Agent presets and verification status.

Discover targets and configure default routes

Use targets_list with a project ID to see its target identities and which ones accept delegated tasks. You can send to an explicit target or omit the target to use a configured route. A route with the caller's principal takes precedence over a project-wide default. Both the caller and the resolved target must have a grant for the project.

{
  "routes": [
    {"project": "demo", "target": "codex"},
    {"project": "demo", "principal": "codex", "target": "claude"}
  ]
}

Both inbox_list and memory_list accept an optional limit (1–100, default 20) and cursor. Pass the returned nextCursor in the next call with the same project. A null cursor means the page is the last one. For subsequent inbox scans, omit the cursor to include any earlier messages that still need acknowledgement.

Run one worker per database on a local filesystem. The worker holds an exclusive lock while running. On restart it marks previously running tasks as interrupted and continues processing queued tasks. An operator can inspect interrupted work before explicitly submitting a new task.

Receive signed webhooks

Under http.webhooks, configure a route by name with sender, project, optional target, and secretEnv. Grant the configured sender access to the project. Assign a distinct sender and randomly generated secret to each route.

POST a JSON object with a string body to /webhooks/<name>. Send these headers:

  • X-Bridge-Delivery with a stable delivery ID.

  • X-Bridge-Timestamp with the current Unix timestamp in seconds.

  • X-Bridge-Signature with the hex HMAC-SHA256 of the timestamp, a period, the delivery ID, another period, and the exact request body bytes.

The server accepts timestamps within five minutes. To retry later, sign again with a fresh timestamp and the same delivery ID and message. Successful requests return HTTP 202 and the durable message ID.

Use from deepseek-super-agent

Register Bridge as a stdio MCP server in DS_AGENT_MCP_SERVERS:

[{
  "name": "bridge",
  "command": "/absolute/path/to/node",
  "args": [
    "/absolute/path/to/bridge-anything/src/cli.ts",
    "mcp",
    "/absolute/path/to/bridge-config.json",
    "deepseek"
  ]
}]

Grant the deepseek identity access to the intended projects in Bridge. The downstream harness exposes tools such as mcp__bridge__send_message. With both checkouts' dependencies installed, run the offline cross-project contract check:

node --experimental-transform-types scripts/verify-deepseek-mcp.mjs /path/to/deepseek-super-agent

Telegram channel

Run one polling process per bot, with webhook delivery disabled for that bot. Add a dedicated Bridge identity and grant it access to the intended project. Keep this identity reserved for the Telegram process.

{
  "telegram": {
    "tokenEnv": "TELEGRAM_BOT_TOKEN",
    "chatId": -123456789,
    "userIds": [12345678],
    "identity": "telegram",
    "project": "demo",
    "target": "codex"
  }
}

Run node src/cli.ts telegram ./config.json. Text from the configured chat and allowed user IDs is delivered to the target inbox. When the target uses reply, Bridge replies to the original Telegram message. Incoming updates are deduplicated. Outgoing delivery uses at-least-once semantics, so if Telegram accepts a reply before Bridge can acknowledge it locally, it can be repeated. Telegram replies are limited to 4096 characters.

The Telegram Bot API fixture verifies the round trip without external credentials. Live bot validation requires an authorized bot and test chat.

Inspect the local audit trail

Run bridge-anything audit ./config.json as the operator to read the first 100 audit records. Pass the last sequence as the optional third argument to continue reading. The audit logs persist message mutations, task transitions, and memory writes in the same SQLite transactions as their effects. It records identity, project, object ID, timestamp, and outcome. Message bodies, task prompts and results, and memory values are excluded. Audit access is local and requires the same filesystem privileges as operating the Bridge database.

Use an OAuth authorization server

Bridge can advertise its protected resource and verify access tokens through an existing authorization server's token introspection endpoint. To enable it, add the following under http.oauth:

{
  "issuer": "https://identity.example",
  "resource": "https://bridge.example/mcp",
  "introspectionUrl": "https://identity.example/oauth/introspect",
  "clientId": "bridge-introspector",
  "clientSecretEnv": "BRIDGE_INTROSPECTION_SECRET",
  "principalBySubject": {"identity-provider-subject": "claude"}
}

The introspection client authenticates with form credentials. Configure the authorization server to issue access tokens scoped to bridge:access with the Bridge MCP resource as the audience. Introspection must report the token's active status, issuer, audience, subject, expiry, and scopes. Each mapped identity needs a Bridge project grant. Forward both /mcp and /.well-known/oauth-protected-resource/mcp through the HTTPS reverse proxy. OAuth client registration and user sign-in are handled by the authorization server.

A requester can use task_cancel on a queued or running task. A queued task is cancelled immediately. For a running task, Bridge records cancelRequested: true. The Worker attempts to terminate the managed agent process and reports cancelled once that exit is confirmed. If the process finishes before it sees the request, Bridge records its actual result.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      A local, stdio-based MCP server that lets multiple coding agents share one project database for tasks, verification evidence, signals, knowledge, and conversation indexes. It enforces workflows with allowlisted verification runners and gate checks on acceptance criteria, evidence, dependencies, and high-risk approval before work can be closed.
      203 npm
      MIT