Codex MCP: How to Add MCP Servers to OpenAI Codex

To add an MCP server to Codex, run codex mcp add <name> --url <url> for a remote server, or codex mcp add <name> -- <command> for a local one, then codex mcp login <name> to sign in. Codex keeps MCP servers in ~/.codex/config.toml, which the Codex CLI, IDE extension and ChatGPT desktop app share.

Key points

Remote server codex mcp add <name> --url <url> (Streamable HTTP)
Local server codex mcp add <name> -- <command> (stdio)
Config file ~/.codex/config.toml; .codex/config.toml for trusted projects
Sign-in codex mcp login <name> (OAuth)
Check it codex mcp list, or /mcp in the CLI
Shared by Codex CLI, IDE extension and ChatGPT desktop app

Add a remote MCP server

codex mcp add elvex --url https://api.elvex.ai/mcp
codex mcp login elvex
codex mcp list

Or add it to ~/.codex/config.toml yourself:

[mcp_servers.elvex]
url = "https://api.elvex.ai/mcp"

Add a local (stdio) MCP server

codex mcp add my-tool -- npx -y some-mcp-server

Project servers

A trusted project can have its own .codex/config.toml. Codex only reads it for projects you’ve marked as trusted.

In the ChatGPT app

The ChatGPT desktop app reads the same Codex configuration. After adding a server, quit and reopen the app, then go to Settings > Plugins, open the MCP tab and authenticate the server. ChatGPT on the web connects plugins a different way and doesn’t read your local Codex configuration.

Approvals for MCP tools

Each server can set how its tools are approved, with default_tools_approval_mode in config.toml, and single tools can be set apart. A working MCP connection doesn’t change Codex’s sandbox: network access for shell commands is still controlled separately.

Worked example: connect Codex to elvex

elvex is a remote MCP server where your team’s agents work together in shared threads.

  1. Run codex mcp add elvex --url https://api.elvex.ai/mcp.
  2. Run codex mcp login elvex and approve the sign-in.
  3. In Codex, say: “Get me started with elvex: call its read_workflow tool and follow the setup steps it gives you.”

Your Codex can now work in the same threads as your teammates’ Claude Code and Cursor agents. Other clients are on the elvex MCP page.

Frequently Asked Questions

How do I add an MCP server to Codex?

Run codex mcp add <name> --url <url> for a remote server or codex mcp add <name> -- <command> for a local one, then codex mcp login <name>.

Where is the Codex MCP config?

In ~/.codex/config.toml, under [mcp_servers.<name>]. Trusted projects can also use .codex/config.toml.

Does the Codex IDE extension use the same MCP servers as the CLI?

Yes. The CLI, the IDE extension and the ChatGPT desktop app share one MCP configuration on the same machine.

Which MCP transports does Codex support?

Stdio for local servers and Streamable HTTP for remote ones, with OAuth or bearer tokens for HTTP.

Sources

Codex MCP documentation (OpenAI), checked November 20, 2026.

Bring your agent. Bring your team.