codex-mcp

A configuration guide for adding MCP servers to Codex. MCP, or Model Context Protocol, lets an AI tool connect to external programs and services; the guide uses TOML settings in the user's Codex configuration file.

In plain words
What is it for?
Use it when registering an MCP server in Codex, including its launcher command, command-line arguments, environment variables, or startup timeout.
Why use it?
It explains where the configuration belongs and how server commands, arguments, environment variables, and startup limits should be written. This avoids malformed or misplaced server settings.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/aqualia/alph/codex-mcp
Clone the repo
git clone --depth 1 https://github.com/Aqualia/Alph
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,257 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02257
Opus 5 $0.00000 $0.01128
Sonnet 5 $0.00000 $0.00451
Haiku 4.5 $0.00000 $0.00226

Measured 2d ago against content hash c43e41772b0f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

codex-mcp scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

* **Global file:** `~/.codex/config.toml` (single, user-level config). The project README explicitly points to this path and instructs adding an `mcp_servers` section there. ([GitHub][1])
docs/agents/codex-mcp.md · 152 lines

How it starts

The opening of the file, as written. The whole thing — 152 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Codex CLI — MCP Server Configuration (Exhaustive Reference)

1) Where configuration lives

  • Global file: ~/.codex/config.toml (single, user-level config). The project README explicitly points to this path and instructs adding an mcp_servers section there. ([GitHub][1])
  • Project/workspace files: Not currently supported; several issues request per-project config, confirming that all config is read from ~/.codex/config.toml today. ([GitHub][2])
  • Windows path example: C:\Users\<User>\.codex\config.toml (from user reports; same file name, user home directory). ([GitHub][3])

Note: Some users have observed a config.json in the directory; the docs and most reports use config.toml for authoritative configuration. ([GitHub][4])


2) MCP section: structure & syntax

Add MCP servers under a TOML table named mcp_servers, with one sub-table per server:

# ~/.codex/config.toml

[mcp_servers.<server_name>]
command = "<executable or launcher>"
args    = ["<arg1>", "<arg2>", "..."]
env     = { KEY = "value", OTHER = "value" }
startup_timeout_ms = 20000  # optional
  • This mcp_servers schema and field set are the documented way to declare MCP servers for Codex CLI. ([GitHub][1])
  • Real-world examples in issues use this exact shape (see samples below). ([GitHub][5])

2.1 Required & optional fields

Key Type Required Purpose
command string Yes Program Codex should launch for the MCP server (e.g., npx, node, php, or the server binary). ([GitHub][5])
args array<string> No Arguments passed to command (e.g., package name for npx, script path for node, or server flags). ([GitHub][5])
env table No Environment variables for the launched process (e.g., API keys). ([GitHub][5])
startup_timeout_ms integer (ms) No How long Codex waits for this MCP server to come up and enumerate tools before treating startup as a timeout. (Default behavior times out fairly quickly; Windows users often raise this.) ([GitHub][6])

Read the full file on GitHub · 152 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 152 lines · 0 tokens per session scan B c43e41772b0f

Subscribe to this mod's changes

codex-mcp is an agent published in the GitHub repository Aqualia/Alph (69 stars, last pushed 7mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,257 tokens. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.