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: Git

Here's the exact config to add the Git 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.git]
command = "uvx"
args = ["mcp-server-git", "--repository", "/path/to/repo"]