codex-mcp

v0.39.0
@anhnguyen0905/codex-mcp Checked 15 hours ago Published 5 days ago

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

ParameterTypeDescription
cwd *stringAbsolute path of the workspace Codex should work in
prompt *stringTask or plan for Codex to execute (can embed full plan text)
modelstringCodex model override, e.g. gpt-5.1-codex
reasoningEffortstringReasoning effort override for the selected model
sandboxstringCodex sandbox policy (default: workspace-write)
terminalbooleanOpen a Terminal window streaming live progress (default: env CODEX_MCP_TERMINAL=1)
timeoutMsintegerMax execution time per attempt in ms; auto-resume may add attempts (default: 60 minutes)
verifyCommandstringAcceptance 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.
verifyTimeoutMsintegerMax time for verifyCommand in ms (default 10 minutes, cap 30).
writeNotesbooleanPersist 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.

ParameterTypeDescription
cwd *stringAbsolute path of the workspace Codex should work in
prompt *stringFollow-up instruction, e.g. review findings to fix
sessionId *stringSession/thread id returned by a previous codex_execute call
modelstringCodex model override
reasoningEffortstringReasoning effort override for the selected model
sandboxstringCodex sandbox policy (default: workspace-write)
terminalbooleanOpen a Terminal window streaming live progress (default: env CODEX_MCP_TERMINAL=1)
timeoutMsintegerMax execution time per attempt in ms; auto-resume may add attempts (default: 60 minutes)
verifyCommandstringAcceptance 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.
verifyTimeoutMsintegerMax time for verifyCommand in ms (default 10 minutes, cap 30).
writeNotesbooleanPersist 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.

ParameterTypeDescription
cwd *stringAbsolute path of the workspace to review
baselineRefstringOptional 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.
focusstringOptional focus for the review, e.g. "security of the auth module"
modelstringCodex model override
reasoningEffortstringReasoning effort override for the selected model
scopeobjectDeclared task scope. Findings gain `inScope` and reviewFindings gains `outOfScopeCount`; nothing is dropped, so an out-of-scope defect is still reported.
terminalbooleanOpen a Terminal window streaming live progress (default: env CODEX_MCP_TERMINAL=1)
timeoutMsintegerMax execution time per attempt in ms; auto-resume may add attempts (default: 60 minutes)
writeNotesbooleanPersist 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.

ParameterTypeDescription
cwdstringFilter to sessions whose recorded cwd matches this path exactly.
limitintegerCap 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.

ParameterTypeDescription
cwdstringFilter by exact cwd.
includeHistorybooleanAlso aggregate the archived history/*.jsonl files, not just the live + rotated log (default false).
sessionIdstringFilter by session id.
sincestringISO 8601 lower bound — only entries at or after this timestamp are aggregated.
toolstringFilter by which tool produced the run.
untilstringISO 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.

ParameterTypeDescription
tasks *arrayTasks to run in parallel, one per workspace. Each task uses its own cwd (must be unique in the batch).
failFastbooleanIf true, cancel remaining tasks on the first failure. Default false (continue-on-error).
maxConcurrencyintegerCap 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.

ParameterTypeDescription
deepbooleanAlso run one bounded read-only `codex exec` probe and report execProbe/execProbeMessage (default: false)