Scope
Claude Code setup defaults to project scope:cordon.toml lives in $CWD, and settings are written to $CWD/.claude/settings.local.json. This keeps credentials and proxy configuration isolated per repository and per checkout — settings.local.json is Claude Code’s gitignored-by-convention override file, so git worktrees do not inherit stale proxy env vars from a tracked settings.json.
To share a single cordon configuration across all projects, use user scope:
$HOME/.claude/settings.json and stores config at $XDG_CONFIG_HOME/cordon/cordon.toml. See Scopes for path details and trade-offs.
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 file (
.claude/settings.local.jsonfor project scope,~/.claude/settings.jsonfor user scope) with proxy env vars (HTTPS_PROXY,HTTP_PROXY,https_proxy,http_proxy,NODE_EXTRA_CA_CERTS,SSL_CERT_FILE,REQUESTS_CA_BUNDLE,CURL_CA_BUNDLE)
<name>.cordon.bak before any changes are made. If setup detects cordon env vars in a project’s tracked settings.json (from a pre-fix install), they are migrated into settings.local.json automatically during the next cordon setup claude-code run.
To run cordon as a background service, run cordon service install after setup (add --scope user if you set up Claude Code with --scope user).
Remove the setup
Adding routes
The
cordon route, cordon start, and cordon service commands below default to project scope. If you set up Claude Code with --scope user, append --scope user to each of these commands so they target ~/.config/cordon/cordon.toml instead of ./cordon.toml.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 to your settings file —.claude/settings.local.json for project scope or ~/.claude/settings.json for user scope:
Manual setup
If you prefer manual configuration, set these env vars in Claude Code’s environment. Replace<PORT> with the port written into your cordon.toml (check listen = ...):
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.<PORT> with the port in your cordon.toml). For project scope, write to .claude/settings.local.json — Claude Code’s per-checkout, gitignored-by-convention override file — so worktrees don’t inherit stale proxy env vars. For user scope, write to ~/.claude/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 in your settings file (.claude/settings.local.jsonfor project scope,~/.claude/settings.jsonfor user scope) and 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’s settings file. Project scope writes.claude/settings.local.json; user scope writes ~/.claude/settings.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