Codex
@ask-llm/codex-mcp default gpt-5.6-sol → fallback gpt-5.6-terra
OpenAI's Codex CLI is the workhorse reviewer of the pair: strongest code reasoning for targeted reviews, architecture critique, and diff analysis. Claude asks Codex; Codex asks Claude back through @ask-llm/claude-mcp.
Best for: targeted code reasoning, architecture critique, and security review of specific files, the default workhorse reviewer. Not for: whole-repository reads beyond its context window (use Gemini or Antigravity), or fully offline/air-gapped use (it's a hosted model; use Ollama).
Installation
1. Provider CLI
npm install -g @openai/codex2. Register the MCP server (Claude Code shown; see Quick Start for other clients)
claude mcp add --scope user codex -- npx -y @ask-llm/codex-mcpOr install globally: npm install -g @ask-llm/codex-mcp
Prerequisites
- Node.js v20.0.0 or higher
- Codex CLI installed and authenticated
Tools
| Tool | Purpose |
|---|---|
ask-codex | Send prompts to Codex CLI. Optional reasoningEffort; omit sessionId for an ephemeral call, pass sessionId: "" to start a persisted thread, or pass a returned thread ID to resume it |
ask-codex-edit | Propose structured code edits via a read-only codex exec --output-schema pass. Returns edit blocks for the calling client to apply |
get-usage-stats | Per-session token totals + breakdowns. In-memory |
ping | Fast connection test to verify MCP setup |
ask-codex returns both human-readable text and a structured AskResponse (provider, response, model, sessionId, usage) via MCP outputSchema. Calls are ephemeral by default for privacy: a Thread ID from a call that omitted sessionId is not resumable. To opt into continuity, pass sessionId: "" on the first call; its returned Thread ID is the same value as structuredContent.sessionId, and can be passed back on later calls.
Models
- Default:
gpt-5.6-sol(GPT-5.6 Sol flagship) - Quota fallback:
gpt-5.6-terra, the balanced GPT-5.6 tier - Overrides:
ASK_CODEX_MODEL,ASK_CODEX_FALLBACK_MODEL, or the per-callmodelparameter
Key Features
- GPT-5.6 Sol access via the official Codex CLI
- Reasoning control: ordinary calls default to
medium;/codex-reviewand/brainstormusehigh; direct calls can requestlow,medium,high,xhigh, ormax - Native session continuity: omit
sessionIdfor an ephemeral one-off call; passsessionId: ""on turn one to persist a thread, then pass its returnedthread_idon later turns. Follow-ups usecodex exec resume <id>with the stable-c sandbox_mode="<mode>"grammar (zero replay cost, Codex retains state). - Read-only, non-interactive sandbox: fresh calls use
codex exec --sandbox read-only; resumed calls use the equivalent supported config override-c sandbox_mode="read-only". Both keep second-opinion, review, and edit-proposal calls from modifying the workspace. Codexexecis non-interactive by definition, so no approval prompt can hang the MCP subprocess. The optionalsandbox: "workspace-write"parameter is a deliberate opt-out for flows that need Codex to write files (e.g./codex-image); review flows must not set it. - JSONL output parsing for structured responses + token usage
- Automatic quota fallback from GPT-5.6 Sol to Terra
- Structured AskResponse via outputSchema for programmatic clients
- Standard MCP transport works with 40+ clients
npm
- Package: @ask-llm/codex-mcp
- Binary:
ask-codex-mcp