Claude Code Bridge
Claude Code Bridge
Connect to Claude Code through PandaNpc β two connection modes for different scenarios.
Connection Modes
| Mode | Scenario | Port Required |
|---|---|---|
| Relay (recommended) | Claude runs on another machine, connect via relay | No |
| Local | Claude runs on this machine | No |
Relay Mode (Recommended)
Best for: Your Claude runs on a home PC / server, and you want to access it from anywhere β phone, laptop, office β without opening any ports.
Your PC (cc-bridge) ββoutbound WSSβββΆ Relay Server βββoutbound WSSββ PandaNpcApp
cc.pandanpc.com
Both sides connect OUT. Zero ports opened. Works behind any firewall/NAT.
Step 1: Install cc-bridge on your server
macOS / Linux:
curl -fsSL https://pandanpc.com/cc-bridge/install.sh | sh
Windows (PowerShell):
iwr https://pandanpc.com/cc-bridge/install.ps1 -UseB | iex
After installation you'll see:
=== cc-bridge installed (relay mode) ===
Bridge ID: bridge-a1b2c3d4
Token: 77a1449c3119aa87e16b95b13c40d03f...
Open PandaNpcApp -> New Connection -> Relay mode
Copy the Bridge ID and Token.
Step 2: Connect from PandaNpcApp
- Open PandaNpc β Claude Code page
- Click New Connection
- Select Relay mode
- Fill in:
- Bridge ID: the ID shown after install (e.g.
bridge-a1b2c3d4) - Token: the token shown after install
- Working Directory: the remote directory for Claude to work in
- Bridge ID: the ID shown after install (e.g.
- Click Create & Connect
Session Resume
If you refresh the page or lose connection:
- Within 5 minutes: Reconnects to the same Claude process β context fully preserved, last 50 messages replayed
- After 5 minutes: Starts a new Claude with
--resumeβ loads conversation history from disk
No manual action needed. PandaNpcApp automatically attempts resume on reconnect.
Local Mode
Best for: Running Claude directly on the machine where PandaNpcApp is installed. Simplest setup, zero network.
Prerequisites
Install Claude Code CLI:
claude --version
Usage
- Open PandaNpc β Claude Code page
- Click New Connection
- Select Local mode
- Working Directory: click "Browse" to select a folder
- Click Create & Connect
PandaNpc spawns Claude as a local subprocess. No network, no ports, no bridge needed.
Security
Relay mode
| Layer | Purpose |
|---|---|
| Bearer Token | Only those with the token can connect to your bridge |
| TLS (WSS) | All traffic encrypted between bridge β relay β app |
| Session isolation | Each bridge has a unique ID, sessions cannot cross bridges |
Who can't connect?
| Scenario | Result |
|---|---|
| No token | β Rejected |
| Wrong Bridge ID | β Bridge not found |
| Wrong token | β Unauthorized |
| PandaNpcApp + correct Bridge ID + Token | β Connected |
Token Management
- Lost? Re-run the install script β it reuses existing token from
.env - Compromised? Stop service β delete
.envβ re-run install script - Rotation? Recommended every 90 days
Service Management
macOS
launchctl list | grep cc-bridge # status
launchctl unload ~/Library/LaunchAgents/com.pandanpc.cc-bridge.plist # stop
launchctl load ~/Library/LaunchAgents/com.pandanpc.cc-bridge.plist # start
Linux
systemctl --user status cc-bridge # status
systemctl --user restart cc-bridge # restart
systemctl --user stop cc-bridge # stop
Windows
Get-ScheduledTask PandaNpc-cc-bridge # status
Start-ScheduledTask PandaNpc-cc-bridge # start
Stop-ScheduledTask PandaNpc-cc-bridge # stop
Uninstall
# macOS / Linux
curl -fsSL https://pandanpc.com/cc-bridge/uninstall.sh | sh
# Windows
Stop-ScheduledTask PandaNpc-cc-bridge
Unregister-ScheduledTask PandaNpc-cc-bridge -Confirm:$false
Remove-Item -Recurse $env:USERPROFILE\.pandanpc\cc-bridge
Troubleshooting
"Bridge not online"
Check if cc-bridge is running on your server:
# macOS / Linux
tail -f ~/.pandanpc/cc-bridge/logs/stderr.log
# Windows
Get-Content $env:USERPROFILE\.pandanpc\cc-bridge\logs\output.log -Tail 20
Look for Registered as bridge: <your-id>. If missing, the relay connection failed.
Connection drops frequently
- Check network stability between cc-bridge and relay server
- cc-bridge automatically reconnects every 5 seconds on disconnect
- PandaNpcApp auto-reconnects up to 5 times with 3-second intervals
Service won't start
Common causes:
- Claude CLI not in PATH β set
CLAUDE_BIN=/full/path/to/claudein.env - Relay server unreachable β check network / firewall for outbound WSS
Wrong token
Verify the token in PandaNpc matches CC_TOKEN in ~/.pandanpc/cc-bridge/.env