Codex CLI MCP Servers: The Full mcp_servers Config Field Guide
Codex CLI wires MCP servers via [mcp_servers] in config.toml: command/args/env for stdio, url/bearer_token/http_headers for remote, plus timeouts, tool filters and OAuth.
Codex CLI declares MCP servers in the [mcp_servers] table of ~/.codex/config.toml — each sub-table is a named server, and both stdio (local process) and remote (HTTP) shapes share one field set. This guide walks the fields as defined by RawMcpServerConfig in the codex-rs source, not from memory.
1. Stdio: local processes
[mcp_servers.wave]
command = "python"
args = ["-m", "wave_mcp.server", "--session", "/abs/path/to/session"]
env = { "API_KEY" = "..." }
cwd = "/path/to/workdir"
Five stdio fields:
command— the process to launchargs— argument arrayenv— literal key/value pairs injected into the process environmentenv_vars— a list of host environment variable names to pull values from (keeps secrets out of the file)cwd— working directory for the server process
The difference between env and env_vars is whether a secret lands on disk — prefer env_vars for tokens.
2. Remote: HTTP servers
[mcp_servers.linear]
url = "https://mcp.linear.app/mcp"
bearer_token_env_var = "LINEAR_TOKEN"
Remote fields:
url— the server endpointbearer_token/bearer_token_env_var— a literal token or one read from the environmenthttp_headers/env_http_headers— custom request headers (the latter resolving values from env vars)http_headers_helper— a helper-command form that produces header values
3. Shared controls
Fields applying to both shapes:
| Field | Purpose |
|---|---|
startup_timeout_sec / startup_timeout_ms | server startup timeout |
tool_timeout_sec | per-tool-call timeout |
enabled | master switch (false disables) |
required | mandatory marker — session fails rather than degrades if unavailable |
enabled_tools / disabled_tools | tool whitelist / blacklist |
supports_parallel_tool_calls | whether this server's tools may run in parallel |
omit_tools_from | which exposure surfaces show the tools |
scopes | OAuth scopes |
required = true deserves a second look: it does not mean "try harder" — it means "fail the session if this server is missing". Right for hard dependencies, wrong for nice-to-haves.
4. OAuth and auth
The auth field's enum is oauth / chatgpt / ema_auth. Servers needing a full OAuth flow use the [mcp_servers.<name>.oauth] block with client_id, callback_url, callback_port and authorization_server_issuer.
5. Common errors and debugging
- Server fails to start: check whether
commandresolves — npx/uvx may not be on PATH when Codex launches from a GUI context; then raisestartup_timeout_sec - Tools not visible: check
disabled_toolsand the requirements layer — Codex has plugin/requirements-level MCP filtering, and admin-siderequiredconstraints can work in reverse - Secrets in the repo:
bearer_tokenandenvare plaintext; project-level.codex/config.tomlis committed to git — always use the*_env_varforms for secrets
6. Next steps
- Codex CLI Sandbox Modes: sandbox_mode and approval_policy Explained — the security boundary around MCP
- Getting started with OpenAI Codex CLI: from install to daily use — install and sign-in basics
Key points
- Stdio fields: command, args, env, env_vars, cwd
- Remote fields: url, bearer_token / bearer_token_env_var, http_headers / env_http_headers
- Timeouts: startup_timeout_sec (or startup_timeout_ms), tool_timeout_sec
- Tool surface: enabled_tools / disabled_tools; required fails the session if the server is unavailable
- auth enum: oauth / chatgpt / ema_auth; the oauth block takes client_id, callback_url, callback_port
Frequently asked questions
Official references
Related articles
MCP Apps Explained: Interactive UIs Rendered Inside Chat, Standardized as SEP-1865
MCP Apps (SEP-1865, Final): a server declares a ui:// resource, and hosts like Claude or VS Code Copilot render the interactive HTML inside the conversation. Mechanism, security model, SDK code, and host support.
Read articleThe Model Hardware Standard, explained: how MHS lets AI agents safely operate physical devices
A close reading of Anthropic's August 27 research preview of the Model Hardware Standard: standardized drivers, three control mechanisms including MCP, results from six research partners, and eight vendors building support.
Read articleMCP Client Features Today: Elicitation Stays, Roots and Sampling Deprecated (SEP-2577)
The 2026-07-28 spec reshuffled MCP client features: Roots and Sampling deprecated (SEP-2577, retained 12+ months) while Elicitation remains with a new URL mode -- status, deprecation context, and migration paths, clause by clause.
Read articleSubscribe to GPTMap Weekly
One email every Monday: curated OpenAI updates, deep dives, and best practices. No ads, unsubscribe anytime.
Submitting opens Buttondown in a new tab to confirm your subscription.