Codex MCP: How to Add, Configure and Secure MCP Servers

To connect tools to Codex with MCP, register the server, authenticate if required, and verify a returned tool result. The configuration depends on how the server runs, which account it uses, and whether the connection belongs to one repository or your user-level setup.
Start with a public documentation server to learn that flow without connecting a private account. Then use the same checks when adding issue trackers, design tools, or Catio’s architecture context, with permissions scoped to the work you actually want Codex to do.
What is Codex MCP?
Codex is an MCP client. It uses the Model Context Protocol to discover and call tools exposed by MCP servers, such as documentation search or issue lookup. The Codex CLI, IDE extension, and ChatGPT desktop app share MCP configuration when they use the same Codex host.
Codex as a client versus a server
Connecting a server to Codex lets Codex use that server’s tools. Exposing Codex to another agent is a different integration. Older examples for “Codex MCP in Claude Code” may use codex mcp-server, but that command and its standalone binary have been removed. OpenAI now points developers to the Codex app server. Don’t use the removed command to configure an MCP client connection.
How Codex connects to MCP servers: STDIO vs. Streamable HTTP
Choose the transport the server actually provides. A local documentation process and a hosted issue tracker need different configurations.
Transport | How it starts | Typical use | Authentication |
STDIO | Codex starts a command and communicates with the process | A local MCP server or installed integration | Server-specific configuration, often environment variables |
Streamable HTTP | Codex connects to an endpoint URL | A hosted service or remote MCP server | Bearer token or OAuth, when required |
Codex also reads the server’s initialization instructions as guidance for using its tools. Those instructions can explain a workflow, but they don’t replace the access and approval choices you make in the client.
How to add an MCP server to Codex
With the CLI
Use the public OpenAI Docs MCP for a first connection. It provides read-only documentation search without connecting a private account.
- Add the remote endpoint:
codex mcp add openaiDocs --url https://developers.openai.com/mcp- Inspect the saved configuration:
codex mcp list
codex mcp get openaiDocs- Start Codex and inspect the active connection with
/mcp, then request a documentation lookup.
For a local STDIO server, the command follows --. This Context7 example requires Node.js and npx on the machine that starts the server:
codex mcp add context7 -- npx -y @upstash/context7-mcpFor an OAuth server, complete the provider’s authorization flow when prompted. If the saved server still needs authentication, run codex mcp login <name>. The name is the one you registered, not the endpoint URL.
With config.toml, including repository scope
Use ~/.codex/config.toml for user-level configuration. For servers specific to one repository, put the configuration in that repository’s .codex/config.toml; Codex loads project configuration only for trusted projects. Running the add command inside a repository does not make its saved entry project-scoped.
Each server gets its own table. These entries show the same HTTP and STDIO choices:
[mcp_servers.openaiDocs]
url = "https://developers.openai.com/mcp"
[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp"]Choose either the CLI or file route for a given entry; don’t paste duplicate TOML tables. Keep repository configuration free of credentials so teammates can review the connection settings without receiving your access tokens.
In the desktop app or IDE
In the ChatGPT desktop app, open Settings → MCP servers → Add server. Enter a name, choose STDIO or Streamable HTTP, and supply the command or URL. Save, then select Restart. Use Authenticate if the server requires OAuth.
The IDE extension has an equivalent MCP servers entry in its gear menu, followed by Restart extension. These local setup steps don’t apply to ChatGPT web, which uses plugins rather than reading your local configuration file.
Check that a tool actually ran
In the session, type /mcp and inspect the active server and available tools. Then ask:
Use the OpenAI Docs MCP to look up how Codex loads project-scoped
configuration. Return the relevant source link and explain the
trusted-project requirement.Check the tool-call record for the server, operation, arguments, and returned result. A prose answer alone could come from the model’s existing context; a listed server proves configuration, not execution. Cached tool catalogs can also appear before a live connection is ready.
Codex MCP configuration options worth setting
A documentation lookup and a long-running analysis need not share the same timeout. Adjust these settings when the defaults don’t fit your task; the MCP configuration reference has the full list.
Option | Behavior and default | When to change it |
| Startup timeout; 10 seconds | A healthy server needs longer to initialize |
| Tool execution timeout; 60 seconds | A known operation legitimately takes longer |
| Set | Pause an integration without deleting its entry |
| Set | The task must not begin without this server |
|
| You deliberately allow catalog-first startup; calls still need a connection |
| Allow list, then deny list | Expose only tools relevant to the task |
|
| Set the server’s approval behavior instead of assuming it |
For STDIO credentials, env_vars forwards named variables to the server. For an HTTP bearer token, bearer_token_env_var names the variable Codex reads. env_http_headers is available when a service needs other environment-backed HTTP headers.
MCP servers to connect to Codex
Choose a server for the information your current task needs. These remote entries use Streamable HTTP; follow each provider’s setup instructions for account access and permissions.
Server | What it supplies | Connect command |
Developer documentation | | |
Repository, issue and pull-request tools | | |
Design context | | |
Issues and project context through its read-only endpoint | | |
Errors and issue context | | |
Architecture inventory, dependencies and saved designs | |
The GitHub example expects GITHUB_PAT_TOKEN to be available when Codex starts. Sentry also supports organization- and project-scoped URLs. For OAuth connections, use codex mcp login <name> if authentication remains incomplete.
Give Codex your architecture, not just your repository
Before moving a capability into a new service, Codex needs more than the files that implement it. It needs the infrastructure to reuse, the constraints to preserve, and the design the team has approved. Our architecture-context connection exposes workspace requirements, architecture inventory, and dependencies alongside blueprint and Archie tools.
An architecture plan still needs to be checked against the code. In the Notifications extraction example, the plan keeps the existing Redis and Postgres, but the blueprint references notify:dedup:{order_id} while the repository uses notif:sent:{order_id}. Reading the relevant files catches that mismatch before implementation.
From blueprint to code. Catio supplies the architecture context and blueprint; the coding assistant maps that design to the repository and writes the change. Start with get_workspace_info and get_workspace_context, then use search_inventory_components and search_inventory_relationships to investigate the affected services. Retrieve the relevant saved blueprint rather than asking the agent to invent the system around the code.
Connect an existing, populated Catio workspace using Streamable HTTP and OAuth. During login, choose the organization and workspace you want to use; that workspace stays fixed for the connection. You can read inventory and context through MCP, while blueprint creation and updates need separate review.
Permissions, secrets, and approvals for Codex MCP
Keep credentials out of shared configuration. Reference a bearer token through its environment variable, and use provider-supported OAuth scopes that match the task. Codex supports Client ID Metadata Documents (CIMD) and Dynamic Client Registration (DCR) for OAuth client registration, but the available flow depends on the authorization server. Your account still needs access to the data you want to retrieve.
For a Catio connection used only to establish context, start narrowly:
[mcp_servers.catio]
url = "https://mcp.catio.tech/mcp"
enabled_tools = ["get_workspace_info", "get_workspace_context"]
default_tools_approval_mode = "prompt"Edit the existing entry rather than adding a duplicate. Expand the allow list when the next task needs inventory or blueprint access.
For a server that mixes reads and writes, default_tools_approval_mode = "writes" prompts for tools not marked read-only. Treat that as a convenience, not an authorization boundary: MCP tool annotations are hints from the server. Keep provider permissions narrow, prefer read-only endpoints where available, and review sensitive reads as well as writes.
Keep client-side approvals and provider permissions as separate layers of your agent architecture.
Troubleshooting Codex MCP connections
Locate the failing stage before changing settings. Increasing a tool timeout will not fix a missing executable or an account that lacks access.
Symptom | What to check | Next step |
Server is listed but no tools appear | Startup, authentication and tool filters | Inspect |
Bearer token is missing | Environment of the process launching Codex | Set the named variable in that environment and restart |
Executable cannot be found |
| Use the executable’s absolute path; quote paths containing spaces |
Startup times out | Whether the server starts independently | Fix its startup error, or raise |
Repository settings are ignored | Project trust and | Review the project before trusting it; check the file path |
OAuth cannot open a browser | Whether the terminal is headless | Use |
HTTP 401 or 403 | Expired credentials, scopes and resource access | Reauthenticate if needed; check the provider’s denial before broadening permissions |
For headless OAuth, the current CLI accepts the full redirect URL back in the terminal. Treat that redirect as credential-bearing material; don’t paste it into a ticket or chat. Remove an unused configuration with codex mcp remove <name>, and separately review any access grants retained by the provider.
Conclusion
Use Codex MCP to close a specific information gap, then verify that the tool returned what the task needs. Keep the server list deliberate, permissions narrow, and credentials out of shared configuration. A traceable tool result gives you evidence for the next decision.
For changes that cross service boundaries, repository access is only part of that evidence. Our Catio MCP brings workspace requirements, dependencies, and saved blueprints into the decision, so you can evaluate the proposed change against the wider system.
Book a Catio demo and bring the architecture decision behind your next code change. We’ll explore how Catio can help your team build on its existing system.
Codex MCP FAQ
Does Codex support MCP?
Yes. Its CLI, IDE extension, and desktop app support MCP servers. For local clients, configuration is shared on the same host.
How do I set up MCP in Codex?
Add the server with codex mcp add, or create its config.toml entry. Complete authentication if required, inspect /mcp, and verify a real tool call.
Can I use Figma MCP with Codex?
Yes. Connect Figma’s remote MCP server, then sign in with an account that can access the design you want to use.
Can I use Codex as an MCP server in Claude Code?
Don’t use old codex mcp-server instructions: that command was removed. Evaluate the app-server interface separately if you need another agent to drive Codex.
How many MCP servers should Codex have connected?
Keep the set small enough to understand each server’s purpose, access and approval policy. Add a connection when it answers a concrete question in the task, and disable it when that purpose disappears.

