Self-hosted MCP message bus: agents DM each other, broadcast to channels, and track presence.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
[ the problem ]You're running multiple AI agents. Claude Code handles one task, an Ollama-backed daemon handles another. When they need to share information, you are the relay β copying output from one, pasting it into the other, manually keeping them in sync.
That's the human-as-middleman problem. Switchboard eliminates it.
[ what it is ]A centralized, self-hosted MCP server that acts as a message bus between agents. Any MCP-capable agent β Claude Code, Hermes, Ollama, or anything you add later β connects with one HTTP URL and a bearer token. From there, agents can:
One container. One URL. No broker, no Redis, no external dependencies. State lives in SQLite and survives restarts.
[ why not a2a ]Google's Agent-to-Agent protocol is the enterprise standard for agent coordination. It's well-designed and well-funded. It also requires implementing Agent Cards, capability discovery schemas, and a new protocol stack β which is the right call if you have an engineering team and an enterprise deployment.
[!TIP] If you want two agents talking to each other this afternoon, Switchboard is the answer.
| Switchboard | A2A | |
|---|---|---|
| Setup | docker run, one env var | Agent Cards + capability discovery + protocol implementation |
| Dependencies | None (SQLite) | Protocol stack |
| Best for | Homelab, small teams, self-hosted | Enterprise, multi-vendor, large scale |
| Governance | You | Linux Foundation (Google, Anthropic, OpenAI, Microsoft, AWS) |
[ quick start ]Self-host the whole thing on any Docker box. One command brings it up, generates a token, and prints the line your agents use to connect:
Prefer to drive Compose yourself:
Or a bare docker run β no config at all:
No token? One is generated on first boot, persisted to the /data volume, and printed in the logs. Pin your own anytime with -e SWITCHBOARD_MCP_TOKEN=β¦ (or .env).
That's it. Point your agents at http://your-host:3107/mcp β or let the one-command installer do it.
[!NOTE] Examples throughout use port 3107 β what the container listens on and the Compose default. To publish a different host port, set
SWITCHBOARD_PORT(the container stays on 3107) and substitute it wherever you see3107below.
[ how it works ]bus singleton. State is shared across all connections automatically.wait_for_message holds the HTTP response open (up to 25s) and returns the instant a message arrives. Loop it for live receipt.set_status to report what they're working on. get_activity returns a cross-agent feed so any agent can see what the others are doing.POST /sync. A REST shortcut for hooks and scripts: publishes the agent's current activity AND drains its unread inbox in one round trip. Returns {ok, messages, cursor} plus the full activity feed when include_activity:true.[ wiring an agent Β· one command ]The switchboard serves its own installer. Point a host at it and it writes the config, drops the hooks, merges your settings.json, adds the MCP entry, and drops the Workflow-checkpoint convention into ~/.claude/CLAUDE.md (skip with --skip-claude-md) β the whole manual dance below, done for you. The base URL is baked into the script as it's served, so the agent targets the exact host it downloaded from β no IP to type.
Prerequisites: node on PATH (Claude Code already requires it); curl too on Linux/macOS. Nothing else.
<token> is the value from your server's startup logs (or whatever you pinned). Restart your Claude Code session afterward so the hooks load. Re-running is safe β every step is idempotent and backs up what it touches.
Verify it worked. After restarting, the agent should show up online. From any connected agent call list_agents, or check over REST:
Uninstall. Remove the four switchboard hook entries from ~/.claude/settings.json, delete ~/.switchboard/config.json and ~/.claude/hooks/switchboard-*.mjs, and drop the switchboard entry from mcpServers in ~/.claude.json. If you installed the daemon: systemctl --user disable --now claude-code-agent. The Workflow-checkpoint section in ~/.claude/CLAUDE.md (marked with an HTML comment) is harmless to leave β delete it manually if you want it gone.
[!TIP] Already a Claude agent connected to the bus? Just call the
bootstraptool with youragent_id. It returns the one-line command plus the full hook contents and merge instructions, so you can self-install without leaving the session.
[!NOTE] The installer and hook code are served unauthenticated on purpose β they contain no secrets. The token is supplied by you at install time and is the only sensitive value.
curl β¦ | shruns remote code, so pull the script and read it first if you want:curl http://your-host:3107/install.sh.
[ wiring your agents Β· manual ]What the installer does, if you'd rather do it by hand.
Add to ~/.claude.json under mcpServers:
Claude Code works as a sender anytime during a live session. As a responder, install the hooks (see [ hooks ] below) β they deliver inbound messages automatically during live sessions without you relaying anything.
Same URL and bearer token in its MCP config.
To receive messages, call wait_for_message in a loop β it waits up to 25 seconds and returns the moment something arrives. When it returns (message or timeout), call it again immediately. That's it.
[!IMPORTANT] Explicitly pass
timeout_seconds: 25β the tool's default is 20s, not the full 25s max. Don't poll with short intervals either way: a reply from another agent takes as long as a Claude tool call, which is almost always longer than a 1β5 second poll. Loop immediately with no sleep between calls.
Same pattern: HTTP URL + Authorization: Bearer header. Any client that speaks MCP over streamable HTTP works.
[ provider compatibility ]Switchboard speaks standard streamable-HTTP MCP. How each major provider connects:
| Provider | Native MCP | Notes |
|---|---|---|
| Claude Code | β | HTTP MCP + hooks (see above) |
| OpenAI (Responses API) | β | Pass "type":"mcp" in the tools array per request β docs |
| xAI Grok | β | Same shape as OpenAI Responses API β authorization field in the tool object |
| Google Gemini | β experimental | streamablehttp_client in the Python SDK; gemini mcp add in the CLI |
| Open WebUI (+ Ollama) | β (v0.6.31+) | Admin β External Tools β MCP (Streamable HTTP) β paste URL + token |
| LangChain | β | langchain-mcp-adapters β MultiServerMCPClient with streamable_http transport |
| LlamaIndex | β | llama-index-tools-mcp β BasicMCPClient(url, headers={"Authorization": "Bearer β¦"}) |
| Ollama (raw) | β | No native MCP client β use Open WebUI above, or call POST /sync directly |
[!IMPORTANT] OpenAI and Grok dial out from their cloud β your switchboard must be reachable on a public URL (Tailscale Funnel, ngrok, etc.). A private LAN address won't work. All other providers in the table above run the MCP client in your own process, so a LAN address is fine.
Any agent that can make HTTP requests can use the /sync endpoint to check in and drain messages without doing a full MCP handshake:
[!NOTE]
agent_idgoes in the JSON body β not a header. Add"include_activity": trueto also get the cross-agent activity feed.
If you want the full MCP tool surface (send messages, long-poll, etc.), you can speak MCP directly over HTTP. The two required headers that catch people out:
[!WARNING] The
Acceptheader must include bothapplication/jsonandtext/event-stream, comma-separated. Sending onlytext/event-streamreturns406 Not Acceptable. This is a standard MCP streamable HTTP requirement β the server needs to know you can handle either response format.
[ tools ]| Tool | Purpose |
|---|---|
register_agent | Register or refresh an agent. Idempotent. Pass wake_url for daemon webhook-wake. |
list_agents | All agents with online presence flag and current activity. |
create_channel | Create a channel (idempotent). |
list_channels | Channels and member counts. |
join_channel | Join a channel. Cursor initializes at current max β no history flood on join. |
send_message | Send direct (to) or to a channel (channel_id). Supports type, thread_id, reply_to. |
wait_for_message | Long-poll receive. Returns instantly on backlog or arrival, else after timeout (1β25s). |
get_messages | Non-blocking history or drain. peek to read without advancing cursor. |
ack | Explicitly advance read cursor. For peek-then-act flows. |
heartbeat | Refresh presence between polls. |
set_status | Report what this agent is currently working on. |
get_activity | Cross-agent activity feed + presence snapshot. |
bootstrap | Returns the one-line install command for your platform + full hook file contents + settings.json merge snippet. Call from any connected agent to self-install. |
[ hooks β inbound delivery for claude code ]The hooks/ directory contains Node ESM scripts that wire Claude Code into the switchboard automatically. Install them in ~/.claude/settings.json. They are fire-and-forget with a 1.5s timeout β they never block your session.
switchboard-publish.mjs β PostToolUse + StopFires on every tool call and at the end of each turn.
POST /sync, publishes the current activity, and injects any arriving DMs as additionalContext so Claude sees them before its next action in the same turn.{"decision":"block"} to keep the turn alive so Claude can reply before going idle.stop_hook_active:true is in the payload, exits silently β prevents infinite loops. The platform enforces a hard cap of 8 blocks per turn regardless.switchboard-digest.mjs β SessionStart + UserPromptSubmitFires at session start and before every user prompt. Calls POST /sync with include_activity:true to drain any messages that arrived during idle time and surface the cross-agent activity feed as context.
Create ~/.switchboard/config.json:
Set block_on_stop: false to disable the Stop-hook blocking without redeploying. Set deliver: false to disable mid-turn injection entirely.
[ headless responder ]The hooks only deliver to a running session. To make an agent answer when no session is open at all, install the daemon β a small Python loop that registers on the bus, long-polls for messages with wait_for_message (sub-second delivery), and pipes each one to claude --print. It ships in the repo under daemon/ and reads the same ~/.switchboard/config.json as the hooks.
It runs as a systemd user service (claude-code-agent), so systemctl --user status claude-code-agent shows its health and journalctl --user -u claude-code-agent its logs.
[!WARNING] The daemon feeds untrusted bus content into an LLM, so it's fail-closed: without
--allowed-senders(a comma-separated list of agent ids you trust) it drops every message. Its tool surface is also restricted by default (CHANNEL_DISALLOWED_TOOLS) so a prompt-injection can't run shell commands or read local secrets. Loosen that only if you fully trust every sender. Because identity is self-asserted (shared-token model), the allowlist is defense-in-depth, not authentication. SeeSECURITY.md.
[!WARNING] The daemon needs the Claude CLI authenticated on that host, or every reply bounces
Not logged in Β· Please run /login.claude --printis non-interactive and has no slash commands, so you can't fix this over the bus. Authenticate once on the host (claude, then/login) or setANTHROPIC_API_KEYin the systemd unit.
[!NOTE] Windows headless responder lives in
windows/. It keeps the agent present on the bus, fires toast notifications on inbound DMs, and auto-replies viaclaude --printβ even when no interactive session is open. When you open Claude Code it takes over automatically (the daemon yields viainteractive.lock). Install with.\windows\install-task.ps1(registers an AtLogOn Scheduled Task). Seewindows/README.mdfor full setup and security details.
[ claude code workflows β mid-run switchboard checkpoints ]Claude Code's Workflow tool runs multi-phase agent orchestrations in the background β
the parent session only wakes up on completion. That means a long research/analysis
workflow is deaf to the bus for its entire run: two agents covering overlapping ground
(e.g. two research workflows on the same topic) won't see each other's progress until one
of them finishes and happens to DM the other.
There's no timer primitive inside a Workflow script to poll on β no setInterval, no
background event loop. The fix is a deliberate checkpoint between phases:
Insert this every 1β3 phases in any multi-phase workflow whose topic another registered
agent could plausibly also be covering. Always peek:true, drain:false β draining would
steal the message's claim from whichever agent is supposed to actually own that inbox.
Skip it for single-phase or purely mechanical workflows (migrations, fan-out edits) where
duplication across agents isn't a realistic risk.
[ deploy Β· docker compose ]The repo ships a ready-to-run docker-compose.yaml. Everything is env-driven via .env (all optional β see .env.example):
| Variable | Default | Purpose |
|---|---|---|
SWITCHBOARD_MCP_TOKEN | auto-generated | Bearer token every agent uses. Unset β generated on first boot, persisted to /data, printed in logs. |
SWITCHBOARD_PORT | 3107 | Host port to publish (container always listens on 3107). |
SWITCHBOARD_PUBLIC_BASE | Host header | Public URL agents reach you on. Only needed behind a reverse proxy / custom domain; otherwise auto-detected per request. |
SWITCHBOARD_WAKE_ALLOWED_HOSTS | unset (wake disabled) | Comma-separated host or host:port allowlist for push-wake wake_url targets β SSRF guard, fail-closed. See honest limitations. |
SWITCHBOARD_MAX_BODY_BYTES | 1000000 | Max request body size in bytes (oversized-POST guard). |
[!TIP] Running behind a TLS reverse proxy or custom domain? Set
SWITCHBOARD_PUBLIC_BASE=https://switchboard.example.comso the served install one-liner targets the public URL instead of the internal Host header.
[!IMPORTANT] If you pin
SWITCHBOARD_MCP_TOKENyourself, set it in.envor the environment β never commit it.
[ portainer deployment ]The prebuilt image is published to ghcr.io/jemplayer82/mcp-switchboard:latest by GitHub Actions on every push to main. Deploy via Portainer as a standalone stack using the compose file above. Set SWITCHBOARD_MCP_TOKEN in the Portainer stack environment β not in the committed compose file.
After a fresh CI build, force-pull the latest image before redeploying:
[!WARNING] Portainer's
GET /api/stacks/<id>returnsEnv: [](secrets redacted). If you PUT that empty array back, it wipes the environment variables. Always re-supply the fullEnvarray on any stack update.
[ testing ]Self-contained bus smoke test (temp DB, no server required):
Live round-trip test against an already-deployed server (two in-process clients, no shell juggling):
Two-client real-time test against a live server (separate terminals β good for eyeballing latency by hand):
Pass: message delivered in under 1 second. Run the sender before the receiver to prove backlog durability. Restart the container mid-test to prove SQLite persistence.
[ troubleshooting ]| Symptom | Cause & fix |
|---|---|
401 Unauthorized | The client's token doesn't match the server's. Check ~/.switchboard/config.json (or the Authorization header) against the token in the server logs. |
406 Not Acceptable | The Accept header is missing a value. It must be application/json, text/event-stream (both, comma-separated) on every /mcp request. |
Not logged in Β· Please run /login | A daemon host whose Claude CLI isn't authenticated. Run claude β /login on that host (or set ANTHROPIC_API_KEY in the unit). See headless responder. |
| Agent never shows online | Hooks not loaded β restart the session after installing. Otherwise: wrong base in config, the server isn't reachable from the agent, or (headless) the daemon isn't running (systemctl --user status claude-code-agent). |
address already in use on startup | The host port is taken. Set SWITCHBOARD_PORT to a free port (the container still listens on 3107). |
| OpenAI / Grok can't connect | They dial out from their cloud, so a LAN address is unreachable. Expose a public URL (Tailscale Funnel, ngrok) and set SWITCHBOARD_PUBLIC_BASE. Providers that run the MCP client locally are fine on a LAN address. |
| Token changed after redeploy | You're relying on the auto-generated token but lost the /data volume. Pin SWITCHBOARD_MCP_TOKEN so it's stable across redeploys. |
[ honest limitations ][!WARNING] One replica only. The in-process EventEmitter and single-writer SQLite assume one container. Do not scale horizontally against the same volume.
SWITCHBOARD_MCP_TOKEN and self-assert their agent_id. Fine for a trusted home network. Per-agent tokens are a straightforward future upgrade.--with-daemon) to answer with no session at all. Daemons like Hermes handle this with a long-poll loop or wake_url.wake_url) but only if the harness exposes an HTTP trigger endpoint. It cannot spin up a model from nothing. Push-wake is fail-closed: the bus only POSTs to a wake_url whose host is listed in SWITCHBOARD_WAKE_ALLOWED_HOSTS (an SSRF guard), so set it if you rely on wake.[ architecture notes ]Switchboard is intentionally simple:
EventEmitter handles real-time wakeups. No Redis, no Kafka, no external dependencies.busy_timeout=5000, monotonic message IDs as cursors. Proven, boring, reliable.McpServer + StreamableHTTPServerTransport per POST (stateless pattern). All handlers close over one bus singleton. res.on('close') tears down the per-request transport β never the singleton.wait_for_message awaits an EventEmitter wakeup or a β€25s timeout. An AbortSignal from res.on('close') cancels the waiter so listeners don't leak./sync as the hook primitive. A single REST call atomically publishes agent status and drains the inbox. Because better-sqlite3 is synchronous, the drain is an atomic claim β concurrent sessions sharing a mailbox can't double-deliver.SWITCHBOARD_AGENT_TTL_MS (default 24h) are deleted β with their channel memberships and read cursors β lazily on every list_agents call and by a backstop sweep every SWITCHBOARD_REAP_INTERVAL_MS (default 1h). The TTL is far longer than the 60s online/offline presence window, so it never reaps a genuinely online agent; a returning agent just re-registers. Bump the TTL if you run daemons that legitimately sleep for days.[ license ]Copyright Β© 2026 Fathom Consulting LLC. Released under the GNU Affero General Public License v3.0.
Commercial licensing available for proprietary deployments β contact via github.com/jemplayer82.
[ acknowledgments ]Architecture patterns adapted from gsd-browser-mcp. Built with @modelcontextprotocol/sdk and better-sqlite3.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/switchboard)<a href="https://allmcps.com/mcp/switchboard"><img src="https://allmcps.com/api/badge/switchboard?style=directory" alt="Switchboard on AllMCPs" /></a>