claude-code-relay
Relay messages between Claude Code sessions over MCP without stealing window focus, enabling background communication between parallel sessions.
README
claude-code-relay
Relay messages between Claude Code sessions over MCP — without stealing window focus.
Run several Claude Code sessions in parallel and let them message each other. A message
is injected into the target session's conversation in the background, as a <channel>
block — no keystroke paste, no window jumping to the foreground. You keep typing where you
are; the message just appears in the other session.
The problem
If you drive multiple Claude Code sessions at once, you eventually want them to talk — one hands work to another, or asks a question. The obvious way (paste into the target terminal) steals focus: the target window jumps to the front and your next keystrokes land in the wrong place. That makes genuine parallel work painful.
The approach
claude-code-relay uses Claude Code's experimental channel capability. Each session
runs a tiny MCP server that:
- listens on a local HTTP port, and
- pushes any received message into its own conversation via the
notifications/claude/channelnotification.
Delivery is a plain HTTP POST from the sender to the receiver's port. Background injection means the receive is focus-free.
session "alice" session "bob"
send.js ──HTTP POST 127.0.0.1:8802──▶ channel.mjs (MCP server)
│
▼ notifications/claude/channel
<channel source="claude-code-relay" from="alice">
hey, can you take the migration?
</channel> ← appears in bob's conversation
Quick start
npm install
cp ports.example.json ports.json # map session names -> ports
Register the receiver per project in .mcp.json, giving each session its own port via
RELAY_CHANNEL_PORT:
{
"mcpServers": {
"claude-code-relay": {
"command": "node",
"args": ["./channel.mjs"],
"env": { "RELAY_CHANNEL_PORT": "8801" }
}
}
}
Launch each Claude Code session with development channels enabled (experimental flag), on its own port:
RELAY_CHANNEL_PORT=8801 claude --dangerously-load-development-channels # session "alice"
RELAY_CHANNEL_PORT=8802 claude --dangerously-load-development-channels # session "bob"
Send a message from one session to another:
node send.js alice bob "hey, can you take the migration?"
It shows up in bob's conversation as a <channel> block. Bob replies the same way:
node send.js bob alice "on it"
Notes & caveats
- Experimental flag. This relies on Claude Code's
--dangerously-load-development-channelsand theclaude/channelcapability. Both are experimental and may change between releases. - Receive-only channel. The channel only delivers into a session; there is no reply
tool. Sessions reply by running
send.js. Typing in the window sends nothing. - Localhost only. Servers bind
127.0.0.1— this coordinates sessions on one machine. - ASCII session names are recommended (the sender name travels in an HTTP header).
- One port per session. A duplicate spawn on a taken port exits cleanly (no churn).
Verify it works
mcp-probe.mjs starts the receiver as a real MCP server (over stdio, exactly as Claude Code would), sends a message over HTTP, and asserts it comes back as a notifications/claude/channel notification — the full injection path, end to end:
npm test
# -> E2E PASS: HTTP POST -> channel.mjs -> notifications/claude/channel -> MCP client
The only thing this can't assert headlessly is the final UI render, which is Claude Code's job.
License
MIT © TEAM ROCK
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。