Skip to main content

OpenAI Codex CLI Setup

Codex CLI uses a config.toml file. HTTP MCP servers must be configured by editing the file directly. The codex mcp add command only supports STDIO servers.

Step 1: Set environment variables

Add these to your shell profile (~/.bashrc, ~/.zshrc, or equivalent):

export CLOUDSEK_BEARER_TOKEN=your_bearer_token_here
export CLOUDSEK_ORG_ID=your_org_id_here

Step 2: Open or create the config file

ScopePath
Global (all sessions)~/.codex/config.toml
Project-specific (trusted projects only).codex/config.toml in your project root

Step 3: Add the CloudSEK server block

[mcp_servers.cloudsek]
url = "https://api.cloudsek.com/mcp"
bearer_token_env_var = "CLOUDSEK_BEARER_TOKEN"
env_http_headers = { "X-CloudSEK-Org-Id" = "CLOUDSEK_ORG_ID" }
startup_timeout_sec = 20

bearer_token_env_var tells Codex to read the env var named CLOUDSEK_BEARER_TOKEN and inject it as an Authorization: Bearer header automatically. env_http_headers maps header names to env var names. Codex reads CLOUDSEK_ORG_ID at runtime and sends its value as the header value.

Step 4: Verify

Start a Codex session and type /mcp to confirm CloudSEK shows as connected.