codex-mcp-tool
v2.7.0MCP server bridging AI assistants to OpenAI Codex CLI for code analysis and review
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
ask-codex
Execute Codex CLI with file analysis (@syntax), skills ($syntax), model selection, and safety controls. Supports changeMode.
| Parameter | Type | Description |
|---|---|---|
prompt * | string | Task or question. Use @ to include files (e.g., '@largefile.ts explain'). |
addDirs | array | Additional writable directories beyond workspace (e.g., ["/tmp", "/var/log"]). Useful for monorepos and multi-directory projects. |
approval | string | Deprecated alias for approvalPolicy — both map to --ask-for-approval. Prefer approvalPolicy. Values: on-request, never |
approvalPolicy | string | Approval policy (-a): never, on-request. Note: non-interactive `codex exec` runs report `approval: never` even with on-request, since nobody can answer a prompt. |
bypassHookTrust | boolean | DANGEROUS: run enabled hooks without persisted hook trust |
cd | string | Working directory |
changeMode | boolean | Return structured OLD/NEW edits for refactoring |
chunkCacheKey | string | Cache key for continuation |
chunkIndex | number | Chunk index (1-based) |
config | Configuration overrides as 'key=value' string or object | |
disableFeatures | array | Disable feature flags (repeatable). Equivalent to -c features.<name>=false |
enableFeatures | array | Enable feature flags (repeatable). Equivalent to -c features.<name>=true |
ephemeral | boolean | Run without persisting Codex session files to disk |
fullAuto | boolean | Compatibility alias for workspace-write with approval=never (not --yolo) |
ignoreRules | boolean | Ignore user and project execpolicy .rules files for this run |
ignoreUserConfig | boolean | Ignore $CODEX_HOME/config.toml for this run; authentication is still loaded |
image | Optional image file path(s) to include with the prompt | |
includeMetadata | boolean | Include configuration metadata in response |
includeThinking | boolean | Include reasoning/thinking section in response |
localProvider | string | Specify which local provider to use (lmstudio or ollama). Automatically enables --oss if not set. If omitted with --oss, uses config default or shows selection. |
model | string | Optional model override. Known: gpt-6.1-sol, gpt-6-astra, gpt-6.1-terra, gpt-6-sol, gpt-6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna. If omitted, uses your Codex CLI default (~/.codex/config.toml)… |
oss | boolean | Use local Ollama server (convenience for -c model_provider=oss). Requires Ollama running locally. Automatically sets sandbox to workspace-write if not specified. |
outputLastMessage | string | Write final Codex message to file path. Useful for CI/CD result capture (Codex CLI v0.95.0+) |
outputSchema | JSON Schema path or inline schema to constrain output format (Codex CLI v0.95.0+) | |
personality | string | Communication style: pragmatic (concise, machine-friendly), friendly (conversational) or none (no personality instructions) |
profile | string | Config profile (-p <name>): layers $CODEX_HOME/<name>.config.toml over the base config. Legacy [profiles.<name>] tables in config.toml make the CLI refuse the run. |
reasoningEffort | string | Reasoning depth. Omit to use the CLI default. max/ultra are model-dependent GPT-6/GPT-5.6 options; ultra may delegate to subagents. |
resetSession | boolean | Clear session context before execution. Starts fresh conversation. |
responseMode | string | Response verbosity: "clean" returns only the final answer (default), "full" returns the complete execution log including thinking, tool calls, and agent activity |
sandbox | boolean | Quick automation mode: enables workspace-write with approval=never. Sandboxing remains active. |
sandboxMode | string | Access: read-only, workspace-write, danger-full-access |
search | boolean | Enable web search using native --search flag (v0.52.0+). Requires network access - automatically sets sandbox to workspace-write if not specified. |
sessionId | string | Session ID for conversation continuity. Enables native Codex resume. |
skipGitRepoCheck | boolean | Skip git repository validation. Useful for non-git directories (Codex CLI v0.75.0+) |
strictConfig | boolean | Fail when config.toml contains fields unknown to the installed Codex CLI |
timeout | integer | Maximum execution time in milliseconds (optional) |
toolOutputTokenLimit | number | Maximum tokens for tool outputs (100-10,000). Controls response verbosity. |
workingDir | string | Working directory for execution |
yolo | boolean | ⚠️ Bypass all safety (dangerous) |
batch-codex
Delegate multiple atomic tasks to Codex for batch processing. Ideal for repetitive operations, mass refactoring, and automated code transformations
| Parameter | Type | Description |
|---|---|---|
tasks * | array | Array of atomic tasks to delegate to Codex |
concurrency | integer | Maximum parallel Codex processes when parallel=true. Default: min(task count, 4) |
disableFeatures | array | Disable feature flags |
enableFeatures | array | Enable feature flags |
model | string | Optional model override applied to every task. Known: gpt-6.1-sol, gpt-6-astra, gpt-6.1-terra, gpt-6-sol, gpt-6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna. If omitted, uses your Codex CLI default… |
oss | boolean | Use local Ollama server |
parallel | boolean | Execute independent tasks in parallel |
sandbox | string | Sandbox mode: read-only, workspace-write, danger-full-access |
search | boolean | Enable live web search for all tasks using the native --search flag |
stopOnError | boolean | Stop execution if any task fails |
timeout | integer | Maximum execution time per task in milliseconds |
workingDir | string | Working directory for execution |
review-changes
Run a code review against the current repository using Codex CLI native review subcommand
| Parameter | Type | Description |
|---|---|---|
base | string | Review changes against a specific base branch (e.g., "main", "develop") |
commit | string | Review the changes introduced by a specific commit SHA |
model | string | Optional model override. Known: gpt-6.1-sol, gpt-6-astra, gpt-6.1-terra, gpt-6-sol, gpt-6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna. If omitted, uses your Codex CLI default (~/.codex/config.toml)… |
prompt | string | Custom review instructions or focus areas (cannot be used with uncommitted=true; use base/commit review instead) |
reasoningEffort | string | Reasoning depth for the review. Default: high (code review benefits from deep reasoning). |
timeout | integer | Maximum execution time in milliseconds |
title | string | Optional title to display in the review summary |
uncommitted | boolean | Review staged, unstaged, and untracked changes (working tree) - cannot be combined with custom prompt |
workingDir | string | Working directory to run the review in (passed via -C as a global Codex option) |
ping
Echo
| Parameter | Type | Description |
|---|---|---|
prompt | string | Message to echo |
help
receive help information
version
Display version and system information
brainstorm
Generate creative ideas using structured frameworks with domain context and feasibility analysis.
| Parameter | Type | Description |
|---|---|---|
prompt * | string | Brainstorming challenge or question |
approvalPolicy | string | Approval policy (-a): never, on-request. Note: non-interactive `codex exec` runs report `approval: never` even with on-request, since nobody can answer a prompt. |
cd | string | Working directory |
constraints | string | Limitations: budget, time, technical, legal, etc. |
disableFeatures | array | Disable feature flags |
domain | string | Domain: software, business, creative, research, product, marketing, etc. |
enableFeatures | array | Enable feature flags |
existingContext | string | Background info or previous attempts |
fullAuto | boolean | Compatibility alias for workspace-write with approval=never |
ideaCount | integer | Number of ideas (default: 12, range: 5-30) |
includeAnalysis | boolean | Include feasibility/impact analysis |
localProvider | string | Specify which local provider to use (lmstudio or ollama). Automatically enables --oss if not set. |
methodology | string | Framework: divergent, convergent, scamper, design-thinking, lateral, auto (default) |
model | string | Optional model override. Known: gpt-6.1-sol, gpt-6-astra, gpt-6.1-terra, gpt-6-sol, gpt-6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna. If omitted, uses your Codex CLI default (~/.codex/config.toml)… |
oss | boolean | Use local Ollama server |
personality | string | Communication style: pragmatic (concise, machine-friendly), friendly (conversational) or none (no personality instructions) |
reasoningEffort | string | Reasoning depth. Default: high (creative ideation benefits from depth). Override with "xhigh" for very complex domains, "medium" for quick exploration. |
sandboxMode | string | Access: read-only, workspace-write, danger-full-access |
search | boolean | Enable live web search using the native --search flag |
yolo | boolean | ⚠️ Bypass all safety (dangerous) |
fetch-chunk
Retrieves cached chunks from a changeMode response. Use this to get subsequent chunks after receiving a partial changeMode response.
| Parameter | Type | Description |
|---|---|---|
cacheKey * | string | The cache key provided in the initial changeMode response |
chunkIndex * | number | Which chunk to retrieve (1-based index) |
list-sessions
List all active conversation sessions with metadata, or manage sessions
| Parameter | Type | Description |
|---|---|---|
action | string | Action: list (default), delete (single session), clear (all sessions) |
sessionId | string | Session ID for delete action |
workingDir | string | With delete: remove only the session for this directory. Without it, every session with that ID is removed (one sessionId can exist once per directory). |
health
Check Codex CLI and session health status
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Optional session ID to check specific session health |
verbose | boolean | Include detailed diagnostic information |
list-skills
Discover available Codex skills: project .agents/skills and .codex/skills, plus user $CODEX_HOME/skills and ~/.agents/skills
| Parameter | Type | Description |
|---|---|---|
workingDir | string | Working directory to search for skills. Defaults to resolved working directory. |
do-act
Execute task via Codex, verify with shell command, auto-fix on failure. Act-Check-Fix loop.
| Parameter | Type | Description |
|---|---|---|
task * | string | Task for Codex to execute |
fullAuto | boolean | Compatibility alias for workspace-write with approval=never |
localProvider | string | |
maxRetries | integer | Max retry attempts if verify fails. Default: 2 |
model | string | Optional model override. Known: gpt-6.1-sol, gpt-6-astra, gpt-6.1-terra, gpt-6-sol, gpt-6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna. If omitted, uses your Codex CLI default (~/.codex/config.toml)… |
oss | boolean | Use local Ollama/LM Studio |
reasoningEffort | string | Reasoning depth. Default: high (act-check-fix loops benefit from depth so retries converge). Override with "xhigh" for hard tasks, "medium" for simple verifiable steps. |
sandboxMode | string | Access: read-only, workspace-write, danger-full-access |
timeout | integer | Codex timeout per attempt in ms. Default: 10min |
verify | object | Shell command to validate result. Triggers act-check-fix loop on failure. |
workingDir | string | Working directory |
image-gen
Generate or edit images with Codex's built-in image_gen tool (ChatGPT login, no API key). Builds a structured prompt from use case, style, composition, exact text, reference roles and edit invariants, then returns the saved file paths. The image model and pixel size are chosen by Codex; aspect ratio and transparency are requested through the prompt.
| Parameter | Type | Description |
|---|---|---|
prompt * | string | What to create, or for edits, what to change. Be concrete about the subject. |
aspect | string | Aspect ratio: square, landscape (3:2), portrait (2:3), wide (16:9), tall (9:16), or W:H. Requested via the prompt; exact pixel size is chosen by Codex. |
assetType | string | Where the image will be used, e.g. "landing page hero", "app store screenshot" |
avoid | array | Things that must not appear |
composition | string | Framing, viewpoint, placement, negative space |
editImage | string | Image to edit (absolute or relative to workingDir). Switches to edit mode. |
enhance | boolean | Let the Codex host model enrich generic prompts with composition/lighting detail (never adds new subjects or text). false = pass the spec verbatim. |
lighting | string | Lighting and mood |
materials | string | Materials and textures |
model | string | Host model that relays the call (not the image model). Known: gpt-6.1-sol, gpt-6-astra, gpt-6.1-terra, gpt-6-sol, gpt-6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna. Omit to use the Codex default. |
outputPath | string | Copy results here (relative to workingDir). A path ending in / is a directory. Without it, images stay in $CODEX_HOME/generated_images. |
overwrite | boolean | Overwrite an existing outputPath instead of writing a -v2 sibling |
palette | string | Color palette |
preserve | array | Edit invariants, e.g. ["person and pose", "all text outside the sign"] |
presets | array | Guidance blocks: photoreal, portrait, likeness, product, thumbnail, no-text, exact-text, brand-style |
reasoningEffort | string | Host model reasoning. Default low: the host only relays the prepared spec. |
references | array | Reference images with roles. Up to 5 images including editImage. |
style | string | Medium and style, e.g. "35mm film photo", "flat vector" |
text | string | Exact in-image text, rendered verbatim |
timeout | integer | Timeout in ms. Default 10 min; each image takes roughly 30-90s. |
transparentBackground | boolean | Ask for a transparent (alpha) background; check `hasAlpha` in the result |
typography | string | Font style, size, color and placement for `text` |
useCase | string | Task category from the Codex imagegen taxonomy; sets the polish level |
variants | integer | Number of images; each is a separate image_gen call |
workingDir | string | Working directory for relative paths |