Read and write local files with configurable access controls.
- Home
- MCP Servers for Codex CLI
MCP Servers for Codex CLI
Codex CLI is OpenAI's terminal coding agent. It supports MCP through an `mcp_servers` section in its TOML config, letting you extend Codex with the same servers that power Claude Code, Cursor, and the rest of the ecosystem.
Set up MCP in Codex CLI
Four steps to connect your first MCP server.
- 1
Open ~/.codex/config.toml
First-run Codex creates the file at `~/.codex/config.toml` if it does not exist. Open it in your editor (or run `codex config edit`).
- 2
Add servers under [mcp_servers.*]
Each MCP gets its own subtable: `[mcp_servers.<name>]`. Inside, set `command` and `args` — the same shape used by every MCP install snippet on top-mcps.com, just in TOML.
- 3
Use env for secrets
Reference shell variables with `${VAR_NAME}` inside the `env = { ... }` table. Tokens stay in your shell environment, not in the committed config.
- 4
Restart Codex
Exit and relaunch the Codex CLI so it re-reads the config. Run `codex mcp list` to confirm the servers are connected and their tool counts are non-zero.
- User config
~/.codex/config.tomlCodex reads this on startup. Edit it directly or via `codex config`.
# ~/.codex/config.toml
[mcp_servers.filesystem]
command = "npx"
args = [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/you/code",
]
[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp"]
[mcp_servers.github]
command = "npx"
args = ["-y", "@github/github-mcp-server"]
env = { GITHUB_PERSONAL_ACCESS_TOKEN = "${GITHUB_TOKEN}" }Top MCPs for Codex CLI
The curated starting stack — install these first.
Full GitHub API access: repos, PRs, issues, and code search.
Up-to-date library docs pulled directly into your AI context.
Query and inspect PostgreSQL databases via natural language.
Full browser automation: navigate, click, screenshot, and scrape.
Persistent knowledge graph memory across AI conversations.
All MCPs compatible with Codex CLI
27 servers verified to work with Codex CLI, ranked by popularity.
Read and write local files with configurable access controls.
Local SQLite database access with full read/write support.
Local Git operations: commit, diff, log, branch, and more.
Full GitHub API access: repos, PRs, issues, and code search.
Query and inspect PostgreSQL databases via natural language.
Full browser automation: navigate, click, screenshot, and scrape.
Structured step-by-step reasoning for complex problem solving.
Persistent knowledge graph memory across AI conversations.
Manage payments, customers, and subscriptions through Stripe.
Read, write, and search across Notion pages, databases, and blocks.
Triage errors, inspect traces, and query events from Sentry.
Geocoding, place search, directions, and travel times from Google Maps.
Expose 8,000+ Zapier integrations as tools your AI agent can call.
Inspect Figma designs, components, and variables from an agent.
Read and send Slack messages, manage channels and threads.
Manage Workers, R2 buckets, DNS, and edge policies on Cloudflare.
Read products, orders, and inventory from your Shopify store.
Up-to-date library docs pulled directly into your AI context.
Full Supabase access: database, auth, storage, and edge functions.
Search, inspect, and run Hugging Face models and datasets from an agent.
Real-time and forecast weather data via the OpenWeatherMap API.
Read and write notes in your local Obsidian vault.
Secure cloud sandboxes for executing AI-generated code.
Manage Linear issues, projects, and cycles from AI context.
Read, create, and manage events across Google Calendar.
FAQ: MCP in Codex CLI
Where does Codex CLI store its MCP config?
At `~/.codex/config.toml`. The entire config is a single TOML file, with MCP servers living under `[mcp_servers.<name>]` subtables. There is no per-project config today — Codex uses the same config across every repo.
How is the config different from Claude Desktop or Cursor?
Shape-wise it is the same — `command`, `args`, optional `env` — but the format is TOML instead of JSON, and keys use `[mcp_servers.<name>]` subtables instead of the `{"mcpServers": {...}}` nesting you see in JSON clients.
Can I share MCP config across my team in Codex?
Only indirectly today. Codex uses a single user-level config, so team sharing is typically done by committing a template `config.toml` to your repo and asking teammates to copy the `[mcp_servers.*]` blocks they want into their own Codex config.
Does Codex CLI support env var interpolation?
Yes. Inside the `env = { ... }` inline table you can reference `${VAR_NAME}` and Codex resolves it from the shell at launch. That lets you keep tokens out of the committed config while still passing them to the MCP process.
Why does Codex call them "mcp_servers" (plural) and not "mcpServers"?
TOML convention. Codex's config is snake_case throughout, and `mcp_servers` matches the style of its other subtables (`model`, `tools`, `projects`). The underlying MCP protocol is unchanged — only the config-file shape differs.
Browse every MCP server → top-mcps.com