Skip to main content

OpenAI Codex CLI

For OpenAI's Codex CLI, add the configuration to ~/.codex/config.toml, or .codex/config.toml in a trusted project. Remote MCP servers support static headers and environment-variable headers. See the official OpenAI MCP configuration documentation.

These examples use the default full endpoint. If you want the regional read or write profile instead, swap the URL and see MCP Endpoint Profiles.

Option 1: Static Headers (Direct Value)​

Use this when you want to put the API key directly in the config file:

[mcp_servers.spotto]
url = "https://mcp-au.spotto.ai/mcp"
http_headers = { "X-API-Key" = "YOUR_API_KEY" }

Option 2: Environment Variable Headers (Secure)​

Use this to reference an environment variable for better security:

[mcp_servers.spotto]
url = "https://mcp-au.spotto.ai/mcp"
env_http_headers = { "X-API-Key" = "SPOTTO_API_KEY" }

Then set the environment variable:

export SPOTTO_API_KEY="your_api_key_here"

Start Codex from an environment where the variable is set, then use /mcp to check the connection and ask it to list your Spotto companies. codex mcp list shows configured servers. Spotto uses an API key here; codex mcp login is for servers that provide an OAuth login flow.