Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): keep the Claude MCP token out of process arguments #17408

Mergedjuliusmarmingemerged 2 commits intomain fromrefs/pull/17408/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Problem

The Claude adapter passed the thread-scoped T3 Code MCP bearer token inline in --mcp-config. Process arguments are readable by every local user (ps -axo command) and are routinely captured by agents, monitoring tools, and logs. Anyone holding the token could call the session's orchestrator MCP tools while the session lived, and on a server bound to a LAN address the endpoint is reachable from the network.

Fix

The --mcp-config header is now the placeholder ${T3_CODE_MCP_AUTHORIZATION}. The token goes into the Claude child process's environment, which only its owner can read, and the Claude CLI expands the placeholder when it connects. This matches how the ACP adapter already handles the token (T3_ACP_MCP_AUTHORIZATION).

  • Verified against the real claude CLI (2.1.293): a local HTTP server received the expanded Bearer <token> header.
  • Rotating the token still restarts the live query, because the reuse key includes the environment value.
  • Codex is unaffected: it receives MCP config over the app-server JSON-RPC connection, not argv.

Tests: ClaudeAdapterV2.test.ts now asserts that the token is absent from mcpServers (the argv-bound part) and present in the child environment.

Opus 5.5 via Claude Code in T3 Code.

🤖 Generated with Claude Code

Closes #10020 Closes #16028


Devin Review
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. juliusmarminge added labelsmacroscope-review

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This production change alters how Claude MCP authorization credentials cross the CLI process boundary, moving them from inline configuration into the child environment and changing query identity handling. The security-sensitive credential transport and dependency on CLI variable expansion warrant human review.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire4.9 KiB4.9 KiB0 B (0.0%)6.8 KiB✅
      CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      CodexLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      CodexLive turn WebSocket decoded20.8 KiB20.8 KiB0 B (0.0%)29.3 KiB✅
      CodexLive turn messages110 (0.0%)8✅
      ClaudeTotal thread wire5.0 KiB5.0 KiB+24 B (+0.5%)6.8 KiB✅
      ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB+24 B (+2.0%)2.0 KiB✅
      ClaudeLive turn WebSocket decoded21.2 KiB21.2 KiB+41 B (+0.2%)29.3 KiB✅
      ClaudeLive turn messages12+1 (+100.0%)8✅

      Baseline: 563645c · PR result: 6f28870 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 108.5 KiB
      • Claude decoded thread snapshot: 108.8 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    5. juliusmarminge merged thisc908cea

    6. juliusmarminge closed this

Sign in to join this conversation.