Codex CLI can already read your repo, edit files and run shell commands. MCP servers add the things it can't reach on its own: current docs, your GitHub issues, a real browser, production errors and the live web. This guide covers which servers are worth adding, the exact Codex setup for each one, and the settings that keep Codex fast and safe.
What Are the Best MCP Servers for Codex CLI?
The best MCP servers for Codex CLI are the ones that fill gaps its built-in tools leave open. For most developers that means OpenAI Docs MCP and Context7 for current documentation, GitHub MCP for repos and pull requests, Playwright or Chrome DevTools for the browser, and Sentry for errors. Figma and Supabase cover design and database work, and Olostep adds live web data.
Start with two to four servers, not fifteen. Each server adds tool definitions that Codex has to read, so a small set of focused servers usually works better than a long list.
The choice matters because a lot of developers now run this setup. Per OpenAI's Codex usage report, "Codex now has more than 5 million weekly active users, up more than 6x since the launch of the desktop app in February." That figure covers every Codex surface, not just the CLI.
The server pool is large too. Anthropic's MCP adoption figures from December 2025 state: "There are now more than 10,000 active public MCP servers, covering everything from developer tools to Fortune 500 deployments." With that many options, picking well matters more than picking many.
How MCP Works in Codex CLI
The Model Context Protocol (MCP) is an open standard that lets an AI client call tools from an external program, called an MCP server. If you're new to the idea, start with what an MCP server is and come back.
Codex stores MCP servers in ~/.codex/config.toml. You can also scope servers to one project with a .codex/config.toml file in that repo, but only for trusted projects. The Codex CLI, the IDE extension and the ChatGPT desktop app share this configuration, so you set a server up once and use it everywhere.
Every setting in this guide comes from OpenAI's Codex MCP documentation. One example: "startup_timeout_sec (optional): Timeout (seconds) for the server to start. Default: 10." That default comes up again in the timeouts section below. Inside the Codex terminal UI, type /mcp to see which servers are active.
Local (STDIO) vs Hosted (Streamable HTTP) Servers
Codex supports two kinds of MCP servers. A STDIO server is a local program that Codex starts for you, using a command, optional args and optional env variables. A streamable HTTP server is hosted at a URL, and Codex connects to it with a url plus a token or OAuth login.
| Local (STDIO) | Hosted (Streamable HTTP) | |
|---|---|---|
| How Codex reaches it | Starts a process on your machine | Connects to a URL |
| Key config fields | command, args, env | url, bearer_token_env_var |
| Auth | Environment variables | Bearer token or OAuth (codex mcp login) |
| Startup | Can be slow on first npx download | No local install |
| Good for | Offline work, local browsers, private networks | Vendor-run services like GitHub, Sentry and Figma |
Hosted servers skip slow first-run installs. Local servers keep the process on your own machine and work behind strict proxies.
The Codex MCP Commands You Need
You can edit config.toml by hand, but the codex mcp commands write it for you. These are the ones you'll use most:
# Add a local STDIO server
codex mcp add <name> --env KEY=VALUE -- <command> <args>
# Add a hosted server that uses a bearer token from an env var
codex mcp add <name> --url https://example.com/mcp --bearer-token-env-var MY_TOKEN
# Inspect and manage servers
codex mcp list
codex mcp get <name>
codex mcp remove <name>
# Sign in to (or out of) an OAuth server
codex mcp login <name>
codex mcp logout <name>The --env flag works only with STDIO servers. The --bearer-token-env-var flag works only with streamable HTTP servers.
How to Choose MCP Servers for Codex
For a "best" list to help, you need the criteria first. Use these five to judge any MCP server before you add it to Codex:
- Fills a real gap: Codex already has shell and file tools, so Filesystem and Shell MCP servers add little. Pick servers that reach data Codex can't.
- Context cost: Each server exposes tools, and those definitions take up room in the model's context.
- Maintainer: Prefer servers run by the vendor whose data they expose, such as GitHub's own server for GitHub.
- Auth model: Prefer servers that accept scoped tokens or OAuth over ones that want passwords on the command line.
- Workflow fit: A front-end developer needs a browser server. A backend developer gets more from an error tracker.
Context cost is easy to overlook. Anthropic's code execution with MCP post notes that "Most MCP clients load all tool definitions upfront directly into context." That is one reason to connect fewer, focused servers.
Fresh information is the other big gap. Models learn from data with a cutoff date, and libraries keep changing. A study on evolving API knowledge notes that "Wang et al. (2025a) observed a 25%-38% deprecated API usage rate across eight Python libraries." Those studies tested earlier models, but the lesson still applies: docs and web servers give Codex current facts. For the wider argument, see why agents need web access.
9 Best MCP Servers for Codex CLI
Each pick below fills a gap that Codex's built-in tools leave open. Every command comes from the vendor's own documentation, except the Supabase and Olostep setups. Their docs don't show a Codex example yet, so those setups use OpenAI's documented config fields with each vendor's documented endpoint. If you want a broader list that isn't Codex-specific, see our guide to MCP servers for other AI clients.
| Server | Best for | Transport | Auth | Codex add command |
|---|---|---|---|---|
| OpenAI Docs MCP | OpenAI API and Codex docs | Hosted | None | codex mcp add openaiDeveloperDocs --url https://developers.openai.com/mcp |
| Context7 | Version-specific library docs | Local or hosted | Optional API key | codex mcp add context7 -- npx -y @upstash/context7-mcp |
| GitHub MCP | Issues, PRs, Actions | Hosted or Docker | Personal access token | codex mcp add github --url https://api.githubcopilot.com/mcp/ --bearer-token-env-var GITHUB_PAT_TOKEN |
| Playwright MCP | Browser automation and UI tests | Local | None | codex mcp add playwright npx "@playwright/mcp@latest" |
| Chrome DevTools MCP | Performance and network debugging | Local | None | codex mcp add chrome-devtools -- npx chrome-devtools-mcp@latest |
| Sentry MCP | Production errors and stack traces | Hosted | OAuth | codex mcp add sentry --url https://mcp.sentry.dev/mcp |
| Figma MCP | Design context for front-end work | Hosted | OAuth | codex mcp add figma --url https://mcp.figma.com/mcp |
| Supabase MCP | Database and project management | Hosted | OAuth | Add https://mcp.supabase.com/mcp with --url |
| Olostep MCP | Live web pages, search, crawls | Hosted or local | API key | codex mcp add olostep --url https://mcp.olostep.com/mcp --bearer-token-env-var OLOSTEP_API_KEY |
OpenAI Docs MCP
OpenAI Docs MCP is a read-only server that searches OpenAI's developer documentation. It's documentation-only and doesn't call the OpenAI API. Add it if Codex helps you build on OpenAI's APIs or configure Codex itself.
codex mcp add openaiDeveloperDocs --url https://developers.openai.com/mcpOpenAI suggests adding a line to your AGENTS.md file telling Codex to use this server when it works with OpenAI products. AGENTS.md is a project file Codex reads for standing instructions.
Context7
Context7 serves version-specific documentation and code examples for popular libraries. Use it when Codex writes code against frameworks that change often, such as front-end or ORM libraries.
codex mcp add context7 -- npx -y @upstash/context7-mcpThe first npx run downloads the package, which can take longer than Codex's 10-second startup default. Context7's own Codex instructions raise the timeout:
[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
startup_timeout_ms = 20_000GitHub MCP Server
GitHub's official MCP server lets Codex read and manage issues, pull requests, Actions runs and code security alerts. GitHub hosts it at https://api.githubcopilot.com/mcp/, so there's nothing to install.
export GITHUB_PAT_TOKEN="your-token"
codex mcp add github --url https://api.githubcopilot.com/mcp/ --bearer-token-env-var GITHUB_PAT_TOKENCreate a personal access token with only the scopes you need, and keep it out of your repo. GitHub also supports toolsets, such as repos,issues,pull_requests, so you can expose fewer tools and save context.
Playwright MCP
Microsoft's Playwright MCP lets Codex drive a real browser to click through pages, fill forms and check UI changes. It reads the page's accessibility tree, a structured outline of the page, instead of relying on screenshots.
codex mcp add playwright npx "@playwright/mcp@latest"Pick Playwright when you want Codex to test user flows end to end.
Chrome DevTools MCP
Chrome DevTools MCP gives Codex the debugging side of the browser: performance traces, network requests and console messages. Pick it over Playwright when the question is "why is this page slow or broken?" rather than "does this flow work?"
codex mcp add chrome-devtools -- npx chrome-devtools-mcp@latestOn Windows, the project's docs wrap the command in cmd /c and raise startup_timeout_ms to 20_000.
Sentry MCP
Sentry MCP brings issues, events and stack traces from Sentry into Codex. That lets Codex look at a real production error before it proposes a fix.
codex mcp add sentry --url https://mcp.sentry.dev/mcpThe command opens Sentry's OAuth flow in your browser. If you need to sign in again later, run codex mcp login sentry.
Figma MCP
Figma's remote MCP server gives Codex design context from your Figma files, so generated UI code can follow the design. Figma recommends its Codex plugin where available. The manual setup is:
codex mcp add figma --url https://mcp.figma.com/mcpAuthenticate when Codex prompts you.
Supabase MCP
Supabase MCP lets Codex manage tables, run queries and inspect a Supabase project. It's hosted at https://mcp.supabase.com/mcp and accepts options such as read_only=true and project_ref=<your-project> in the URL.
Supabase's own docs say to never connect the MCP server to production data. They also warn that prompt injection is possible, which means content in your database could try to steer the agent. Point it at a development project and turn on read-only mode.
Olostep MCP Server
The Olostep MCP Server gives Codex the live web as clean Markdown or JSON. Use it when Codex needs a page, docs site or search result that isn't in your repo or its training data.
It exposes 10 tools:
scrape_websiteandget_webpage_contentturn a URL into Markdown, JSON, HTML or text.search_webreturns structured search results.answersreturns an answer with its sources. It uses Olostep's web answers with sources endpoint.batch_scrape_urlsandget_batch_resultsscrape a large list of URLs.create_crawlandget_crawl_resultscrawl a site, such as a framework's docs. They run on Olostep's crawl endpoint.create_mapandget_website_urlslist the URLs on a site.
Batch and crawl jobs run asynchronously and return an ID. Codex can start a large crawl without hitting its 60-second tool timeout, then fetch the results later.
Olostep's docs list the hosted endpoint and the local package but don't list Codex yet. These configs use OpenAI's documented Codex fields. The startup_timeout_sec = 30 value is a suggested setting for slow first-time npx installs:
# Hosted (streamable HTTP)
[mcp_servers.olostep]
url = "https://mcp.olostep.com/mcp"
bearer_token_env_var = "OLOSTEP_API_KEY"# Local (STDIO)
[mcp_servers.olostep]
command = "npx"
args = ["-y", "olostep-mcp"]
env = { OLOSTEP_API_KEY = "YOUR_API_KEY" }
startup_timeout_sec = 30Olostep doesn't manage repos or track errors, so pair it with GitHub or Sentry rather than replacing them. If you're choosing between web tools, read our comparison of web search MCP servers.
Codex Settings That Keep MCP Fast and Safe
Codex's defaults work for most servers, but a few settings decide whether a setup stays quick and safe. All of them go inside a server's [mcp_servers.<name>] table.
Fix Startup Timeouts
Codex waits 10 seconds for a server to start (startup_timeout_sec) and 60 seconds for a tool call to finish (tool_timeout_sec). A first-time npx install can take longer than 10 seconds, which shows up as a startup timeout.
Raise startup_timeout_sec, or use startup_timeout_ms if you prefer milliseconds. Set required = true only on a server Codex can't work without. With that set, Codex fails at startup instead of continuing without the server.
Limit Tools to Save Context
Use enabled_tools as an allow list and disabled_tools as a deny list. Codex applies the deny list after the allow list. Set enabled = false to park a server without deleting its config, and use output_token_limit to cap how much one tool can return.
[mcp_servers.github]
url = "https://api.githubcopilot.com/mcp/"
bearer_token_env_var = "GITHUB_PAT_TOKEN"
enabled_tools = ["list_issues", "get_issue", "create_pull_request"]
[mcp_servers.playwright]
command = "npx"
args = ["@playwright/mcp@latest"]
enabled = false # turn on only for UI workTool names vary by server. Run /mcp in Codex to see the exact names before you build an allow list.
Control Approvals and Secrets
Set default_tools_approval_mode per server to auto, prompt, writes or approve. The writes mode asks before running any tool not marked read-only. You can override a single tool with tools.<tool>.approval_mode.
Approvals matter because Codex's sandbox network rules don't restrict MCP servers. Keep tokens in environment variables with bearer_token_env_var, never in args, where they can end up in shell history and logs.
Vet third-party servers before you connect them. One study of 1,899 MCP servers found that "7.2% of servers contain general vulnerabilities, and 5.5% exhibit MCP-specific tool poisoning." Tool poisoning means hiding instructions in a tool's description to steer the agent. That was a 2025 scan of open-source servers, so read it as a reason to check servers, not as a rate for every server.
A Starter config.toml for Codex
This starter setup gives Codex current docs, GitHub access and live web data, with tighter approvals on anything that writes. Copy it into ~/.codex/config.toml and set GITHUB_PAT_TOKEN and OLOSTEP_API_KEY in your shell. The tool_timeout_sec = 120 value on Olostep is a suggested setting that gives longer scrapes more room than the 60-second default.
[mcp_servers.openaiDeveloperDocs]
url = "https://developers.openai.com/mcp"
[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp"]
startup_timeout_ms = 20_000
[mcp_servers.github]
url = "https://api.githubcopilot.com/mcp/"
bearer_token_env_var = "GITHUB_PAT_TOKEN"
default_tools_approval_mode = "writes"
[mcp_servers.olostep]
url = "https://mcp.olostep.com/mcp"
bearer_token_env_var = "OLOSTEP_API_KEY"
tool_timeout_sec = 120Run codex mcp list to confirm all four servers appear, then open Codex and type /mcp to check that they're connected. Add a short note to AGENTS.md, such as "Use Context7 for library docs and Olostep for web pages," so Codex knows which server to call for which job.
FAQ
Does Codex CLI support MCP servers?
Yes. Codex CLI supports local STDIO servers and hosted streamable HTTP servers, configured in ~/.codex/config.toml or with codex mcp add.
Do the Codex CLI and IDE extension share MCP servers?
Yes. The Codex CLI, IDE extension and ChatGPT desktop app share the same MCP configuration for the same Codex host.
How many MCP servers should I add to Codex?
Start with two to four servers that fill real gaps, and set enabled = false on the rest. Fewer tool definitions leave more context for your code.
Why does my MCP server time out when Codex starts?
Codex waits 10 seconds by default, and a first-time npx download can take longer. Raise startup_timeout_sec (or startup_timeout_ms) for that server.
Do MCP servers work in Codex cloud?
OpenAI's docs say local MCP servers may not be available in cloud tasks. Check the current Codex documentation before you rely on them there.
Do I need a filesystem MCP server for Codex?
Usually not. Codex already reads files, edits code and runs commands in your workspace without an extra server.
les, edits code and runs commands in your workspace without an extra server.



