claude-code-bridge

Coding-agent sessions across machines, over plain SSH

Let one coding-agent session message another machine's session over SSH. No cloud relay, no shared account.

How it works

The server runs locally as an MCP process. When you send a message, it runs ssh <peer> <command> -p --resume <session-id> and pipes the message to stdin. The remote session's stdout is the reply.

Session ids are stored per peer in a small state file. If the remote conversation is provably gone, the bridge retries once with a fresh session. A network error never resets the stored history.

agent (host)  >  stdio  >  cc_peer.py  >  ssh  >  agent -p (remote)

Features

Resumable conversations

The remote session continues across calls. Only a provably stale session is replaced.

Safe retries

Timeouts and unreachable hosts are returned as errors without touching the stored session.

sh and cmd peers

Correct quoting for POSIX and Windows peers. SSH binary fallbacks for common Windows installs.

Single file, no dependencies

Python standard library only. The self-test runs with a single command.

Quickstart

Requires Python 3.11+, the same agent CLI on both machines, and SSH key auth to the peer.

Install it, or run it directly with uvx:

$ pipx install claude-code-bridge-mcp==1.0.0
# or
$ uvx --from claude-code-bridge-mcp==1.0.0 cc-peer

Create ~/.cc-peer.json:

{
  "peers": {
    "my-server": {
      "ssh": "my-server",
      "shell": "sh",
      "cwd": "",
      "command": "agent",
      "args": [],
      "ssh_args": ["-o", "BatchMode=yes", "-o", "ConnectTimeout=10"],
      "timeout": 600
    }
  }
}

Register the server with your MCP client:

{
  "mcpServers": {
    "cc-peer": {
      "command": "uvx",
      "args": ["--from", "claude-code-bridge-mcp==1.0.0", "cc-peer"]
    }
  }
}

Then call list_peers() and send_message(peer="my-server", message="...").

Safety notes

  • Authenticate with SSH keys and BatchMode=yes. The bridge never handles passwords and stores no secrets.
  • Everything you send becomes input to the remote session. Do not pass credentials through it.
  • The bridge adds no permission-bypass flags on its own.