Claude Relay
Real-time communication between Claude Code instances across multiple machines via WebSocket + MCP.
What This Does
Enables Claude Code sessions on different machines to send messages to each other in real-time. Useful for:
Context sharing - Share findings, file contents, or investigation results between sessions
Task handoffs - Start a task on one machine, continue on another
Coordination - Let one Claude Code instance know what another is doing
Architecture
Installation
Quick Start
1. Start the Relay Server (on one machine)
2. Configure Claude Code (on each machine)
Add to your Claude Code MCP configuration:
Set a unique RELAY_CLIENT_ID for each machine (e.g., "LAPTOP", "DESKTOP", "M1", "M2").
3. Connect Remote Machines via SSH Tunnel
If machines aren't on the same network, use SSH port forwarding:
MCP Tools
Once configured, Claude Code will have these tools:
Tool | Description |
| Send a message to peer Claude Code instance(s) |
| Get recent messages from peers |
| List currently connected instances |
| Check connection health |
Example Usage
Send a message:
Check for messages:
See who's online:
macOS Auto-Start (LaunchAgent)
Relay Server (on server host)
SSH Tunnel (on remote machines)
Testing
Use the interactive test client:
Configuration
Environment Variables
Variable | Default | Description |
|
| Port for relay server |
| hostname | Identifier for this instance |
|
| Relay server WebSocket URL |
Command Line Arguments
Files
File | Description |
| WebSocket relay server |
| MCP protocol server for Claude Code |
| Interactive test client |
| macOS LaunchAgent for relay server |
| macOS LaunchAgent for SSH tunnel |
Troubleshooting
Connection refused:
Ensure relay server is running:
lsof -i :9999If using SSH tunnel, verify it's active:
ps aux | grep ssh
MCP tools not appearing:
Restart Claude Code after adding MCP config
Check MCP server is connecting: look for "Connected!" in logs
Messages not arriving:
Use
relay_peersto verify both instances are connectedCheck message history with
relay_receive
Security Notes
The relay server has no authentication by default
Designed for trusted local networks or SSH tunnels
All traffic over SSH tunnel is encrypted
Don't expose port 9999 to the internet without adding authentication
License
MIT