Automated setup
The fastest way to get started:- Generates CA certificates (if not already present)
- Creates a scaffold
cordon.toml - Generates a combined CA bundle (system CAs + Cordon CA)
- Configures Claude Code’s
settings.jsonwith proxy env vars (HTTPS_PROXY,HTTP_PROXY,https_proxy,http_proxy,NODE_EXTRA_CA_CERTS,SSL_CERT_FILE,REQUESTS_CA_BUNDLE,CURL_CA_BUNDLE)
settings.json is backed up to settings.json.cordon.bak before any changes are made.
To run cordon as a background service for this project, run cordon service install --name my-project --config ./cordon.toml after setup.
Remove the setup
Adding routes
After setup, add a route for your API provider. Example for Anthropic:cordon.toml directly — see Routes for the full format.
API key setup
Claude Code needs an API key env var set so it selects the API key auth path. Add a placeholder tosettings.json:
Manual setup
If you prefer manual configuration, set these env vars in Claude Code’s environment:You must create a combined CA bundle manually if not using
cordon setup claude-code. Concatenate your system CA bundle with the Cordon CA cert — see Combined CA bundle below.settings.json:
Combined CA bundle
Claude Code can launch MCP servers and tools that use Python, curl, wget, or other non-Node runtimes. These tools useSSL_CERT_FILE, REQUESTS_CA_BUNDLE, or CURL_CA_BUNDLE to locate trusted certificates.
Python’s SSL_CERT_FILE replaces the default certificate store rather than appending to it. Setting it to just the Cordon CA cert would break TLS for all non-proxied connections (the system CAs would be missing).
To solve this, cordon setup claude-code generates a combined CA bundle that concatenates:
- Your system CA certificates (e.g., from
/etc/ssl/cert.pem) - The Cordon proxy CA certificate
combined-ca.pem) and SSL_CERT_FILE, REQUESTS_CA_BUNDLE, and CURL_CA_BUNDLE all point to it.
SSL_CERT_FILE— used by Python’ssslmodule and OpenSSL-based toolsREQUESTS_CA_BUNDLE— used by Python’srequestslibrary (does not readSSL_CERT_FILE)CURL_CA_BUNDLE— used bycurlandlibcurl-based toolsNODE_EXTRA_CA_CERTS— used by Node.js (appends to built-in CAs, so it points to just the Cordon CA cert, not the combined bundle)
Trust the CA
If tools used by Claude Code fail with certificate errors:NODE_EXTRA_CA_CERTS for Node-based tools (this is handled automatically by cordon setup claude-code).
Workflow
Once configured, the workflow is:- Start cordon:
cordon start(or use the background service) - Start Claude Code as usual
- When Claude Code makes API calls to configured hosts, cordon transparently injects credentials
- Claude Code never sees or logs real API keys
Troubleshooting
Certificate errors
If tools used by Claude Code fail with certificate errors:- Verify
NODE_EXTRA_CA_CERTSis set insettings.jsonand points to an existing file - For Python MCP servers, verify
SSL_CERT_FILEandREQUESTS_CA_BUNDLEare set and point to the combined CA bundle (not just the Cordon CA cert) - For curl/wget-based tools, verify
CURL_CA_BUNDLEis set - For other non-Node tools, add the CA to the system trust store:
cordon trust
NODE_EXTRA_CA_CERTS. Python’s SSL_CERT_FILE replaces the system store, so it must point to the combined bundle. Both are handled automatically by cordon setup claude-code.
Proxy not being picked up
Verify the env vars are in Claude Code’ssettings.json:
MCP servers not using the proxy
Node.js MCP servers need the bootstrap loader to enable proxy support. Add to your MCP server config:requests or httpx will respect HTTPS_PROXY automatically if it’s set in the environment.
New routes not taking effect
Cordon loads routes at startup. If you add or change routes incordon.toml, restart the proxy (secrets are fetched per-request and don’t require a restart):
401 Unauthorized errors
- Verify the secret is stored:
cordon secret set <route-name> - Check the auth type: Anthropic uses
type: api_keywithheader_name: x-api-key, nottype: bearer - Check the secret source: Secrets are fetched per-request — if you changed a secret, the next request picks it up automatically