How to install
Codex MCP servers: how to add one
Add MCP servers to OpenAI's Codex with one command or a few lines in config.toml, for local and hosted servers, plus what to do when a server starts too slowly.
2 min read · Updated
Codex keeps its MCP servers in ~/.codex/config.toml. The Codex CLI, the IDE extension and the desktop app all read that file, so a server you add once shows up in all three.
Add a server with one command
codex mcp add context7 -- npx -y @upstash/context7-mcp
The name comes first. The command that starts the server goes after --. If the server needs a key, pass it with --env:
codex mcp add firecrawl --env FIRECRAWL_API_KEY=your-key -- npx -y firecrawl-mcp
Run codex mcp list to see what you have.
Or edit config.toml
Each server is a [mcp_servers.<name>] block. You can write one yourself instead of using the command:
[mcp_servers.playwright]
command = "npx"
args = ["@playwright/mcp@latest"]
API keys go in an env block under the server:
[mcp_servers.firecrawl]
command = "npx"
args = ["-y", "firecrawl-mcp"]
[mcp_servers.firecrawl.env]
FIRECRAWL_API_KEY = "your-key"
A project can have its own .codex/config.toml as well. Codex only reads it in projects you have marked as trusted.
Add a hosted server
A hosted server needs a url:
[mcp_servers.sentry]
url = "https://mcp.sentry.dev/mcp"
If the server uses sign-in, run codex mcp login sentry and finish the login in your browser.
When a server starts too slowly
Codex gives each server about 10 seconds to start. A server launched with npx -y downloads its package the first time, and on a slow connection that can take longer. Raise the limit for that server:
[mcp_servers.firecrawl]
command = "npx"
args = ["-y", "firecrawl-mcp"]
startup_timeout_sec = 30
Check that it works
In the Codex CLI, type /mcp to see the servers that are running. In the IDE extension, open the gear menu and choose MCP servers.
Skills go somewhere else
Codex reads skills from ~/.agents/skills, or from .agents/skills inside a repo, and not from config.toml. Each skill is a folder with a SKILL.md file, the same format Claude Code uses. Our skills guide covers the format.
Servers to start with
Each of these has a Codex tab on its page with the config ready to paste:
For more, browse everything that works with Codex.