codex-mcp
Summary: codex-mcp is a local MCP server that drives the Codex CLI to execute, continue, review, batch-run, and monitor coding tasks in a workspace, returning structured, redacted, JSONL-parsed results.
Execute tasks (
codex_execute): start a Codex session in a givencwdwith a prompt/plan, choose sandbox (read-only/workspace-writedefault/danger-full-access), model,reasoningEffort, per-attempttimeoutMs(up to 2h), and an optionalverifyCommand/verifyTimeoutMsfor deterministic acceptance evidence; returnssessionIdto reuse later.Continue sessions (
codex_continue): resume an existingsessionIdwith a follow-up prompt (typically review feedback) while preserving Codex context.Review changes (
codex_review): read-only review of uncommitted work, optionally from abaselineRef(git diff <ref>..HEAD), with afocus, and a declaredscope(files + contract) that annotates findingsinScopeand reportsoutOfScopeCount; returns severity-ordered findings plus improvements.Run tasks in parallel (
codex_batch): fan out 1–50 tasks across distinct cwds (e.g., git worktrees) with bounded concurrency (default 10, max 32), optionalfailFast, and one result per task in input order plus a summary.Discover sessions (
codex_sessions): list prior sessions stored under~/.codex/sessions/, newest first, filterable by exactcwdand capped bylimit(max 500).Aggregate metrics (
codex_metrics): roll up token usage, durations, and failures from~/.codex-mcp/metrics.jsonlwith filters (cwd,tool,sessionId,since/until,includeHistory); optionalestCostUsdviaCODEX_MCP_PRICING.Check health (
codex_health): report installed CLI version, login status, andauthMode(chatgpt/apikey/unknown), with an optionaldeepread-only exec probe to catch quota/model outages.Consume rich structured output:
sessionId,agentMessage,fileChanges, commands with exit codes, gitdiff,attribution, tokenusage,verificationresults,reviewFindings,warnings/errors, parse/unknown-event counts, andredactions.Rely on guardrails: sandboxed writes, always read-only reviews, secret redaction before results leave the server, per-cwd locks serializing runs, and local-only telemetry (note: pass
modelonly whenauthModeisapikey; otherwise steer withreasoningEffort).
Integrates with OpenAI Codex CLI to execute code tasks, review changes, and continue sessions, enabling a plan->execute->review workflow for AI agents.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@codex-mcp execute the plan in .codex-flow/PLAN.md"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
codex-mcp
Plan with Claude · Execute with OpenAI Codex · Review with Claude + Codex
A Claude Code plugin and MCP server for a repeatable plan → execute → review workflow.
macOS · Windows · Linux
What it is
Claude interviews you and turns the request into an acceptance-tested plan. Codex implements the planned tasks, while Claude and Codex review each task and the final result. That split matters because the model that writes the code is not the only one judging it: Claude plans and reviews, and a fresh read-only Codex session reviews too, all from a single command. Findings loop back into fixes, and non-blocking improvements wait for your decision. The MCP server runs the local Codex CLI and returns structured results for the workflow to use.
Six phases take a request from preflight through interview, plan, backlog, execution, and review.
76 skills are indexed and selected for the task instead of loading every skill into context.
Independent tasks can run in parallel in separate git worktrees.
Session reports record planning, allocation, task, cost, and summary files with PIC attribution.
Related MCP server: MCP-Claude Code Bridge
Quick start
Prerequisites. Install Node ≥ 20 and the Codex CLI, then authenticate with ChatGPT Plus/Pro/Team or an API key:
npm i -g @openai/codex codex login # Or set OPENAI_API_KEY instead of using codex login.Install the plugin. It bundles five commands, 76 skills, and the
codexMCP server:/plugin marketplace add anhnguyen0905/codex-mcp /plugin install codex-flow@codex-mcpThe community-directory alternative is:
claude plugin marketplace add anthropics/claude-plugins-community claude plugin install codex-flow@claude-communityFirst run. In a project, start with:
/codex-flow implement a dark-mode toggle on the settings page
For a standalone MCP server, see Standalone MCP server.
Auth mode. codex_health reports authMode: "chatgpt" | "apikey" | "unknown". The ChatGPT-auth backend rejects arbitrary model ids, so pass model only when authMode is apikey; otherwise omit it and steer with reasoningEffort. /codex-flow follows the same rule, and a flowDocs guard checks that wording.
Commands
Command | Purpose |
| Run the six-phase workflow from preflight to Claude + Codex review. |
| Frame, map, challenge, and ratify a read-only systems-thinking analysis. |
| Run the full flow with the |
| Run the full flow with the |
| Run the full flow with the |
How it works
Claude Code ──(MCP stdio)──▶ codex-mcp ──spawns──▶ codex exec --jsonPhase | Owner | What happens |
0 · Preflight | Claude | Verify Codex, baseline the workspace, and resume interrupted work. |
1 · Interview | Claude | Clarify requirements until acceptance criteria are verifiable. |
2 · Plan | Claude | Explore the codebase, select skills, and write the plan. |
3 · Backlog | Claude | Decompose the plan into dependency-ordered tasks. |
4 · Execute | Codex | Implement tasks serially or in parallel when independent. |
5 · Review | Claude + Codex | Compare reviews, fix findings, and gate non-blocking improvements. |
The server parses Codex’s JSONL event stream and returns a structured result through codex_execute, codex_continue, codex_review, codex_batch, codex_sessions, codex_metrics, and codex_health; see the MCP tools reference.
Highlights
Dual review and improvements gate. Claude and required
codex_reviewfindings are compared; non-blocking improvements wait for a user decision. Workflow referenceIndex-based skill selection. A local index selects relevant skills within a context budget, and third-party skills are vetted before use. Skill selection
Context persistence for large projects. Budgeted task slices and resume context carry anchored decisions and preserve mandatory task text. Context persistence
Parallel execution in git worktrees. Independent tasks run across workspaces, then merge and receive integration review by wave. Parallel execution
Executor fallback. When Codex is unavailable, the flow offers an explicit choice to repair Codex or let Claude execute under the same plan/review contract. Executor fallback
Per-session reports with PIC attribution. Each session leaves planning, allocation, task, cost, and summary reports marked
claude,codex, orboth. Session reports
Documentation
Document | Use it for |
Phases, commands, state, skill selection, context, and reports. | |
Tool inputs, results, review behavior, redaction, and execution controls. | |
Environment variables, standalone setup, optional flint-chart, and troubleshooting. | |
Release history. | |
Vulnerability reporting. |
Security & privacy
No credentials handled. The server never reads, stores, or transmits credentials; authentication is handled entirely by the Codex CLI (
~/.codex/); runnpm run doctorto verify setup.No network calls of its own. The server spawns local
codexandgit; model traffic is Codex's, under your OpenAI account and its data policies.Local-only telemetry. Run metrics (tokens, durations, exit codes, and a 200-character error head) are appended to
~/.codex-mcp/metrics.jsonlon your machine and never uploaded; logs and notes stay under gitignored.codex-flow/.Sandboxed writes.
workspace-writeis the default,codex_reviewis alwaysread-only,danger-full-accessis never used unless needed and disclosed, and per-cwd locks serialize runs.Caller-defined
verifyCommand. Its redacted output tail is shell output and should be treated as such; third-party skills load only after a content-pinned vet.Vulnerability reports. Follow SECURITY.md.
Secret-redacted results. Returned text is redacted before it leaves the server; see Secret redaction.
Development
npm test # unit tests
npm run coverage # enforces 80% thresholds
npm run build # tsc → dist/
npm run test:e2e # spawns Codex and uses quota
npm run data:guard # scans for real data before a commitKey files:
Area | File | Role |
Server |
| stdio entry |
Server |
| MCP tools, cwd lock, cancellation |
Server |
| Codex argv |
Server |
| spawn, timeout, and kill |
Server |
| JSONL → result |
Server |
| git diff |
Server |
| live progress |
Server |
| secret redaction |
Server |
| review findings |
Server |
| acceptance verification |
Workflow |
| sync skill library |
Workflow |
| build skill index |
Workflow |
| match and evaluate skills |
Workflow |
| compute execution waves |
Workflow |
| session cost reporting |
Workflow |
| live progress tail |
Workflow |
| validate run state |
Workflow |
| generate context slices |
Available Tools
7 toolscodex_batchRun multiple Codex tasks in parallel across workspacesA
Fan out N tasks across N cwds (typically git worktrees) with a bounded concurrency limit. Each task uses its own per-cwd lock, so callers must supply distinct cwds. Returns one result entry per input task in input order.
Inputs: tasks (required), failFast, maxConcurrency. Returns: tasks, total, failed, summary, +1 more
codex_continueContinue a Codex sessionB
Resume an existing Codex session by sessionId with a follow-up prompt — typically review feedback that Codex should address. Preserves Codex context.
Inputs: cwd (required), prompt (required), sessionId (required), model, +7 more. Returns: diff, runId, usage, errors, +25 more
codex_executeExecute a task with CodexA
Start a new Codex session that executes a plan/task in the given workspace. Returns sessionId (keep it to send review feedback later), agent message, file changes and commands run.
Inputs: cwd (required), prompt (required), model, sandbox, +6 more. Returns: diff, runId, usage, errors, +25 more
codex_healthCheck Codex CLI healthA
Report installed Codex CLI version and login status. With deep=true, also run one bounded read-only Codex exec probe to detect quota/model outages that login status cannot see.
Inputs: deep. Returns: version, authMode, loggedIn, execProbe, +4 more
codex_metricsAggregated Codex run metricsA
Roll up token/duration/failure counts from the local metrics log (~/.codex-mcp/metrics.jsonl). Set CODEX_MCP_PRICING (JSON: {inputPer1M, cachedInputPer1M, outputPer1M, reasoningOutputPer1M}) to include estCostUsd.
Inputs: cwd, tool, since, until, +2 more.
codex_reviewReview workspace changes with CodexA
Ask Codex to review the uncommitted changes in a workspace (read-only sandbox, no files modified). Returns findings ordered by severity plus a sessionId usable with codex_continue.
Inputs: cwd (required), focus, model, scope, +5 more. Returns: diff, runId, usage, errors, +25 more
codex_sessionsList prior Codex sessionsA
Discover Codex sessions stored locally under ~/.codex/sessions/. Returns sessionId, cwd, and last activity for each, newest first. sessionId can be passed to codex_continue to resume. Filter by cwd to find sessions from a specific workspace.
Inputs: cwd, limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool maps to a distinct lifecycle stage: discovery (sessions), new execution (execute), resumption (continue), read-only review, batch fan-out, health, and metrics. The only mild overlap is execute vs batch and review vs execute, but descriptions make boundaries clear.
All names use snake_case with a consistent codex_ prefix, which is predictable. Suffixes mix nouns (sessions, health, metrics) and verbs (execute, continue, review), so it is not a pure verb_noun pattern.
Seven tools is well within the ideal 3-15 range and each covers a distinct operational need for a Codex CLI wrapper. No obvious filler.
Core workflows—discover, execute, continue, review, batch, health, metrics—are covered. Minor gaps include no explicit cancel/abort for running sessions and no detailed session inspection beyond listing, but agents can work around these.
Maintenance
Related MCP Connectors
Source-checked CLI guides and model-aware planning for Claude Code, Codex, and Grok Build.
Your AI apps as one team: hand work to Codex or Claude Code on your Mac, with a shared logbook.
Your AI mind directs coding agents; work reviewed against your memories: Claude Code, Codex, Cursor
Multi-brand AI code review for Claude: up to 12 reviewers and a judge, no install.
Related MCP Servers
- AlicenseCqualityCmaintenanceConnects AI assistants like Claude to the Codex CLI for code analysis, editing, and execution. Supports file references with @ syntax, sandboxed code execution with approval workflows, and structured code changes for automated refactoring and documentation.8126 npm177MIT
- FlicenseBqualityDmaintenanceBridges Claude Desktop with Claude Code CLI to delegate complex coding tasks like creating React apps, building APIs, and debugging scripts while maintaining interaction through the Desktop interface.51-
- AlicenseAqualityDmaintenanceBridges Claude and OpenAI's Codex CLI for AI-powered code analysis, generation, and review, with support for session management, web search, and structured output.61,338 npm651ISC
- AlicenseBqualityDmaintenanceMCP bridge for using local Claude CLI as a bounded reviewer and analysis delegate for Codex.5MIT