codex

A guide for connecting the Codex command-line tool to MCP servers, which provide extra tools and data to an AI coding agent. It explains command-line and configuration-file setup.

In plain words
What is it for?
Use it to add a local MCP server, list registered servers, configure commands and environment variables, and ask Codex to use a specific information source.
Why use it?
It removes guesswork when registering, checking, and troubleshooting MCP servers in Codex projects or user 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/andreibrosmaster/ph-compliance-mcp/codex
Clone the repo
git clone --depth 1 https://github.com/andreibrosmaster/ph-compliance-mcp
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 383 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.00383
Opus 5 $0.00000 $0.00192
Sonnet 5 $0.00000 $0.00077
Haiku 4.5 $0.00000 $0.00038

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

Security

Grade B, and why

codex 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.

`~/.codex/config.toml` (user) or `./config.toml` (project):
docs/agents/codex.md · 52 lines

What it actually says

OpenAI Codex CLI

The Codex CLI (the codex binary) declares MCP servers in config.toml under [mcp_servers.NAME] sections. As of August 2026, the codex mcp add command writes these entries for you.

Quick start (CLI)

codex mcp add ph-compliance -- node /abs/path/ph-legal-mcp/dist/src/server.js
codex mcp list

Manual config.toml

~/.codex/config.toml (user) or ./config.toml (project):

[mcp_servers.ph-compliance]
command = "node"
args = ["/abs/path/ph-legal-mcp/dist/src/server.js"]
env = { PH_COMPLIANCE_CONFIDENCE_THRESHOLD = "0.5" }

Or via pnpm:

[mcp_servers.ph-compliance]
command = "pnpm"
args = ["--dir", "/abs/path/ph-legal-mcp", "start"]

Using it

Codex surfaces the tools as ordinary functions. For compliance questions it works best to name the corpus you expect:

Using the Philippine compliance MCP, list the exclusions to 13th-month pay
under PD 851 and cite the source.

Codex will call search_statute/search_issuance, pull exact text with get_provision, and (for a good answer) run cite_validate.

Troubleshooting

  • codex mcp list shows registered servers and enabled state.
  • If a tool errors, the raw server stderr appears in the Codex debug log (codex --debug).
  • The server is local-only stdio; no network egress is required at runtime.
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 · 52 lines · 0 tokens per session scan B c1ee7c1047d7

Subscribe to this mod's changes

codex is an agent published in the GitHub repository andreibrosmaster/ph-compliance-mcp (1 stars, last pushed 2d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 383 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-31.