claude-code-relay

claude-code-relay

Relay messages between Claude Code sessions over MCP without stealing window focus, enabling background communication between parallel sessions.

Category
Visit Server

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:

  1. listens on a local HTTP port, and
  2. pushes any received message into its own conversation via the notifications/claude/channel notification.

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-channels and the claude/channel capability. 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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured