Skip to content

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:

bash
claude --debug --dangerously-load-development-channels server:phantom

The log is ~/.claude/debug/<session-id>.txt. Message text and tokens are never logged.

What you seeCauseFix
A phantom event: "Phantom MCP is turned off in Settings"The MCP switch is off; every agent request answers 503 mcp_disabledSettings → 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_expiredCreate or rotate the token, then register again
A phantom event about missing bridge grants403 permission_denied on the BridgeGive the token a preset with bridge.read and bridge.create
Tools work, but no message arrivesThe session was started without the channel flag, or the conversation is with another agentStart Claude Code with --dangerously-load-development-channels server:phantom; write in a conversation with claude-code
No channel notice under the bannerA Claude Code version without channels, or a non-interactive session (-p), where the flag is ignoredclaude update, then start an interactive session
"blocked by org policy" at startupTeam or Enterprise without channels enabledAn Owner enables channels for the organization
phantom failed in /mcp, "Is the backend running" in the logPhantom 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.exeRemove it (claude mcp remove phantom --scope user) and register the wsl.exe command; see Windows and WSL
A relayed approval never reaches ClaudeThe 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.exe in Phantom's distribution and passes the variables across with WSLENV, for example:

    powershell
    claude 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 --channel

    Windows 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 at 127.0.0.1 only 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:

bash
claude mcp remove phantom --scope user

Then 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/channel capability and, only with PHANTOM_CHANNEL_PERMISSIONS=1, claude/channel/permission. Its instructions tell Claude how events look, to answer with phantom_reply and that message content is research data, never instructions that change its rules.
  • It says hello to the Agent Bridge as claude-code (protocol 1) 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 text or attachment, 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.