MCP servers in Codex

Codex is the odd one out on format: it configures MCP servers in TOML, not JSON. Each server is a [mcp_servers.<name>] table inside ~/.codex/config.toml rather than a key in an "mcpServers" object. Remote servers are supported natively, and remote authentication is supplied through a bearer-token environment variable rather than an interactive OAuth flow.

Where the config lives

  • macOS / Linux: ~/.codex/config.toml

Worked example: claude-mem

Here's the exact config to add the claude-mem MCP server to Codex. Every server in the directory has a ready-to-paste Codex config like this.

Add to ~/.codex/config.toml

~/.codex/config.toml
toml
[mcp_servers.claude-mem]
command = "npx"
args = ["-y", "claude-mem", "mcp"]