
How to add MCP servers to OpenAI Codex
Add MCP servers to OpenAI Codex with codex mcp add or a [mcp_servers] table in ~/.codex/config.toml, shared by the CLI, IDE extension and desktop app.
- Local servers
- Yes
- runs stdio servers
- Hosted servers
- Yes
- connects by URL
- Config
- TOML
- how servers are added
- Plugins
- Yes
- plugin marketplaces
- Picks
- 10
- ranked
Run codex mcp add <name> -- <command> for a local server or codex mcp add <name> --url <address> for a hosted one, and Codex writes it to ~/.codex/config.toml. The Codex CLI, the IDE extension and the ChatGPT desktop app all read that file, so you set a server up once. A trusted project can also keep its own servers in .codex/config.toml.
Good for
- Developers who want Codex to reach docs, GitHub, Sentry or a browser
- Teams that want one project to carry its own servers in .codex/config.toml
- People scripting Codex with codex exec in CI who need servers to load
- Claude Code or Cursor users moving their setup to Codex
Install OpenAI Codex
Codex
- 1
Copy this prompt.
Add the OpenAI Codex MCP server to Codex. Run this command: curl -fsSL https://chatgpt.com/codex/install.sh | sh Then check that it loaded and tell me if I need to sign in or restart.
- 2
Paste it into Codex. It shows the change and asks before running it.
Then run codex in a project folder and choose Sign in with ChatGPT or another sign-in method.
From the vendor's docs. Source.
At a glance
- Add a local server
- codex mcp add <name> -- <command>
- Add a hosted server
- codex mcp add <name> --url <address>
- Config file
- ~/.codex/config.toml, [mcp_servers.<name>]
- Project config
- .codex/config.toml (trusted projects only)
- Sign in
- codex mcp login <name>
- Check servers
- codex mcp list, or /mcp in the TUI
- Default timeouts
- 10 s startup, 60 s per tool call
- Scripted runs
- codex exec "<task>" (read-only sandbox by default)
Add an MCP server to Codex
ChatGPT
- 1
Add a local server with codex mcp add
Put the launch command after
--. Pass keys with--env.codex mcp add context7 -- npx -y @upstash/context7-mcp codex mcp add <server-name> --env VAR1=VALUE1 -- <stdio server-command>Uses Context7
- 2
Or add a hosted server by URL
codex mcp add example --url https://mcp.example.comIf the server uses sign-in, run
codex mcp login examplenext. If the provider gave you a client ID, add--oauth-client-id my-client. - 3
Or edit config.toml by hand
Open
~/.codex/config.toml(all projects) or.codex/config.tomlin a trusted project. Each server is a[mcp_servers.<name>]table:[mcp_servers.context7] command = "npx" args = ["-y", "@upstash/context7-mcp"] [mcp_servers.figma] url = "https://mcp.figma.com/mcp" bearer_token_env_var = "FIGMA_OAUTH_TOKEN"Uses Figma MCP Server
- 4
Limit tools and approvals if you want
Use
enabled_toolsordisabled_toolsto pick tools, anddefault_tools_approval_mode = "writes"to make Codex ask before tools that are not marked read-only. Setenabled = falseto switch a server off without deleting it. - 5
Check it loaded
Run
codex mcp listin your shell, or type/mcpinside thecodexterminal app to see active servers. - 6
Use it in a prompt
Start
codexin your project and ask for the job.PromptUse context7 to look up the current Next.js docs for server actions, then update app/actions.ts to match.Uses Context7
- 7
In the IDE extension or desktop app
IDE extension: gear menu, MCP servers, Add server, choose STDIO or Streamable HTTP, save, then Restart extension. ChatGPT desktop app: Settings, MCP servers, Add server, save, then Restart. Both use the same config file as the CLI.
Best MCP servers for OpenAI Codex
Official servers with an approved PlugWiki page whose setup for this client is documented by the vendor or client; ordered by GitHub stars, then weekly downloads, then name.
- 1
Context7OfficialHosted or LocalAPI keyOpenAI's own Codex docs use it as the first example; gives Codex current library docs.
64,001 GitHub stars - 2
Playwright MCPOfficialLocalLets Codex drive and test your app in a real browser.
38,887 GitHub stars - 3
GitHub MCP ServerOfficialHosted or LocalOAuthPull requests, issues and code search beyond what git can do.
34,115 GitHub stars - 4
Stripe MCPOfficialHosted or LocalOAuthStripe's hosted server for payments, customers and refunds.
2,014 GitHub stars - 5
sentry-mcpOfficialHosted or LocalOAuthPulls Sentry errors into Codex so it can find and fix the cause.
952 GitHub stars - 6
ZapierOfficialHostedOAuthReaches thousands of apps through the actions you set up in Zapier.
452 GitHub stars - 7
Firecrawl MCP ServerOfficialHosted or LocalAPI keyTurns web pages into clean text for Codex, using your Firecrawl key.
190,711/wk downloads a week - 8Canva MCPOfficialHostedOAuth
Create and edit Canva designs after you sign in.
- 9
Exa MCP ServerOfficialHosted or LocalOAuthWeb search built for AI, hosted by Exa.
5.2K GitHub stars - 10
Notion MCPOfficialHostedOAuthRead and edit specs and notes in Notion through its hosted server.
MCP servers that work in OpenAI Codex
40 · official first, then servers with a page, then by stars
Scrapling MCP ServerOfficialLocalNo sign-inWeb scraping with stealth HTTP, real browsers, and Cloudflare bypass. CSS selectors supported.
90.6K GitHub stars
Context7OfficialHosted or LocalAPI keyUp-to-date docs for AI agents
64K GitHub stars
Chrome DevTools MCPOfficialLocalMCP server for Chrome DevTools
54.5K GitHub stars
Playwright MCPOfficialLocalPlaywright MCP server
38.9K GitHub stars
GitHub MCP ServerOfficialHosted or LocalOAuthGitHub's official MCP server. Lets an AI assistant read code, manage issues and pull requests, check Actions runs and security alerts. Hosted at api.githubcopilot.com/mcp or run locally with Docker or a Go binary.
34.1K GitHub stars
OpenWork MCP GatewayOfficialHostedOAuthYour OpenWork org's skills, plugins, workflows, and connections through one OAuth MCP URL.
24.3K GitHub stars
MCP Toolbox for DatabasesOfficialLocaltoken in envMCP Toolbox for Databases enables your agent to connect to your database.
16.8K GitHub stars
apify-mcp-serverOfficialHosted or LocalOAuthExtract data from any website with thousands of scrapers, crawlers, and automations on Apify Store ⚡
14K GitHub stars
SeleniumBase MCPOfficialLocalNo sign-inStealthy browser automation, testing, and web-scraping via CDP Mode.
13.2K GitHub stars
AutoClipOfficialLocalNo sign-inClip long videos into short clips with covers and captions. Local CLI and MCP.
9.9K GitHub stars
Firecrawl MCP ServerOfficialHosted or LocalAPI keyFirecrawl, the context API for AI agents: search, scrape, interact with the web, plus paper search.
7.7K GitHub stars
firecrawl-mcp-serverOfficialLocalAPI keyOfficial Firecrawl MCP server, the context API for AI agents: search, scrape, and interact with the web, plus parse, crawl, map, Agent and Monitor, from any MCP client.
7.7K GitHub stars
MobileBuildMCPOfficialLocalBuild, run and test iOS and macOS apps, drive the simulator and debug with LLDB from your AI assistant. Formerly XcodeBuildMCP.
6.5K GitHub stars
magic-mcpOfficialLocalAPI keyIt's like v0, but in your Cursor / Claude Code / Windsurf: search 10,000+ React/Tailwind components, generate new UI with AI, and publish your own — right from your editor. Magic MCP is now the 21st MCP; this package keeps old configs working. Setup: 21st.dev/mcp
6.3K GitHub stars- Excalidraw MCPOfficialHosted or LocalNo sign-in
Official Excalidraw MCP App server: streams hand-drawn diagrams into the chat with interactive fullscreen editing. Hosted or local.
5.6K GitHub stars
Exa MCP ServerOfficialHosted or LocalOAuthConnect AI agents to Exa for web search, content fetching, and multi-step research.
5.2K GitHub stars
notion-mcp-serverOfficialLocaltoken in envOfficial Notion MCP Server
4.7K GitHub stars
mcp-grafanaOfficialHosted or LocalAn MCP server giving access to Grafana dashboards, data and more.
3.6K GitHub stars- Google Analytics MCP ServerOfficialLocaltoken in env
Google's official Google Analytics MCP server: runs locally and queries GA4 reports and property settings with your Google credentials. Read-only unless you add the --allow-write flag.
3.6K GitHub stars
SupabaseOfficialHosted or LocalOAuthMCP server for interacting with the Supabase platform
3K GitHub stars
Show all 40Show fewer
brightdata-mcpOfficialLocaltoken in envA powerful Model Context Protocol (MCP) server that provides an all-in-one solution for public web access.
2.7K GitHub stars
Perplexity MCP ServerOfficialHosted or LocalOAuthConnector for Perplexity API, to enable real-time, web-wide research.
2.6K GitHub stars
tavily-mcpOfficialLocalProduction ready MCP server with real-time search, extract, map & crawl.
2.5K GitHub stars
Solana MCP by VybeOfficialHostedOAuthSolana MCP developer toolkit: wallets, trades, markets, PnL, transfers, onchain, swaps & API tools.
2.2K GitHub stars
Azure DevOps (ADO)OfficialHostedOAuthThe MCP server for Azure DevOps, bringing the power of Azure DevOps directly to your agents.
2.1K GitHub stars
Azure DevOps Local MCP ServerOfficialLocalOAuthThe MCP server for Azure DevOps, bringing the power of Azure DevOps directly to your agents.
2.1K GitHub stars
anysearch-mcp-serverOfficialHostedAPI keyUnified real-time search MCP server supporting general web search, vertical domain search, parallel batch search, and full-page URL content extraction.
2.1K GitHub stars
Microsoft Learn MCPOfficialHostedNo sign-inOfficial Microsoft Learn MCP Server – real-time, trusted docs & code samples for AI and LLMs.
2K GitHub stars- WordPress MCP AdapterOfficialLocal
The official WordPress plugin that turns a self-hosted site into an MCP server, exposing Abilities API actions from core, plugins and themes over STDIO (WP-CLI) or HTTP.
1.9K GitHub stars
MeiGen-AI-Design-MCPOfficialHosted or LocalOAuthDiscover inspiration and create images and videos with the latest AI models. Works with ChatGPT, Claude, Cursor, and other MCP clients.
1.8K GitHub stars
MATLAB MCP ServerOfficialLocalNo sign-inConnect AI coding agents to MATLAB. Run code, tests, and analysis via MCP.
1.7K GitHub stars
datagouv-mcpOfficialHostedNo sign-inOfficial data.gouv.fr Model Context Protocol (MCP) server that allows AI chatbots to search, explore, and analyze datasets from the French national Open Data platform, directly through conversation.
1.6K GitHub stars
MiniMax-MCPOfficialLocalAPI keyOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
1.6K GitHub stars
mcp-server-qdrantOfficialLocalAPI keyAn official Qdrant Model Context Protocol (MCP) server implementation
1.6K GitHub stars
TerraformOfficialHosted or LocalAPI keyGenerate more accurate Terraform and automate workflows for HCP Terraform and Terraform Enterprise
1.6K GitHub stars
@brave/brave-search-mcp-serverOfficialLocalBrave Search MCP Server: web results, images, videos, rich results, AI summaries, and more.
1.5K GitHub stars
IDA MCPOfficialLocalNo sign-inOfficial Hex-Rays MCP server that lets AI agents open, decompile and annotate binaries in IDA, alongside you in the IDA GUI or headless.
1.5K GitHub stars- X MCP (X API)OfficialHosted or LocalOAuth
X's hosted MCP server for the X API at api.x.com/mcp: AI clients search posts, read users, trends and news, manage bookmarks and publish Articles through your X developer app, directly or via the xurl mcp bridge.
1.4K GitHub stars
Power BI Authoring MCP Server (Local)OfficialLocalOAuthThe Power BI Authoring MCP server lets an AI agent create and change Power BI semantic models.
1.3K GitHub stars
ref-tools-mcpOfficialLocalAPI keyToken efficient search for coding agents over public and private documentation.
1.2K GitHub stars
Common errors and fixes
Server times out on startup
Cause: Codex waits 10 seconds by default, and npx can take longer the first time.
Fix: Set startup_timeout_sec = 20 (or more) in the server's [mcp_servers.<name>] table.
codex Source
Project .codex/config.toml servers do not load
Cause: Codex reads project config only in trusted projects.
Fix: Trust the project, or add the server to ~/.codex/config.toml instead.
codex Source
codex mcp login does nothing for a server
Cause: Sign-in only works for servers added by URL that support OAuth.
Fix: For key-based servers, set bearer_token_env_var or http_headers instead.
codex Source
codex exec stops with an MCP error
Cause: A server marked required = true failed to start.
Fix: Fix the server, or remove required = true so the run continues without it.
codex Source
codex exec cannot edit files
Cause: codex exec runs in a read-only sandbox by default.
Fix: Pass --sandbox workspace-write; --full-auto is no longer supported.
codex Source
codex mcp-server command not found
Cause: The command was removed.
Fix: Use the Codex app server to control Codex from another program.
codex Source
Verdict
Codex gives you one MCP setup in config.toml that the CLI, IDE extension and ChatGPT desktop app all share, with per-tool approval controls. The main limit is short default timeouts, 10 seconds to start, so slow npx servers may need startup_timeout_sec raised.
Codex gives you one MCP setup in config.toml that the CLI, IDE extension and ChatGPT desktop app all share, with per-tool approval controls. The main limit is short default timeouts, 10 seconds to start, so slow npx servers may need startup_timeout_sec raised.
Best for
- Developers using Codex in the terminal, IDE or ChatGPT desktop app
- Teams scripting Codex with codex exec in CI
Skip it if
- You expect servers in a project .codex/config.toml to load in an untrusted project
- You want a JSON config you can copy from another app unchanged
Questions
How do I add an MCP server to Codex?
Run codex mcp add <name> -- <command> for a local server, or codex mcp add <name> --url <address> for a hosted one. Check it with codex mcp list.
Where is the Codex MCP config file?
~/.codex/config.toml, under [mcp_servers.<name>] tables. A trusted project can also have .codex/config.toml with servers only for that project.
Does Codex use JSON or TOML for MCP servers?
TOML. Servers you install through a Codex plugin can declare theirs in the plugin's .mcp.json, but your own servers go in config.toml.
What does codex exec do?
codex exec "<task>" runs Codex once without the interactive screen, for scripts and CI. It prints only the final answer to stdout, runs in a read-only sandbox unless you pass --sandbox workspace-write, and --json streams events as JSON lines.
How do I resume a Codex session?
Run codex resume to pick a recent chat, codex resume --last for the latest one in this folder, or add --all to search every folder. For scripted runs use codex exec resume --last "<next prompt>" or codex exec resume <SESSION_ID>.
How do I sign in to an MCP server that uses OAuth?
Run codex mcp login <server-name>. It works only for servers added by URL that support sign-in. Use --scopes read,write to ask for specific permissions.
Why does my MCP server time out in Codex?
Codex waits 10 seconds for a server to start and 60 seconds per tool call by default. Raise startup_timeout_sec or tool_timeout_sec in that server's table.
Will codex exec fail if an MCP server does not start?
Only if you set required = true on that server. Then codex exec exits with an error instead of running without it.
Can I bring my Claude Code setup into Codex?
Yes. Type /import in the codex terminal app, choose Claude Code or Cursor, and pick what to bring over.
What happened to codex mcp-server?
It was removed. OpenAI points to the Codex app server instead if you want to drive Codex from another program.
Information
updated Nov 1, 2026
- Transports
- stdio, Streamable HTTP
- Config file (all)
~/.codex/config.toml- MCP docs
- developers.openai.com
Sources
Docs, issue trackers and discussions this page is built from.
Show all 4Hide
- Codex CLI · learn.chatgpt.com
- Model Context Protocol · learn.chatgpt.com
- Developer commands · learn.chatgpt.com
- Non-interactive mode · learn.chatgpt.com