Repository navigation
Description
Problem
When Claude intercept / first-party mode is on, OpenCodex writes this into ~/.claude/settings.json:
"env": {
"HTTPS_PROXY": "http://opencodex:<token>@127.0.0.1:<proxy port>",
"NODE_EXTRA_CA_CERTS": "<configDir>/claude-intercept/ca.pem"
}There is no NO_PROXY. Claude Code (2.1.296, agent-sdk 0.3.276) then sends local HTTP MCP traffic through the intercept proxy as well, including servers on http://127.0.0.1:<port>/mcp. The intercept proxy only accepts CONNECT, so a forwarded POST http://127.0.0.1:... gets an empty 405 Method Not Allowed. Claude reports the server as failed with Connection failed (405): Error POSTing to endpoint:.
The visible effect: every app-injected loopback MCP server is silently dead for Claude sessions. For example, GOAT/T3 Code inject their orchestration MCP server at http://127.0.0.1:3773/mcp, and 12 of 12 recorded Claude sessions showed it as failed, so Claude agents could never create threads or delegate.
Evidence
Claude Code MCP log (~/Library/Caches/claude-cli-nodejs/<cwd>/mcp-logs-goat/*.jsonl):
Environment: {"HTTP_PROXY":"not set","HTTPS_PROXY":"http://127.0.0.1:10200","NO_PROXY":"not set"}
initialize POST rejected (Error POSTing to endpoint: ); trying legacy HTTP+SSE
legacy HTTP+SSE not confirmed (SSE error: Non-200 status code (405)); surfacing the POST failure
Connection failed after 35ms (405): Error POSTing to endpoint:
Reproduction with the same authenticated initialize request:
- direct to
127.0.0.1:3773/mcp:200, session created,tools/listreturns 83 tools curl -x http://127.0.0.1:10200to the same URL:HTTP/1.1 405 Method Not Allowed,Content-Length: 0
Workaround verified: adding "NO_PROXY": "127.0.0.1,localhost,::1" to the env block makes Claude log NO_PROXY: 127.0.0.1,localhost,::1 and reach the loopback server directly. With a dummy token it now gets the server's own 401 invalid_mcp_credential instead of the proxy's 405.
Root cause (origin/dev 9b6f4b2)
src/claude/intercept/settings.ts:CLAUDE_INTERCEPT_MANAGED_ENV = ["HTTPS_PROXY", "NODE_EXTRA_CA_CERTS"]. Nothing excludes loopback from the proxy.src/claude/intercept/connect-proxy.ts:176: non-CONNECTrequests are answered with405. LoopbackCONNECTtargets are also refused with403(isLoopbackTarget), so the proxy can never serve loopback anyway; routing loopback to it is always wrong.
Proposed fix
When OpenCodex applies the intercept env, make sure Claude bypasses the proxy for loopback:
- Ensure
env.NO_PROXYcontains127.0.0.1,localhostand::1. Merge into any existing user value instead of overwriting it, and do not add duplicates. - Keep the existing ownership model: track only the entries OpenCodex added, so remove/uninstall strips just those and leaves a user's own
NO_PROXYentries (and the key, if it pre-existed) intact. A value of*already covers loopback; leave it alone. inspect/staledetection should treat a missing loopback bypass as stale on an owned block, so existing installs get repaired on the next apply or upgrade.- Tests for apply, re-apply idempotence, merge with a pre-existing user
NO_PROXY, and removal.
Optional hardening: answer non-CONNECT requests with a short explanatory body instead of an empty 405, so the failure is diagnosable from client logs.
Activity
fix(claude): bypass the intercept proxy for 0.0.0.0 too (#6936)
fix(claude): keep loopback MCP servers off the intercept proxy with N…
lidge-jun commentedon Oct 11, 2026
Fixed on dev by #6938 (squash 49e50cc). Every CI check on its final head 3588bb4 completed green before the merge.
fix(claude): keep the NO_PROXY receipt across a failed removal, and d…