Bug: HTTP MCP client ignores no_proxy environment variable

Resolved 💬 5 comments Opened Feb 5, 2026 by ellevaoche 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 ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗