Skip to navigation

OpenAI Codex

View as Markdown

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).

  1. Add the server with its URL and no auth header:

    codex mcp add Atomicwork --url https://<your-subdomain>.atomicwork.com/mcp
  2. Codex confirms Added global MCP server 'Atomicwork', then reports Detected OAuth support. Starting OAuth flow… and prints an authorization URL.

  3. 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.

  4. Run codex mcp list to 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:

[mcp_servers.Atomicwork]
url = "https://<your-subdomain>.atomicwork.com/mcp"

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:

[mcp_servers.Atomicwork]
url = "https://<your-subdomain>.atomicwork.com/mcp"
http_headers = { "Authorization" = "Bearer aw_xxx" }

To keep the token out of the file, use bearer_token_env_var instead of http_headers, and set ATOMICWORK_TOKEN in your environment:

[mcp_servers.Atomicwork]
url = "https://<your-subdomain>.atomicwork.com/mcp"
bearer_token_env_var = "ATOMICWORK_TOKEN"

Verify Connection

codex mcp list

Notes

  • Project-scoped config requires the project to be trusted by Codex.