[Feature] Honour HTTP_PROXY, HTTPS_PROXY and NO_PROXY for provider, fetch_url and web_search traffic
Description
Nanocoder has no HTTP proxy support for its own network traffic. A search of source/ for proxy handling finds nothing outside the project .env protection list, which treats HTTP_PROXY, HTTPS_PROXY, ALL_PROXY and NO_PROXY as sensitive names but never reads them.
- Provider requests go through an explicit
undiciAgent(source/ai-sdk-client/ai-sdk-client.ts, passed as thedispatcherinsource/ai-sdk-client/providers/provider-factory.ts). A plainAgentnever consults proxy environment variables. fetch_url,web_search, the models.dev lookup, the update checker, the wizards' model fetching and the skills installer usefetch/undici.requestdirectly. Node's built-infetchdoes not use proxy environment variables unless the runtime is opted in separately.
Behind a corporate proxy, the provider connection, fetch_url, web_search, model catalogue loading and the update check all fail or time out, even though the same machine can reach the internet through the proxy.
Use Case
Developers on corporate or university networks, and anyone who routes traffic through a local proxy (mitmproxy, Charles, a company gateway), where direct outbound connections are blocked. NODE_EXTRA_CA_CERTS and the per-provider TLS options already exist for the certificate half of this setup; the proxy half is missing. Searches upstream for proxy and HTTPS_PROXY return no related request.
Proposed Solution
Honour the standard variables (HTTPS_PROXY, HTTP_PROXY, NO_PROXY, and their lowercase forms) by default, and add an optional per-provider proxy setting for cases where only one provider should use a proxy. Local targets (localhost, private ranges) should be bypassed through NO_PROXY semantics so an Ollama server on the same machine keeps working.
Alternatives Considered
- Run nanocoder with a transparent proxy wrapper such as
proxychains. This is fragile on macOS and does not work on Windows. - Set
NODE_USE_ENV_PROXYwhere the Node version supports it. This covers the built-infetchonly, not the explicitundiciagent used for provider traffic, and it is not documented anywhere for nanocoder users.
Additional Context
- [x] I have searched existing issues to ensure this is not a duplicate
- [x] This feature aligns with the project's goals (local-first AI assistance)
Implementation Notes (optional)
undici ships EnvHttpProxyAgent, which reads the standard variables and honours NO_PROXY. It can replace Agent in AISDKClient (keeping the existing connect, TLS and timeout options) and be installed with setGlobalDispatcher for the tools that use fetch. MCP servers started over stdio already inherit the environment; HTTP/SSE MCP transports would need the same dispatcher. The SSRF guard in source/tools/fetch-url-guard.ts resolves and validates addresses itself, so it needs a look to make sure a proxy hop does not bypass the check.
I'd like to work on this. The issue points at the plain undici Agent used as the dispatcher in source/ai-sdk-client/providers/provider-factory.ts, which never reads proxy variables, plus direct fetch/undici.request calls in fetch_url and web_search. My plan is a small helper that returns an undici EnvHttpProxyAgent (which understands HTTP_PROXY, HTTPS_PROXY and NO_PROXY) when any of those variables is set and keeps today's Agent otherwise, used by the provider factory and the two web tools first; the other fetch call sites can follow if you want them in the same PR. I'll test the helper by asserting proxy selection and NO_PROXY bypass for several env combinations. I'll keep the existing per-provider TLS options working.