Claude Code: troubleshooting
What to check when the channel described in Claude Code does not deliver, how to rotate its token, and how it works.
Troubleshooting
The channel writes one status line per change to stderr; Claude Code keeps it in its debug log. Start with:
claude --debug --dangerously-load-development-channels server:phantomThe log is ~/.claude/debug/<session-id>.txt. Message text and tokens are never logged.
| What you see | Cause | Fix |
|---|---|---|
A phantom event: "Phantom MCP is turned off in Settings" | The MCP switch is off; every agent request answers 503 mcp_disabled | Settings → AI & Agents → Overview, turn the MCP server on. The channel notices by itself and says so |
A phantom event: "Phantom refused this connection's token" | 401 token_revoked, token_rotated or token_expired | Create or rotate the token, then register again |
A phantom event about missing bridge grants | 403 permission_denied on the Bridge | Give the token a preset with bridge.read and bridge.create |
| Tools work, but no message arrives | The session was started without the channel flag, or the conversation is with another agent | Start Claude Code with --dangerously-load-development-channels server:phantom; write in a conversation with claude-code |
| No channel notice under the banner | A Claude Code version without channels, or a non-interactive session (-p), where the flag is ignored | claude update, then start an interactive session |
| "blocked by org policy" at startup | Team or Enterprise without channels enabled | An Owner enables channels for the organization |
phantom failed in /mcp, "Is the backend running" in the log | Phantom not running, or PHANTOM_URL points at the wrong port (5173 is the interface, not the backend) | Start Phantom; register again with the command from Settings, which uses the backend's own port |
phantom failed in /mcp right away, or claude mcp get phantom says "Connection closed" | The registered Python or script path does not exist on the side where Claude Code runs, typically a /home/… path registered from Windows without wsl.exe | Remove it (claude mcp remove phantom --scope user) and register the wsl.exe command; see Windows and WSL |
| A relayed approval never reaches Claude | The relay is off, or the session has not received a message yet (the card goes to the conversation you last wrote from) | Register with PHANTOM_CHANNEL_PERMISSIONS=1; write once from Phantom first |
Windows and WSL
Claude Code launches the registered command on its own side. The command in Settings names the Python and the path of the machine that runs Phantom's backend:
Phantom and Claude Code both on Windows, or both in WSL: the command is right as shown.
Phantom in WSL, Claude Code on Windows: pick Windows under "Where do you run Claude Code?" in Settings (picked by default from a browser on Windows). The command starts the script through
wsl.exein Phantom's distribution and passes the variables across withWSLENV, for example:powershellclaude mcp add phantom --scope user --transport stdio --env PHANTOM_URL=http://127.0.0.1:8000 --env PHANTOM_MCP_TOKEN=<token> --env WSLENV=PHANTOM_URL:PHANTOM_MCP_TOKEN -- wsl.exe -d <distribution> -e <python> <checkout>/backend/mcp_server.py --channelWindows reaches a backend in WSL at
http://127.0.0.1:8000.Phantom on Windows, Claude Code in WSL: the paths are the other side's. Run Claude Code on Windows, or register by hand with a Python inside WSL that has the backend's dependencies and the checkout's
/mnt/c/…path. WSL reaches a backend on Windows at127.0.0.1only with WSL's mirrored networking.
The script needs the backend's Python dependencies (mcp, httpx), which the interpreter that runs Phantom already has.
Rotate or revoke
Rotating or revoking the token from its row in Settings → AI & Agents → Connections stops the channel at once (the open stream closes with token_rotated or token_revoked). After a rotation the result view shows the steps again with the new token. Remove the old registration:
claude mcp remove phantom --scope userThen run the registration command from the result view again and restart Claude Code with the channel flag.
How it works
backend/mcp_server.py --channel is an MCP server Claude Code starts over stdio (app/mcp/channel/):
- It declares the
claude/channelcapability and, only withPHANTOM_CHANNEL_PERMISSIONS=1,claude/channel/permission. Its instructions tell Claude how events look, to answer withphantom_replyand that message content is research data, never instructions that change its rules. - It says hello to the Agent Bridge as
claude-code(protocol1) and reads the event stream, resuming after the last event id on every reconnect, with backoff and a long-polling fallback. Nothing is pushed twice and nothing is skipped. - It pushes only messages whose sender is the Phantom user (identity comes from Phantom, never from the message), of type
textorattachment, still queued for this agent; each push is acknowledged. Text is stripped of control and direction-override characters and capped at 20 000 characters. - It relays every tool of Phantom's MCP endpoint, under the same agent, so one registration gives both.
- It speaks the MCP handshake protocol only. Claude Code does not register a channel that negotiates revision 2026-07-28, so the channel declines that revision and Claude Code connects on the earlier handshake.
Phantom's side is the Agent Bridge; the permission relay files an ordinary Bridge approval, decided by the user only.
Channels are a Claude Code research preview: the flag, the protocol and the requirements may change between Claude Code releases.