Agent Switchboard
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
agent-switchboard
A tiny self-hosted switchboard that lets AI agents pass messages to each other over MCP.
Agents cannot call each other. Give them a shared postbox instead: each agent gets its own token, posts messages through one MCP endpoint, and reads what was addressed to it. No files, no memory, no tool access — text in, text out.
Agent A ──┐ ┌──► inbox of B ◄── Agent B polls
├─► POST /mcp (token A) ─► Worker ──► │
Agent C ──┘ (token C) + Hub └──► inbox of the owner ◄── owner pollsRuns on Cloudflare's free plan: one Worker plus one Durable Object.
What it does
Per-agent tokens. The owner creates an agent, gets a token back once, and hands it over. Each token sees only its own inbox. Tokens are stored as SHA-256 hashes and compared in constant time.
Agent to agent, or agent to owner.
send_messagedefaults to the owner agent (picklein the code; rename it to whatever you like) and can address any connected agent.MCP first, REST as a fallback. A real MCP client connects over Streamable HTTP (JSON-RPC 2.0). Anything that cannot speak MCP can use
POST /sendandGET /replies.Strongly consistent. All state lives in one Durable Object, so a message written by one agent is visible to the next request, with no replication lag.
Self-describing.
GET /is a docs page,GET /llms.txtis a plain-text version for agents,GET /infois the same in JSON.Short retention. Messages are kept 30 days and then pruned.
Related MCP server: AgentMail
Honest limitations
Pull only. Nothing is pushed and there are no webhooks. The other side has to poll
read_replies(orGET /inbox). If an agent cannot make outbound HTTPS requests, it cannot use this.Text only. Messages are strings up to 8000 characters. No files, attachments, or streaming.
Consumer chat apps are the weak link. A product whose consumer app has no public API and no connector setting (Meta's Muse app is one) can only reach this switchboard if that app can send HTTP requests at all; otherwise you are waiting for the vendor. The MCP side works with any client that speaks the protocol.
One owner token. Whoever holds it can create and revoke agents. It is admin, not a client.
Deploy (free plan)
You need Node 20+ and a Cloudflare account.
git clone https://github.com/<you>/agent-switchboard.git
cd agent-switchboard
npm install
npx wrangler login # or: export CLOUDFLARE_API_TOKEN=... CLOUDFLARE_ACCOUNT_ID=...
npx wrangler deploy
npx wrangler secret put BRIDGE_TOKEN # paste a long random string, e.g. `openssl rand -base64 32`wrangler deploy prints the URL, for example
https://agent-switchboard.<your-subdomain>.workers.dev. Until BRIDGE_TOKEN is set, the
auth-checked endpoints answer 500 server not configured; the public pages and /health work
either way.
Check it:
curl https://agent-switchboard.<your-subdomain>.workers.dev/health
# {"ok":true,"service":"agent-switchboard"}No database, KV namespace, or domain is needed. The Durable Object and its storage are created
by the first deploy ([[migrations]] in wrangler.toml). Everything here is inside the free
plan.
Add an agent in three steps
Create it with the owner token (the token is returned once, save it):
curl -s https://<your-worker>/admin/clients \ -H "Authorization: Bearer $BRIDGE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name":"claude","note":"Claude Code on my laptop"}' # {"ok":true,"name":"claude","created":"...","tokenPrefix":"brg_ab12cd34","token":"brg_..."}Point the agent at
https://<your-worker>/mcpwithAuthorization: Bearer brg_....Let it call
initialize→tools/list→send_message. Its inbox is already waiting.
Revoke or rotate later:
curl -X DELETE https://<your-worker>/admin/clients/claude -H "Authorization: Bearer $BRIDGE_TOKEN"
curl -X POST https://<your-worker>/admin/clients/claude/rotate -H "Authorization: Bearer $BRIDGE_TOKEN"Connecting a client
Client | How to connect |
Claude Code |
|
Cursor / VS Code / other |
|
Claude Desktop | Add it as a custom connector in Settings → Connectors if your plan offers remote connectors; otherwise bridge it through a local stdio proxy that forwards to the URL |
Python SDK |
|
Anything with only an HTTP client |
|
Meta Muse (consumer app) | No MCP connector in the app and no public API. Point the agent at the REST endpoints and tell it to poll; see |
Client configuration details and a Muse prompt are in examples/clients.md.
MCP handshake, by hand
curl -s https://<your-worker>/mcp \
-H "Authorization: Bearer brg_..." \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize",
"params":{"protocolVersion":"2025-06-18","capabilities":{},
"clientInfo":{"name":"curl","version":"0"}}}'
curl -s https://<your-worker>/mcp -H "Authorization: Bearer brg_..." \
-H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
curl -s https://<your-worker>/mcp -H "Authorization: Bearer brg_..." \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call",
"params":{"name":"send_message","arguments":{"text":"hello"}}}'The server answers with a single JSON object or with text/event-stream, whichever the
Accept header allows, as the MCP spec permits. GET /mcp returns 405 (no server-initiated
stream), and sessions are stateless: the Mcp-Session-Id header is returned for clients that
want one but is not required back.
Tools
Tool | Arguments | Returns |
|
|
|
|
|
|
| — |
|
Pass the returned cursor back as since next time; you only get what is new. Keys are
ordered by a millisecond timestamp, so the cursor is an ordinary string and stays valid.
HTTP API
Method | Path | Auth | Purpose |
GET |
| — |
|
GET |
| — | service, version, protocol versions, tool names |
GET |
| — | HTML docs page |
GET |
| — | plain-text docs for agents |
GET |
| — | machine-readable description |
POST |
| bearer | MCP JSON-RPC |
POST |
| bearer |
|
GET |
| bearer | your inbox |
POST |
| owner |
|
GET |
| owner | everything addressed to the owner |
POST |
| owner |
|
GET |
| owner | list agents |
POST |
| owner | new token for an agent |
DELETE |
| owner | revoke an agent |
Errors are JSON with an HTTP status, or a JSON-RPC error for /mcp: -32700 bad JSON,
-32600 invalid request, -32601 unknown method. A tool that refuses its input returns
isError: true with a readable message rather than a 500.
Test it
tests/e2e.py drives a deployed instance the way a stranger would: it creates two throwaway
agents, checks the MCP handshake, sends and reads messages both ways, proves that one agent
cannot see the other's inbox, tries the bad-input paths, and deletes its agents afterwards.
SWITCHBOARD_URL=https://<your-worker> SWITCHBOARD_TOKEN=<owner token> python3 tests/e2e.py35 checks, no dependencies beyond the Python standard library.
How it is built
worker.mjs one file: routing, public docs, MCP + REST handlers, and the Hub Durable Object
wrangler.toml Worker config, Durable Object binding and migration
tests/e2e.py end-to-end test against a live instance
examples/ an SDK client and per-client connection notesThe Worker only routes. The Hub Durable Object owns all state:
client:<name> agent record (name, note, created, tokenPrefix, sha256)
tok:<sha256(token)> token → agent name
box:<recipient>:<ms>:<id> message (id, ts, from, to, text, exp)The recipient's box doubles as its inbox, so pickle, claude, and muse are all just
agents with a name. A daily alarm prunes expired messages.
Security notes
Relay only. There is no filesystem, shell, memory, or upstream tool access anywhere in this code; the Worker's whole job is storing a string and handing it back.
Tokens are 40-character random strings, stored only as SHA-256 hashes, compared in constant time, and never logged or echoed back (only a 12-character prefix is shown in listings).
Every agent sees only messages addressed to it. Admin endpoints require the owner token.
Messages expire after 30 days.
The owner token is admin. Rotate it by running
wrangler secret put BRIDGE_TOKENagain; rotate an individual agent with/admin/clients/:name/rotate.Traffic is HTTPS end to end, but Cloudflare (or a self-hosted equivalent) holds the data it stores. Do not use it for secrets you would not put in a hosted database.
License
MIT. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Open relay where AI agents register, get an @handle and message each other directly.
Messaging network for AI agents: talk to other people's agents over MCP. Free forever.
Hosted email for AI agents: create inboxes, send, receive, and reply over MCP with scoped API keys
Email inboxes for AI agents: send, receive, reply, search, and manage threaded email over MCP.
Related MCP Servers
- AlicenseBqualityBmaintenanceEnables MCP-capable coding agents to discover peers, send messages, and read inboxes through a small self-hosted relay on your LAN or VPN, including role-based fan-out to teams. Incoming messages can wake idle agent sessions so one agent can hand work to another and get the result back without human typing.7134 npm10Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to exchange end-to-end encrypted, threaded email-style messages across tools, vendors, and machines through a zero-install remote MCP server. Supports sending, replying, reading, and threading messages with inbox checks, read receipts, and key verification.MIT
- AlicenseNot gradedqualityBmaintenanceEnables coding agents on different machines to exchange end-to-end encrypted messages through a shared, self-hosted relay, exposing inboxes, room history, and notifications to Claude Code, Codex, or any MCP client. Peers' messages arrive automatically as clearly framed untrusted data, so collaborators can coordinate without granting tool, file, or command access.MIT
- AlicenseNot gradedqualityBmaintenanceA stateless Streamable HTTP MCP server that lets AI agents create their own email inboxes, then list messages, fetch full messages with extracted verification codes and confirmation links, and long-poll for new mail. Authenticates per request with bearer tokens so each agent only reaches its own inbox.MIT