🔌 Socketlist

How to add MCP servers to OpenAI Codex (config.toml)

Configure MCP servers for the Codex CLI, IDE extension and app with codex mcp add or ~/.codex/config.toml.

Use the CLI

codex mcp add context7 -- npx -y @upstash/context7-mcp

Add --env VAR=VALUE for secrets. codex mcp list shows configured servers.

Or edit config.toml

Codex stores MCP settings in ~/.codex/config.toml (or .codex/config.toml in a trusted project). Each server is a [mcp_servers.<name>] table:

[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp"]

[mcp_servers.example]
url = "https://mcp.example.com"

Check it

Type /mcp in the Codex terminal UI (or the ChatGPT desktop app composer) to view connected servers. The CLI, IDE extension and desktop app share the same configuration. For OAuth servers run codex mcp login <name>.

Related guides

Weekly MCP digest – new and trending MCP servers in your inbox.