MCP server Official

Codex MCP configuration

How OpenAI Codex connects to MCP servers via codex mcp add or [mcp_servers] tables in config.toml, for CLI and IDE.

Author
OpenAI
Works with
OpenAI Codex
License
Apache-2.0
Documented
Oct 2, 2026

What Codex MCP configuration is

Codex supports STDIO and Streamable HTTP MCP servers. You add them with the codex mcp CLI, the IDE extension settings, or by editing ~/.codex/config.toml or a project-scoped .codex/config.toml. OAuth login is supported with codex mcp login.

What it does

How Codex MCP configuration plugs in: which agents run it and what it addsRUNS INYour agentOpenAI Codexone host documentedMCP SERVER · OFFICIALCodex MCP configurationConnect the agent to tools, data…5 install steps1 permission notelicense: Apache-2.0WHAT IT ADDSWhat it doesAdds MCP servers with codex mcp a…Configures STDIO servers (command…Supports OAuth via codex mcp loginPer-server tool allow/deny lists…agent → extension → new capability · from the official repository or docs
Where Codex MCP configuration runs and what it adds, from its documentation
  • Adds MCP servers with codex mcp add and lists them with codex mcp list
  • Configures STDIO servers (command, args, env, env_vars, cwd) and Streamable HTTP servers (url, bearer token, headers)
  • Supports OAuth via codex mcp login
  • Per-server tool allow/deny lists and approval modes (auto, prompt, writes, approve)
  • Startup and tool timeouts (defaults 10s and 60s) and a required flag

When to use it

Good fit

  • You want Codex to call external tools or docs servers
  • You need project-scoped MCP config checked into .codex/config.toml
  • A remote server needs OAuth or bearer-token auth

Not for

  • Hosted ChatGPT web: it does not read local Codex configuration files

How to install Codex MCP configuration

You need: Codex CLI or IDE extension

  1. Install Codex CLI: npm install -g @openai/codex (or brew install --cask codex)
  2. Run: codex mcp add --env VAR=VALUE --
  3. Example: codex mcp add context7 -- npx -y @upstash/context7-mcp
  4. Check servers with codex mcp list or /mcp in the TUI
  5. For OAuth servers run codex mcp login
Configuration example (from the official docs)
codex mcp add context7 -- npx -y @upstash/context7-mcp

Permissions and security

What it can access

  • Launches local commands for STDIO servers; tool approval modes configurable per server/tool

Security notes from the maintainers

  • Bearer tokens can be read from an environment variable (bearer_token_env_var) rather than stored in config

Review the source before granting an agent access to credentials or production systems. We document what the maintainers state; we do not audit code.

Limitations

  • Local MCP servers and transports may not be available in cloud containers

Tools it extends

Frequently asked questions

How do I add an MCP server to Codex?

Run codex mcp add -- , or add a [mcp_servers.] table to ~/.codex/config.toml. source

Does Codex support project-scoped MCP config?

Yes, a project-scoped .codex/config.toml is supported alongside ~/.codex/config.toml. source

Which MCP transports does Codex support?

STDIO and Streamable HTTP. source

How do I authenticate Codex to an OAuth MCP server?

Run codex mcp login . source

Related guides

Sources and gaps

Not stated by the maintainers: docs/advanced.md returns 404; config.md only links to developers.openai.com; Official Codex plugin/skill catalog not read; last_release not visible.

More extensions to look at