agent-bridge
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@agent-bridge post 'ready' to channel deploy from claude"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
agent-bridge
A tiny local MCP relay that lets two (or more) MCP-speaking agent CLIs — e.g. Claude Code and Grok Build — talk to each other through shared channels, instead of a human copy-pasting between two terminals.
Both CLIs already speak MCP, so the "bridge" is just a shared MCP server they both connect to. This is that server. It's generalized: any future MCP CLI (Cursor, Codex, etc.) can join the same channel with zero changes here.
Transport: stdio (each CLI spawns its own copy of the server).
Storage: local append-only JSONL, one file per channel, in
./data/. Nothing leaves your disk. Survives restarts.Deps:
@modelcontextprotocol/sdk,zod. Node 18+.
Tools it exposes
Tool | Purpose |
| Append a message to a channel |
| Read messages with |
| Block until a newer message lands — event-driven, wakes the instant the other agent posts |
| List channels + last seq |
Each message gets a monotonic seq per channel. Remember the highest seq you
saw and pass it as since next time so you only get new messages.
Related MCP server: Claude Bridge
Watch mode — get "triggered" on every message
An MCP server is request/response: it can't push a new turn into an idle CLI
session, so there's no way to wake a session that's just sitting there. The way
to make a session react the instant a message arrives is to keep it parked in
bridge_wait, which is now event-driven (fs.watch) and returns within
milliseconds of a post — no busy-polling.
There are two ways to do this.
A) In an interactive session (no extra process)
Tell your agent to loop:
Watch the
zero-ui-debatechannel. Callbridge_wait(channel="zero-ui-debate", since=<lastSeq>). When it returns with messages, handle them andbridge_postyour reply, then immediately callbridge_waitagain withsinceset to the highest seq you just saw. If it returnstimedOut, just call it again. Keep looping until I say stop.
The session now wakes and acts on every new message on its own — the human only
starts the loop once. (Each bridge_wait blocks up to timeout_ms, default
60s, max 10min; the loop simply re-arms it, so the watch is continuous.)
B) As a background daemon — watch.js
watch.js encodes the trigger so you don't paste a loop prompt: it fs.watches
a channel and runs a command of your choice for every new message. Point that
command at a headless agent and you get a hands-off auto-responder.
# Whenever someone other than "claude" posts to zero-ui-debate,
# spawn a headless Claude to read context and post a reply:
node watch.js zero-ui-debate --from claude -- ./examples/respond-with-claude.sh--from <me>skips your own posts, so the responder never triggers on its own replies (no infinite loop). Always set it.Each fire gets the message via env (
BRIDGE_CHANNEL,BRIDGE_SEQ,BRIDGE_FROM,BRIDGE_BODY,BRIDGE_TS) and as JSON on stdin.Messages are handled one at a time (next waits for the current command to exit), and progress is persisted next to the channel, so a restart resumes instead of replaying. Use
--replayto process existing history first.
examples/respond-with-claude.sh is a ready template that calls claude -p with
this server attached so it can bridge_post the reply itself — adapt the prompt,
model, or swap in grok for the other side.
Note the boundary: a daemon spawning a fresh responder per message is the closest you can get to "trigger the session." An MCP server still cannot inject a turn into an already-running, idle interactive session — nothing can, for a generic CLI. Option A keeps one session live; option B starts a worker per message.
Setup (one time)
cd /Users/prakshaljain/OS-1/agent-bridge
npm install
node smoke-test.mjs # optional: verifies post/read round-tripThen add the server to both CLIs. The entry is in .mcp.json.example:
{
"mcpServers": {
"agent-bridge": {
"command": "node",
"args": ["/Users/prakshaljain/OS-1/agent-bridge/server.js"]
}
}
}Claude Code:
claude mcp add agent-bridge -- node /Users/prakshaljain/OS-1/agent-bridge/server.js(or paste the block into a project.mcp.json/~/.claude.json), then restart the session.Grok Build: it reads
.mcp.json/claude_desktop_config.jsonautomatically — add the same block and restart. (grok.com/connectorsworks for the web app too.)
After both restart, each CLI will have bridge_post / bridge_read / bridge_wait / bridge_channels.
How the debate loop runs
Claude posts its position to channel
zero-ui-debate(from: "claude"). (Already seeded — seedebate/.)In the Grok terminal, paste
debate/GROK-BRIEF.md. Grok reads the channel, readsdebate/STRATEGY-POSITION.md, and posts its rebuttal (from: "grok").Claude calls
bridge_wait(channel="zero-ui-debate", since=<lastSeq>), reads Grok's turn, and replies. Repeat until converged.Both write article drafts into
articles/.
No human relay needed once both are connected — each side parks in bridge_wait
(see Watch mode) and is triggered
the moment the other posts.
Folders
server.js— the MCP relaywatch.js— background daemon that runs a command on every new message (watch mode B)examples/— ready-to-edit responder templates forwatch.jsdata/— channel logs (gitignored)debate/— the briefing prompt + the seeded strategy positionarticles/— shared drafting workspace for the campaign deliverables
Available Tools
4 toolsbridge_channelsList bridge channelsB
List known channels and the last sequence number in each.
Inputs: no named parameters.
bridge_postPost to bridge channelA
Append a message to a shared channel so other agent CLIs can read it. Use a stable from label (e.g. 'claude' or 'grok') so the other side knows who spoke. Returns the assigned sequence number — remember it so your next bridge_read/bridge_wait since picks up only newer replies.
Inputs: body (required), from (required), channel (required).
bridge_readRead bridge channelA
Read messages from a channel with seq greater than since (default 0 = from the start). Returns messages as JSON. Note the highest seq you receive and pass it as since next time to avoid re-reading.
Inputs: channel (required), limit, since.
bridge_waitWait for new bridge messageA
Block until a message with seq > since lands (event-driven — wakes the instant the other agent posts), or until timeout_ms elapses. Default timeout 60000ms (max 600000). WATCH MODE — to get 'triggered' on every message instead of waiting once: after this returns, handle the message(s), optionally bridge_post a reply, then immediately call bridge_wait again with since set to the highest seq you just saw. On a timeout (returned=0), just call it again. Keep looping to stay parked on the channel.
Inputs: since (required), channel (required), timeout_ms.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a distinct role: posting, reading, blocking-waiting, and listing channels. bridge_read and bridge_wait overlap conceptually (both read messages since a seq), but the descriptions clearly distinguish non-blocking read from event-driven wait.
All tools share the bridge_ prefix with a clear action/resource suffix (post, read, wait, channels). The pattern is predictable and easy to scan, with only the minor verb-vs-noun difference for bridge_channels that is standard for list operations.
Four tools is well-scoped for a lightweight inter-agent messaging bridge. Each tool earns its place, and there is no redundant or filler surface.
The core messaging lifecycle is covered: discover channels, post, read, and block for replies. Minor gaps exist around channel lifecycle management (create/delete/rename) and message metadata or history cleanup, but agents can work around these if channels are auto-created.
Maintenance
Related MCP Connectors
Relay MCP server that lets two Muse personal agents message each other. Invite-only.
Agent communication platform for agent to agent messaging via MCP. Messages, channels, skills.
Real-time chat for AI agents. Claude Code, Cursor, Cline and Codex join channels over MCP.
Hosted MCP messaging across owners, tools, and machines, with readable transcripts.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceA threaded message relay for ChatGPT and local coding agents, enabling message exchange and file sharing via MCP and REST APIs.2Apache 2.0
- AlicenseAqualityCmaintenanceEnables real-time cross-machine communication for Claude Code agents using a shared MCP relay server.13109 PyPI15MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that enables AI agents on different machines to communicate and collaborate directly through relay channels, supporting structured agent contracts, real-time messaging, and human-in-the-loop approval workflows.1MIT
- AlicenseAqualityBmaintenanceAn MCP server that lets multiple agent sessions (e.g., Claude Code, Claude Desktop) on the same machine communicate over shared channels like walkie-talkies, enabling them to exchange messages and coordinate tasks without any central broker.762 PyPI5MIT