# Codex MCP: How to Add an MCP Server to Codex

[Muhammad Shakil](https://skryvo.ai/about/) · Founder of Skryvo

October 22, 2026 · 6 min read

**In this guide**

1. [What is MCP in Codex?](https://skryvo.ai/blog/codex-mcp/#what-is-mcp-in-codex)
2. [How do I add an MCP server to Codex?](https://skryvo.ai/blog/codex-mcp/#how-do-i-add-an-mcp-server-to-codex)
3. [How do I set up MCP servers in config.toml?](https://skryvo.ai/blog/codex-mcp/#how-do-i-set-up-mcp-servers-in-config-toml)
4. [How do I sign in to a remote MCP server in Codex?](https://skryvo.ai/blog/codex-mcp/#how-do-i-sign-in-to-a-remote-mcp-server-in-codex)
5. [Do the Codex CLI, IDE extension and app share MCP servers?](https://skryvo.ai/blog/codex-mcp/#do-the-codex-cli-ide-extension-and-app-share-mcp-servers)
6. [How do I control which MCP tools Codex can run?](https://skryvo.ai/blog/codex-mcp/#how-do-i-control-which-mcp-tools-codex-can-run)
7. [Why is my MCP server not working in Codex?](https://skryvo.ai/blog/codex-mcp/#why-is-my-mcp-server-not-working-in-codex)
8. [Can you run Codex as an MCP server?](https://skryvo.ai/blog/codex-mcp/#can-you-run-codex-as-an-mcp-server)
9. [A worked example: posting from Codex](https://skryvo.ai/blog/codex-mcp/#a-worked-example-posting-from-codex)

Share [X](https://twitter.com/intent/tweet?text=Codex%20MCP%3A%20How%20to%20Add%20an%20MCP%20Server%20to%20Codex&url=https%3A%2F%2Fskryvo.ai%2Fblog%2Fcodex-mcp%2F) [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fskryvo.ai%2Fblog%2Fcodex-mcp%2F) [Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fskryvo.ai%2Fblog%2Fcodex-mcp%2F)

Checked against OpenAI's Codex docs on October 22, 2026.

Codex uses MCP (Model Context Protocol) servers to reach tools outside your repository: documentation, a browser, Figma, a publishing tool. You add a server once and the Codex CLI, the IDE extension and the ChatGPT desktop app all use it, because they read the same configuration.

**The short version:** run `codex mcp add <name> -- <command>` for a local server, or `codex mcp add <name> --url <url>` for a remote one, then `codex mcp login <name>` if it uses OAuth. Codex writes the server to `~/.codex/config.toml`, where you can also edit it by hand. Type `/mcp` in Codex to see which servers are running. Everything below is from [OpenAI's Codex MCP documentation](https://learn.chatgpt.com/docs/extend/mcp?surface=cli), checked October 22, 2026.

## What is MCP in Codex?

An MCP server exposes a few named tools; Codex decides when to call them while it works, the same way it runs shell commands. Codex supports two kinds of server:

- **STDIO:** a local process Codex starts with a command, such as an `npx` package.
- **Streamable HTTP:** a server you reach at a URL, often run by the service itself and signed into with OAuth.

## How do I add an MCP server to Codex?

For a local server, put the command after `--`. This adds Context7, a documentation server:

```
codex mcp add context7 -- npx -y @upstash/context7-mcp
```

Pass environment variables with `--env`, for example `--env API_KEY=...`, before the `--`. For a remote server, give its URL instead of a command:

```
codex mcp add skryvo --url https://api.skryvo.ai/mcp
```

Then check it with `codex mcp list`, and run `codex mcp --help` for every MCP subcommand your version has.

## How do I set up MCP servers in config.toml?

Each server is a `[mcp_servers.<name>]` table in `~/.codex/config.toml`. A project can also have its own `.codex/config.toml`, which Codex reads only for trusted projects. These three entries are adapted from OpenAI's examples:

```
[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp"]
env_vars = ["LOCAL_TOKEN"]

[mcp_servers.figma]
url = "https://mcp.figma.com/mcp"
bearer_token_env_var = "FIGMA_OAUTH_TOKEN"

[mcp_servers.chrome_devtools]
url = "http://localhost:3000/mcp"
enabled_tools = ["open", "screenshot"]
default_tools_approval_mode = "prompt"
```

A local server needs `command`; `args`, `env`, `env_vars` and `cwd` are optional. A remote server needs `url`, and can take `bearer_token_env_var` or `http_headers` when it uses a static token instead of OAuth.

## How do I sign in to a remote MCP server in Codex?

Run `codex mcp login <name>`. Codex opens the service's sign-in page, and the service shows its own consent screen. Codex registers itself with the server by Client ID Metadata Document when the server supports it, otherwise by Dynamic Client Registration; add `--oauth-client-registration cimd` or `dcr` to choose. If a server gave you a client ID already, pass `--oauth-client-id` when you add it and Codex skips registration. Servers that use a fixed token instead take it from an environment variable named in `bearer_token_env_var`, so the token never sits in the file.

## Do the Codex CLI, IDE extension and app share MCP servers?

Yes. The Codex CLI, the IDE extension and the ChatGPT desktop app read the same MCP configuration, so a server added in one is there in the others. Type `/mcp` in the Codex terminal or in the desktop app's composer to list the connected servers. ChatGPT on the web is the exception: it does not read local Codex files and uses MCP tools through plugins instead, which [our ChatGPT setup page](https://skryvo.ai/agents/chatgpt/) walks through.

Skryvo writes posts and articles in your brand's voice and publishes them for you. [Start for $0](https://skryvo.ai/signup/) 7 days free, no card needed

## How do I control which MCP tools Codex can run?

- **`enabled_tools`** is an allow list; **`disabled_tools`** is a deny list applied after it.
- **`default_tools_approval_mode`** sets when Codex asks before calling a tool: `auto`, `prompt`, `writes` (asks only for tools not marked read-only) or `approve`.
- **`tools.<tool>.approval_mode`** overrides that for one tool, and `tools.<tool>.output_token_limit` caps how much of its output enters the conversation.

For any server that can change something outside your machine, such as posting, sending or deleting, `writes` is a sensible default: reads run freely and every write waits for you.

## Why is my MCP server not working in Codex?

- **It is slow to start.** Codex waits 10 seconds by default. A first `npx` run that downloads a package can take longer; raise `startup_timeout_sec`.
- **A tool call times out.** The default is 60 seconds; raise `tool_timeout_sec` for slow tools.
- **It fails silently.** Set `required = true` on a server Codex should not run without, and startup will stop with an error instead.
- **The project config is ignored.** `.codex/config.toml` is read only in trusted projects.
- **It works in the CLI but not on the web.** ChatGPT on the web does not read Codex's config at all.

Run `/mcp` after each change to confirm the server is listed.

## Can you run Codex as an MCP server?

Not any more. OpenAI's documentation now says the `codex mcp-server` command and the standalone `codex-mcp-server` binary have been removed, so guides that show Codex being called from Claude Code or the Agents SDK as an MCP server describe something that no longer ships. `codex mcp` now only manages the servers Codex connects to.

## A worked example: posting from Codex

Skryvo is a remote MCP server for social media, so it shows the whole remote flow:

```
codex mcp add skryvo --url https://api.skryvo.ai/mcp
codex mcp login skryvo
```

After signing in, ask Codex "Draft an X thread about the bug we just fixed and schedule it for tomorrow at 9am." It drafts the thread in your brand's voice, shows it, and schedules it only after you agree; the [Codex setup page](https://skryvo.ai/agents/codex/) has the details. The same server works in Claude, where it is a connector (see [how to add Claude connectors](https://skryvo.ai/blog/claude-connectors/)), and in Cursor and other agents listed on [the agents page](https://skryvo.ai/agents/).

Start with one server you will use every day, keep its approval mode on `writes` for a week, and widen it only for the tools you have watched work.

Related: [the OpenAI Dots plugin](https://skryvo.ai/agents/openai-dots/), [VS Code MCP](https://skryvo.ai/blog/vscode-mcp/).

## Do this in Skryvo

- [Codex MCP server for social media](https://skryvo.ai/agents/codex/)
- [Add a connector in Claude](https://skryvo.ai/blog/claude-connectors/)
- [MCP connectors for every AI agent](https://skryvo.ai/agents/)

About the author

### [Muhammad Shakil](https://skryvo.ai/about/) Founder of Skryvo

I wrote this myself. I have built mobile apps and websites for companies in the US and Europe since 2022, and I built Skryvo after one too many AI drafts fell apart the moment someone checked a fact. Everything I publish here is tested on my own work first, and I show the numbers, including the ones that did not go my way.

[LinkedIn](https://www.linkedin.com/in/flutterdeveloper1/) [X](https://x.com/MShakilAwan3) [Full bio](https://skryvo.ai/about/) [All articles](https://skryvo.ai/blog/)

Read Skryvo often? [Add Skryvo as a preferred source on Google](https://www.google.com/preferences/source?q=skryvo.ai) and our articles are more likely to show up for you.

## Keep reading

[All guides](https://skryvo.ai/blog/)

AI Agents · 7 min read

### [Best Social Media MCP Servers and Connectors (2026)](https://skryvo.ai/blog/best-social-media-mcp-servers/)

Seven social media MCP servers and connectors compared from their own docs: Buffer, Metricool, Postiz, Zernio, Blotato, Ayrshare and Skryvo, by channels, sign-in, price, approval.

AI Agents · 8 min read

### [Perplexity MCP: Official Server, URL, Pricing and Setup](https://skryvo.ai/blog/perplexity-mcp/)

Perplexity MCP both ways: its official server in Claude Code, Cursor, Claude Desktop and Docker, what each tool runs on, and adding MCP connectors to Perplexity.

AI Agents · 7 min read

### [Claude Code MCP: How to Add MCP Servers (claude mcp add)](https://skryvo.ai/blog/claude-code-mcp/)

Add MCP servers to Claude Code with claude mcp add, pick the right scope, share .mcp.json with a team, sign in with /mcp and fix timeouts.

## Turn ideas like these into posts

Skryvo writes posts and articles in your brand's voice and publishes them to your channels, from the app or your AI agent.

[Start for $0](https://skryvo.ai/signup/) [See how it works](https://skryvo.ai/features/)

- 7 days free, no card needed
