OpenAI Codex
Connect from OpenAI Codex
Codex CLI supports remote MCP servers over streamable HTTP. You can connect with OAuth, or with a bearer token in a TOML config file.
Connect with OAuth
Codex detects OAuth automatically for a streamable HTTP MCP server, so you never create or paste an API token. These steps need a Codex CLI version that supports codex mcp add --url (verified on codex-cli 0.153.4).
-
Add the server with its URL and no auth header:
-
Codex confirms
Added global MCP server 'Atomicwork', then reportsDetected OAuth support. Starting OAuth flow…and prints an authorization URL. -
Open that URL in your browser, sign in to Atomicwork, and approve access. Codex receives the result on a local callback and finishes the connection.
-
Run
codex mcp listto confirm Atomicwork is connected.
Adding the server writes this block to ~/.codex/config.toml. No client ID, client secret, or token is stored in the file:
To authorize again later, run codex mcp login Atomicwork. That command also accepts --scopes to request specific OAuth scopes and --oauth-client-registration <auto|cimd|dcr> if you need to force a client-registration strategy instead of letting Codex choose. Use codex mcp logout Atomicwork to clear stored credentials.
Connect with a bearer token
If you’d rather use an API token, add it to the Codex config file.
Edit or create the Codex config:
- User-global:
~/.codex/config.toml - Project-scoped:
.codex/config.toml(in project root)
Add the following block at the end of the file:
To keep the token out of the file, use bearer_token_env_var instead of http_headers, and set ATOMICWORK_TOKEN in your environment:
Verify Connection
Notes
- Project-scoped config requires the project to be trusted by Codex.
