Bug: HTTP MCP client ignores no_proxy environment variable

Status Closed — not planned
Reported on v2.1.31
Maintainer reply None cached
Activity 5 comments · opened Feb 5, 2026 · closed Mar 10, 2026

Description

Claude Code's HTTP MCP client does not respect the no_proxy / NO_PROXY environment variable when connecting to MCP servers. Requests to localhost are routed through the corporate proxy instead of connecting directly.

Environment

  • Claude Code version: 2.1.31
  • OS: Linux (WSL2)
  • Node.js HTTP client creates HttpsProxyAgent for all requests

Reproduction Steps

  1. Set proxy environment variables:

``bash
export HTTP_PROXY=http://corporate-proxy:8080
export HTTPS_PROXY=http://corporate-proxy:8080
export no_proxy=localhost,127.0.0.1
``

  1. Configure an HTTP MCP server pointing to localhost:

``bash
claude mcp add --transport http myserver http://localhost:8080/mcp
``

  1. Attempt to connect:

``bash
DEBUG=* claude mcp get myserver
``

  1. Observe debug output shows proxy being used:

``
https-proxy-agent Creating new HttpsProxyAgent instance: 'http://corporate-proxy:8080/'
``

  1. Connection fails because proxy cannot reach localhost on the user's machine

Expected Behavior

Claude Code should respect no_proxy / NO_PROXY and connect directly to localhost/127.0.0.1 without using the proxy.

Actual Behavior

All HTTP MCP connections go through the proxy, ignoring no_proxy. This makes it impossible to use local MCP servers in corporate environments that require proxy for internet access.

Workaround

Currently none that preserves both proxy for internet and direct access for localhost.

Additional Context

  • curl respects no_proxy correctly in the same environment
  • The issue is in the Node.js HTTP client used for MCP connections
  • Libraries like proxy-agent or global-agent can properly handle no_proxy

View original on GitHub ↗

5 Comments

github-actions[bot] · 8 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/8179
  2. https://github.com/anthropics/claude-code/issues/22752
  3. https://github.com/anthropics/claude-code/issues/22004

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

ellevaoche · 8 months ago

Was this fixed with version 2.1.33?

Changelog states:
Fixed an issue where proxy settings configured via settings.json environment variables were not applied to WebFetch and other HTTP requests on the Node.js build

github-actions[bot] · 7 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

zhufeizzz · 7 months ago

I also encountered this issue and don't know how to work around it

github-actions[bot] · 6 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.