Skip to content

Claude intercept: loopback MCP servers fail with 405 because settings.json HTTPS_PROXY has no NO_PROXY #6936

Closed

Description

@lidge-jun

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/list returns 83 tools
  • curl -x http://127.0.0.1:10200 to 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-CONNECT requests are answered with 405. Loopback CONNECT targets are also refused with 403 (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:

  1. Ensure env.NO_PROXY contains 127.0.0.1, localhost and ::1. Merge into any existing user value instead of overwriting it, and do not add duplicates.
  2. Keep the existing ownership model: track only the entries OpenCodex added, so remove/uninstall strips just those and leaves a user's own NO_PROXY entries (and the key, if it pre-existed) intact. A value of * already covers loopback; leave it alone.
  3. inspect/stale detection should treat a missing loopback bypass as stale on an owned block, so existing installs get repaired on the next apply or upgrade.
  4. 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

  1. added
    bug
    proxy
    on Oct 11, 2026
  2. added
    tools
    on Oct 11, 2026
  3. lidge-jun commented on Oct 11, 2026

    @lidge-jun
    OwnerAuthor

    Fixed on dev by #6938 (squash 49e50cc). Every CI check on its final head 3588bb4 completed green before the merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugproxytools

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions