codex-mcp
v0.39.0MCP server bridging Claude Code and OpenAI Codex CLI for plan-execute-review workflows
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
codex_execute Execute a task with Codex
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.
| Parameter | Type | Description |
|---|---|---|
cwd * | string | Absolute path of the workspace Codex should work in |
prompt * | string | Task or plan for Codex to execute (can embed full plan text) |
model | string | Codex model override, e.g. gpt-5.1-codex |
reasoningEffort | string | Reasoning effort override for the selected model |
sandbox | string | Codex sandbox policy (default: workspace-write) |
terminal | boolean | Open a Terminal window streaming live progress (default: env CODEX_MCP_TERMINAL=1) |
timeoutMs | integer | Max execution time per attempt in ms; auto-resume may add attempts (default: 60 minutes) |
verifyCommand | string | Acceptance command the server runs in cwd AFTER the Codex run settles (e.g. the test suite). Its exit code and output tail are returned in `verification` — deterministic evidence, not Codex's claim. |
verifyTimeoutMs | integer | Max time for verifyCommand in ms (default 10 minutes, cap 30). |
writeNotes | boolean | Persist a markdown summary of this run to <cwd>/.codex-flow/notes/<sessionId>.md (default false). |
codex_continue Continue a Codex session
Resume an existing Codex session by sessionId with a follow-up prompt — typically review feedback that Codex should address. Preserves Codex context.
| Parameter | Type | Description |
|---|---|---|
cwd * | string | Absolute path of the workspace Codex should work in |
prompt * | string | Follow-up instruction, e.g. review findings to fix |
sessionId * | string | Session/thread id returned by a previous codex_execute call |
model | string | Codex model override |
reasoningEffort | string | Reasoning effort override for the selected model |
sandbox | string | Codex sandbox policy (default: workspace-write) |
terminal | boolean | Open a Terminal window streaming live progress (default: env CODEX_MCP_TERMINAL=1) |
timeoutMs | integer | Max execution time per attempt in ms; auto-resume may add attempts (default: 60 minutes) |
verifyCommand | string | Acceptance command the server runs in cwd AFTER the Codex run settles (e.g. the test suite). Its exit code and output tail are returned in `verification` — deterministic evidence, not Codex's claim. |
verifyTimeoutMs | integer | Max time for verifyCommand in ms (default 10 minutes, cap 30). |
writeNotes | boolean | Persist a markdown summary of this run to <cwd>/.codex-flow/notes/<sessionId>.md (default false). |
codex_review Review workspace changes with Codex
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.
| Parameter | Type | Description |
|---|---|---|
cwd * | string | Absolute path of the workspace to review |
baselineRef | string | Optional git ref to review from: Codex reviews `git diff <baselineRef>..HEAD` plus current uncommitted changes, so checkpoint/merge commits made since the baseline are covered. |
focus | string | Optional focus for the review, e.g. "security of the auth module" |
model | string | Codex model override |
reasoningEffort | string | Reasoning effort override for the selected model |
scope | object | Declared task scope. Findings gain `inScope` and reviewFindings gains `outOfScopeCount`; nothing is dropped, so an out-of-scope defect is still reported. |
terminal | boolean | Open a Terminal window streaming live progress (default: env CODEX_MCP_TERMINAL=1) |
timeoutMs | integer | Max execution time per attempt in ms; auto-resume may add attempts (default: 60 minutes) |
writeNotes | boolean | Persist a markdown summary of this run to <cwd>/.codex-flow/notes/<sessionId>.md (default false). |
codex_sessions List prior Codex sessions
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.
| Parameter | Type | Description |
|---|---|---|
cwd | string | Filter to sessions whose recorded cwd matches this path exactly. |
limit | integer | Cap on returned sessions (default 50, hard cap 500). |
codex_metrics Aggregated Codex run metrics
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.
| Parameter | Type | Description |
|---|---|---|
cwd | string | Filter by exact cwd. |
includeHistory | boolean | Also aggregate the archived history/*.jsonl files, not just the live + rotated log (default false). |
sessionId | string | Filter by session id. |
since | string | ISO 8601 lower bound — only entries at or after this timestamp are aggregated. |
tool | string | Filter by which tool produced the run. |
until | string | ISO 8601 upper bound. |
codex_batch Run multiple Codex tasks in parallel across workspaces
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.
| Parameter | Type | Description |
|---|---|---|
tasks * | array | Tasks to run in parallel, one per workspace. Each task uses its own cwd (must be unique in the batch). |
failFast | boolean | If true, cancel remaining tasks on the first failure. Default false (continue-on-error). |
maxConcurrency | integer | Cap on parallel tasks (default 10, hard cap 32). |
codex_health Check Codex CLI health
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.
| Parameter | Type | Description |
|---|---|---|
deep | boolean | Also run one bounded read-only `codex exec` probe and report execProbe/execProbeMessage (default: false) |