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.

27 compatible MCPsVerified setup for 2026Visit official site

Set up MCP in Codex CLI

Four steps to connect your first MCP server.

  1. 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. 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. 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. 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.

Config file locations
  • User config~/.codex/config.tomlCodex reads this on startup. Edit it directly or via `codex config`.
Example configjsonc
# ~/.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.

Up-to-date library docs pulled directly into your AI context.

codingdocumentationlibrariesaccuracy
3 minLow
Official

Query and inspect PostgreSQL databases via natural language.

databasesqlpostgresqueries
3 minLow

Full browser automation: navigate, click, screenshot, and scrape.

browserautomationscrapingpuppeteer
5 minMedium

Persistent knowledge graph memory across AI conversations.

memorypersistenceknowledge-graphagents
2 minLow

All MCPs compatible with Codex CLI

27 servers verified to work with Codex CLI, ranked by popularity.

Local SQLite database access with full read/write support.

databasesqlitelocalstorage
2 minLow

Retrieve web pages and convert them to clean markdown.

webfetchmarkdownscraping
1 minLow

Local Git operations: commit, diff, log, branch, and more.

gitlocalcommitsdiff
2 minLow
Official

Query and inspect PostgreSQL databases via natural language.

databasesqlpostgresqueries
3 minLow

Real-time web search with privacy-focused results.

searchwebrealtimenews
5 minLow

Full browser automation: navigate, click, screenshot, and scrape.

browserautomationscrapingpuppeteer
5 minMedium

Persistent knowledge graph memory across AI conversations.

memorypersistenceknowledge-graphagents
2 minLow

Manage payments, customers, and subscriptions through Stripe.

stripepaymentsbillingcommerce
5 minMedium

Read, write, and search across Notion pages, databases, and blocks.

notiondocsdatabasesknowledge
5 minLow
Official

Triage errors, inspect traces, and query events from Sentry.

sentryerrorsmonitoringobservability
3 minLow

Expose 8,000+ Zapier integrations as tools your AI agent can call.

zapierautomationintegrationsworkflow
5 minLow

Inspect Figma designs, components, and variables from an agent.

figmadesigndesign-to-codecomponents
5 minMedium

Read and send Slack messages, manage channels and threads.

slackmessagingcommunicationautomation
10 minMedium

Read products, orders, and inventory from your Shopify store.

shopifyecommerceproductsorders
10 minMedium

Up-to-date library docs pulled directly into your AI context.

codingdocumentationlibrariesaccuracy
3 minLow

Full Supabase access: database, auth, storage, and edge functions.

supabasedatabasebackendpostgres
5 minLow

Secure cloud sandboxes for executing AI-generated code.

codingexecutionsandboxcloud
5 minLow

Manage Linear issues, projects, and cycles from AI context.

linearproject-managementissuesproductivity
5 minMedium

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