Claude Code proxy setup
How to run Claude Code behind an HTTP proxy: HTTPS_PROXY, NO_PROXY, settings.json for background agents, and the checks that show it works.
An AI coding tool can call a proxy MCP server instead of you pasting proxy details into the chat. This guide explains what that is, how local and remote servers differ, how to install one in three tools and how to send the server's own traffic through a proxy.
A proxy MCP server is an MCP server that manages IP proxies for an AI assistant. The assistant calls a named tool, for example one that returns a proxy URL for a country or opens a page through a proxy, and the username, password and API key stay in the server's configuration instead of in the chat.
The name is easy to mix up with mcp-proxy, an open-source tool whose repository describes it as "A bridge between Streamable HTTP and stdio MCP transports". It moves MCP messages between two transports so that a client that speaks only one can reach a server that speaks the other. It has no connection to IP addresses, countries or exit nodes. In this guide, "proxy MCP server" always means the first kind.
The MCP documentation separates servers by where they run. A local server uses the stdio transport: the client starts it as a process on your own machine and talks to it over standard input and output, with no network overhead. A remote server uses the Streamable HTTP transport: it runs at a URL, and that transport supports bearer tokens, API keys and custom headers for authentication.
That decides where the key goes. For a local server, the client passes the key to the process as an environment variable. For a remote server, the key is normally sent as an HTTP header on each request. Either way, the point of a proxy MCP server is that the key never has to appear in a prompt.
Read the tool list first. A proxy MCP server runs with your credentials and can call paid infrastructure, so look at every tool name and description.
Check whether any tool can buy something or spend your wallet. If one can, decide whether you want that, and prefer servers where purchasing is absent.
Check where the key lives. It belongs in an environment variable or a client configuration file that you do not commit to version control, never in a prompt, because prompts end up in conversation history.
proxy302-mcp is the official Proxy302 MCP server, open source on GitHub and maintained by the Proxy302 team. Account and billing questions go to Proxy302 support; bugs in the server go to its GitHub issues.
It is free and open source (MIT), installed from GitHub with npx, runs on your own machine over stdio and needs Node.js 20+ and a Proxy302 API key in the PROXY302_API_KEY environment variable. Its tools cover account usage and wallet balance, countries and regions, products and plans, a ready rotating residential proxy URL for a country, your own proxies, and fetching a URL through the proxy (plain HTTP, no JavaScript rendering).
It cannot buy anything or spend your wallet. Its only write is creating a free dynamic proxy credential, which is off by default, and traffic is billed only when used. The Proxy302 API itself is documented in the developer docs.
proxy302-mcp is a local stdio server started with npx, so all three tools below start it as a process and pass it PROXY302_API_KEY. Replace <key id>:<secret> with your own API key. The key goes in the environment variable, never in a prompt.
Claude Code. The server name comes before -e, and -- separates Claude Code's options from the server command. -s user makes it available in all projects; leave it out for the current project only.
claude mcp add proxy302 -s user -e PROXY302_API_KEY="<key id>:<secret>" -- npx -y github:proxy302/proxy302-mcpExample only: replace <key id>:<secret> with your own key.
Codex CLI. Use the command, or write the same server into ~/.codex/config.toml.
codex mcp add proxy302 --env PROXY302_API_KEY="<key id>:<secret>" -- npx -y github:proxy302/proxy302-mcpExample only: replace <key id>:<secret> with your own key.
[mcp_servers.proxy302]
command = "npx"
args = ["-y", "github:proxy302/proxy302-mcp"]
env = { PROXY302_API_KEY = "<key id>:<secret>" }The same server written into ~/.codex/config.toml.
Cursor. Add the server to ~/.cursor/mcp.json for all projects, or to .cursor/mcp.json inside one project.
{
"mcpServers": {
"proxy302": {
"command": "npx",
"args": [
"-y",
"github:proxy302/proxy302-mcp"
],
"env": {
"PROXY302_API_KEY": "<key id>:<secret>"
}
}
}
}Example only: replace <key id>:<secret> with your own key.
A remote MCP endpoint is also available at https://proxy302.com/v1/mcp, so nothing has to be installed. The client connects over Streamable HTTP and sends your Proxy302 API key in the Authorization header as Bearer <key id>:<secret>. Its 9 tools cover account balance and usage, country and region lists, products and prices, a rotating residential proxy for a country, your proxies with the exit address of each static IP, changing an IP, an IP purity check and a cost estimate checked against your wallet balance. None of them spends money; purchases stay in the console.
For the Claude and ChatGPT web apps there is a second address, https://mcp.proxy302.com/mcp, with a sign-in page. In Claude, open Settings → Connectors → Add custom connector; in ChatGPT, turn on developer mode and add a connector. Enter the address, and when the Proxy302 authorization page opens, paste the key from the API keys page of the console as <key id>:<secret> and approve. Deleting that key in the console ends the connection. Clients that send headers, such as Claude Code, Cursor and Dify, can use either address with the Authorization header.
claude mcp add --transport http proxy302 https://proxy302.com/v1/mcp --header "Authorization: Bearer <key id>:<secret>"The --transport http and --header options are from the Claude Code MCP documentation. Cursor, VS Code, Codex and Gemini CLI take the same URL and Authorization header in their own MCP configuration.
Giving a tool a proxy and sending an MCP server's own outbound requests through a proxy are two separate jobs. Most MCP servers are Node.js or Python programs that the client starts, and they receive the environment the client gives them, so that is where proxy variables go.
Node.js reads proxy variables only if you opt in. Set NODE_USE_ENV_PROXY=1 (Node v24.0.0 and v22.21.0 or later) or start Node with --use-env-proxy (v24.5.0 and v22.21.0 or later), and it reads HTTP_PROXY, HTTPS_PROXY and NO_PROXY. It accepts HTTP or HTTPS proxy URLs only, not SOCKS. Node 20 has no built-in support, so a server running on Node 20 does not pick these variables up.
Python is simpler. httpx and requests read the proxy environment variables by default. requests needs the requests[socks] extra if the proxy URL is SOCKS.
A client passes these variables to the server in its env block, next to the API key. The example is for a server that makes ordinary web requests:
{
"mcpServers": {
"some-other-server": {
"command": "npx",
"args": ["-y", "your-mcp-server-package"],
"env": {
"NODE_USE_ENV_PROXY": "1",
"HTTPS_PROXY": "http://USERNAME:PASSWORD@HOST:PORT",
"HTTP_PROXY": "http://USERNAME:PASSWORD@HOST:PORT",
"NO_PROXY": "localhost,127.0.0.1"
}
}
}
}Example only: replace HOST, PORT, USERNAME and PASSWORD with your own values. Use an HTTP proxy URL.
The same variables work on a command line:
NODE_USE_ENV_PROXY=1 HTTPS_PROXY=http://USERNAME:PASSWORD@HOST:PORT node server.jsExample only: replace the placeholders with your own values.
The assistant's own connection and the server's outbound requests are two hops, so test them separately. Compare the exit country and ISP that a lookup shows with the region you asked for.
| Item | Network (ISP) | ASN | Response, ms |
|---|---|---|---|
| United States | AT&T Enterprises, LLC | AS7018 | 1807 |
| United Kingdom | Plusnet | AS6871 | 2563 |
| Germany | Vodafone GmbH | AS3209 | 1058 |
| Japan | BTV CO.,LTD. | AS18135 | 1548 |
| Singapore | Starhub Ltd | AS55430 | 629 |
| Russia | PJSC Vimpelcom | AS8402 | 2031 |
| Brazil | TELEFÔNICA BRASIL S.A | AS26599 | 6263 |
| Indonesia | PT. Telekomunikasi Selular | AS23693 | 1752 |
This is Proxy302's hourly connectivity check, not a proxy302-mcp measurement: one request to Amazon per country through a rotating residential exit, on 3 November 2026 at 18:18 UTC. One sample per country, not an average; later checks will differ. Only the first three octets of an IP are public.
Rotating residential suits reading public pages from many places, such as price pages, search results or documentation that differs by country. Traffic is bought by the gigabyte and each generated proxy draws on it; pick the country when you generate it.
A static ISP IP suits anything tied to one account: you lease the IP for 1 to 90 days and it stays the same during the lease. Datacenter IPs suit plain API calls where the network type does not matter.
A proxy changes only the network address a service sees. What an account may do, and whether it stays open, is decided by the platform.
Rotating residential fits most proxy MCP work: the server asks for a proxy URL for a country and the traffic it uses is billed from your wallet. The product page describes the lines and countries.
Create an API key in the Proxy302 console (the page is /api-keys). It has two parts, a key id and a secret, written as <key id>:<secret>.
Run the install command for your tool from the section above, with your key in the environment variable.
Restart the tool if it asks you to, then ask the assistant to list the server's tools and to get a proxy URL for the country you need.
Check the exit with https://ipinfo.io/json through the proxy. The country field should match the country you chose. The guide to checking a proxy covers the other checkers.
From mainland China, open the Helper from the Connect page, click 「一键加速」 (One-click boost) and keep it open while you use the proxy.
proxy302-mcp is free. Rotating residential traffic costs from US$1.50 per GB on the Budget line and US$5 per GB on the Premium line, and larger packages are cheaper per GB. A static ISP IP costs US$0.50 for one day and US$7.99 for 30 days, the same in every country; availability changes daily and is shown on the order page. There is no free trial, and the smallest purchase is 1 GB of rotating residential traffic or one IP for one day. A proxy does not lift a restriction, undo a ban or raise a limit.
| Item | Price | Protocols | Locations | Fits agent work like |
|---|---|---|---|---|
| Rotating residential | From US$1.50 per GB (Budget line); US$5 per GB (Premium line); lower per GB in larger packages | HTTP, SOCKS5 | 195+ countries and regions; state and city on lines that support it | Browsing and research agents, data collection |
| Static ISP, per IP | US$0.50 for 1 day, US$7.99 for 30 days, the same in every country | HTTP or SOCKS5, chosen per IP | 30 countries on the order form; stock changes daily | One fixed IP for each account an agent signs in to |
| ISP for AI subscriptions | Per 30 days: Claude 15 PTC, GPT / Grok 10 PTC, Gemini 8 PTC; the first order in each tier is 50% off | HTTP or SOCKS5 | Claude: US, UK, DE, ES, JP, SG. GPT / Grok and Gemini: US, UK, FR, ES, IT, JP, KR, SG | Coding tools and agents signed in to ChatGPT, Claude, Gemini or Grok |
| Datacenter, per IP | US$0.25 for 1 day, US$3.99 for 30 days | HTTP or SOCKS5, chosen per IP | 8 countries | API calls and tool traffic where the IP type does not matter |
| proxy302-mcp | Free, open source (MIT) | MCP over stdio, started with npx | Uses the products above | Lets Claude Code, Codex, Cursor and other MCP clients get a proxy and fetch pages through it |
Prices are in PTC, paid from the wallet; 1 PTC = US$1. There is no free trial: the smallest purchase is 1 GB of rotating residential traffic or one IP for one day. Checked on 4 November 2026.
An MCP server that exposes proxy-related tools, such as getting a proxy URL for a country or fetching a page through a proxy, so an AI assistant can use a proxy by calling a tool while the credentials stay in the server's configuration.
No. mcp-proxy is an open-source bridge between stdio and Streamable HTTP MCP transports. It moves MCP messages and has nothing to do with IP proxies.
In an environment variable that the client passes to a local server, or in a client config file you do not commit. A remote server normally takes it as an HTTP header. It should not appear in a prompt.
Yes. Add https://mcp.proxy302.com/mcp as a custom connector (in Claude: Settings → Connectors → Add custom connector; in ChatGPT: a connector in developer mode). The Proxy302 authorization page asks for your API key as <key id>:<secret>; deleting the key in the console ends the connection. The same 9 tools are available, and none of them spends money.
No. The assistant's connection and the server's own requests are separate. Pass proxy variables in the server's env block; Node.js needs NODE_USE_ENV_PROXY=1 (v24.0.0 and v22.21.0 or later), Python httpx and requests read them by default.
No. It cannot buy anything or spend the wallet. Its only write is creating a free dynamic proxy credential, which is off by default; traffic is billed only when used.
Official documentation · Confirmed on:
Read on 4 November 2026: local MCP servers use the STDIO transport on the same machine with no network overhead; remote servers use Streamable HTTP, which supports bearer tokens, API keys and custom headers.
Official documentation · Confirmed on:
Read on 4 November 2026: the repository describes itself as "A bridge between Streamable HTTP and stdio MCP transports".
Official documentation · Confirmed on:
Checked on 4 November 2026: claude mcp add syntax with -e / --env and -- before the server command, scopes local, project and user.
Official documentation · Confirmed on:
Checked on 4 November 2026: codex mcp add <name> --env VAR=VALUE -- <command>; stdio servers in ~/.codex/config.toml with command, args and env.
Official documentation · Confirmed on:
Checked on 4 November 2026: mcp.json at ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project); stdio entries use command, args and env.
Official documentation · Confirmed on:
Checked on 4 November 2026 (also doc/api/http.md): NODE_USE_ENV_PROXY=1 (v24.0.0, v22.21.0) and --use-env-proxy (v24.5.0, v22.21.0) make Node read HTTP_PROXY, HTTPS_PROXY and NO_PROXY; proxy URLs use HTTP or HTTPS; Node 20 has no built-in proxy support.
Official documentation · Confirmed on:
Checked on 4 November 2026: requests relies on the http_proxy, https_proxy, no_proxy and all_proxy environment variables (uppercase also works); SOCKS needs requests[socks].
Official documentation · Confirmed on:
Checked on 4 November 2026: HTTP_PROXY, HTTPS_PROXY, ALL_PROXY and NO_PROXY are used by default; trust_env=False turns them off.
Product observation · Confirmed on:
README of the official Proxy302 MCP server: install commands, environment variables, the seven tools, the read-only, spend-free scope and the hosted endpoint https://proxy302.com/v1/mcp.
Product observation · Confirmed on:
Public JSON of the probe at proxy302.com/live/connectivity/amazon.json (file probe-amazon-20261104.json), generated 3 November 2026, 18:18 UTC: one request to Amazon per country through a rotating residential exit; exit ISP, ASN and response time. It is not a measurement of proxy302-mcp.
Product observation · Confirmed on:
Product facts file of the site (values checked against the console, the backend and the price table on 18-19 October 2026): products, prices in US$ (1 PTC = US$1), lease terms, protocols and ports, countries, quantity limits, no free trial.
Product observation · Confirmed on:
Public JSON at proxy302.com/v1/proxy/ai-isp/catalog, read 4 November 2026: three tiers (Claude, GPT / Grok, Gemini), price per 30 days in PTC, 50% off the first order in a tier, cities by country.
Product observation · Confirmed on:
An MCP initialize request without a key to https://proxy302.com/v1/mcp on 4 November 2026 returned HTTP 401 asking for Authorization: Bearer <key id>:<secret>. Transport (Streamable HTTP) and the tool list as stated by the Proxy302 API team on 4 November 2026. A request without a key to https://mcp.proxy302.com/mcp on 4 November 2026 returned HTTP 401 with a WWW-Authenticate header pointing to its OAuth protected-resource metadata, and its authorization-server metadata lists authorize, token and registration endpoints. The connector sign-in (paste <key id>:<secret> on the Proxy302 authorization page; deleting the key ends the connection) as described by the Proxy302 API team on 4 November 2026.
Create an account, top up once, then pick rotating residential, static ISP or datacenter IPs and have one running in your browser within minutes.