AdYour product here, seen by people installing AI tools every day Sponsor slots open: 12 of 12, from $249 a month

How to add an MCP server to Codex

In Codex, run codex mcp add <name> -- <command> in a terminal, or add a [mcp_servers.name] section to ~/.codex/config.toml. Type /mcp inside Codex to see connected servers and their tools.

With one command

codex mcp add playwright -- npx -y @playwright/mcp@latest

For a server that needs a key, add --env API_KEY=your-key before the --.

In the config file

[mcp_servers.my-server]
command = "npx"
args = ["-y", "package-name"]
env = { "API_KEY" = "your-key" }

Check it

Start Codex and type /mcp. Every server page on this site has the matching codex mcp add command.

Questions

Is the Codex config shared with the Codex IDE extension?

Codex reads the same config.toml in your home folder, so servers added there are available wherever Codex runs on that computer.