MCP client - OpenAI - verified
How to add an MCP server to OpenAI Codex CLI
Where to add MCP servers in OpenAI Codex CLI: ~/.codex/config.toml, or a project-scoped .codex/config.toml in trusted projects; add servers with codex mcp add. Its docs list support for stdio and Streamable HTTP. They do not state SSE. It handles OAuth sign-in for remote servers.
OpenAI Codex CLI homepage - Codex CLI in our tools directory - Compare all MCP clients
- Kind
- Coding agent
- stdio
- Yes
- Streamable HTTP
- Yes
- SSE
- Not stated
Add a server
- Where the config lives
- ~/.codex/config.toml, or a project-scoped .codex/config.toml in trusted projects; add servers with
codex mcp add
The example from the OpenAI Codex CLI docs, copied verbatim. Swap in your server's name, command or URL.
[mcp_servers.example]
url = "https://mcp.example.com"
[mcp_servers.example.oauth]
client_id = "my-client"
callback_url = "http://127.0.0.1/callback"Which server?
Pick a server from the verified directory of official MCP servers. Each one lists its transport, auth and the setup snippets its vendor publishes, so you can match it to what OpenAI Codex CLI supports.
MCP support
What the OpenAI Codex CLI docs say it supports. Not stated means the docs do not say either way.
| Feature | Value | Source |
|---|---|---|
| ToolsCalls the functions a server exposes. | Yes | learn.chatgpt.com/docs/extend/mcp |
| ResourcesReads data and files a server exposes as resources. | Not stated | Docs do not say |
| PromptsOffers a server's prompt templates to the user. | Not stated | Docs do not say |
| SamplingLets a server ask the client's model for a completion. | Not stated | Docs do not say |
| RootsTells a server which directories it may work in. | Not stated | Docs do not say |
| ElicitationLets a server ask the user for input mid-task. | Yes | learn.chatgpt.com/docs/config-file/config-reference |
| DiscoveryPicks up tools, prompts or resources a server adds or removes while connected. | Not stated | Docs do not say |
| InstructionsUses the instructions a server sends when it connects. | Yes | learn.chatgpt.com/docs/extend/mcp |
| stdioStarts a local server as a subprocess. | Yes | learn.chatgpt.com/docs/extend/mcp |
| Streamable HTTPConnects to a remote server over the current HTTP transport. | Yes | learn.chatgpt.com/docs/extend/mcp |
| SSEConnects over the older HTTP+SSE transport. | Not stated | Docs do not say |
| OAuthSigns in to remote servers with OAuth. | Yes | learn.chatgpt.com/docs/extend/mcp |
Worth knowing
The Codex CLI, the IDE extension and the ChatGPT desktop app share the same MCP configuration on a Codex host.
Other coding agents
FAQ
Where is the OpenAI Codex CLI MCP config?
~/.codex/config.toml, or a project-scoped .codex/config.toml in trusted projects; add servers with codex mcp add. The example on this page is copied from https://learn.chatgpt.com/docs/extend/mcp
Does OpenAI Codex CLI support remote MCP servers over Streamable HTTP?
Yes, per https://learn.chatgpt.com/docs/extend/mcp. Its docs list support for stdio and Streamable HTTP. They do not state SSE.
Does OpenAI Codex CLI support OAuth for MCP servers?
Yes. It handles OAuth sign-in for remote servers. Source: https://learn.chatgpt.com/docs/extend/mcp
Which MCP features does OpenAI Codex CLI support?
Its docs list Tools, Elicitation and Instructions. They do not state Resources, Prompts, Sampling, Roots and Discovery.
Sources
Last verified from the pages below.
- ChatGPT Learn: Model Context Protocol (Codex CLI) - learn.chatgpt.com
- ChatGPT Learn: Config Reference - learn.chatgpt.com
Newsletter
New MCP servers, the week they ship
One email per week. New official MCP servers, the coding tools that support them and how developers wire them up.