codex-mcp-tool
This MCP server connects Claude/Cursor to the Codex CLI, enabling AI-powered coding tasks:
Ask Codex: Run one-off prompts with optional file references (
@path), model selection, web search, sandbox controls, change mode (OLD/NEW patches), local OSS models (Ollama/LM Studio), and multi-turn session support.Batch Codex: Run multiple tasks sequentially or in parallel with priorities, sandbox modes, and stop-on-error controls.
Review Changes: Run native code review on uncommitted changes, a specific commit, or against a base branch, with optional custom focus areas.
Do-Act: Execute a task, verify with a shell command, and automatically retry with fixes if verification fails.
Brainstorm: Generate ideas using frameworks like SCAMPER, design-thinking, or lateral thinking, including feasibility analysis and idea count controls.
Session Management: List, delete, or clear active multi-turn conversation sessions.
Skill Discovery: List available Codex skills from
.agents/skills/directories.Health Diagnostics: Diagnose Codex CLI installation, version, features, and session health.
Change Chunk Retrieval: Fetch cached chunks from a previous change-mode response.
Local OSS Model Support: Run any tool against local Ollama or LM Studio models (e.g.,
qwen3:8b).Safety & Controls: Fine-grained sandbox modes (
read-only,workspace-write,danger-full-access), approval policies (never,on-request,untrusted), ephemeral runs, and configuration parameters like reasoning effort, timeout, and working directory.Cross-Platform: Works on Windows, macOS, and Linux.
Utilities: Ping for connectivity, help for CLI usage, version output, and timeout test for debugging long requests.
Allows using local OSS models via Ollama as a provider for Codex tasks, enabling offline/local code analysis and generation.
Provides integration with OpenAI's Codex CLI, enabling AI agents to execute coding tasks, perform file analysis, run multi-turn sessions, sandboxed edits, and structured change-mode operations.
Click on "Install 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-toolanalyze @package.json and list dependencies"
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 Server
MCP server connecting Claude/Cursor to Codex CLI. Enables code analysis via @ file references, multi-turn conversations, sandboxed edits, and structured change mode.
Features
File Analysis — Reference files with
@src/,@package.jsonsyntaxMulti-Turn Sessions — Conversation continuity with workspace isolation
Native Resume — Uses
codex resumefor context preservation (CLI v0.36.0+)Local OSS Models — Run with Ollama or LM Studio via
localProviderWeb Search — Research capabilities with
search: trueSandbox Mode — Safe automation with explicit sandbox and approval policies
Change Mode — Structured OLD/NEW patch output for refactoring
Brainstorming — SCAMPER, design-thinking, lateral thinking frameworks
Health Diagnostics — CLI version, features, and session monitoring
Cross-Platform — Windows, macOS, Linux fully supported
Related MCP server: codex-mcp-server
Quick Start
claude mcp add codex-cli -- npx -y @trishchuk/codex-mcp-toolPrerequisites: Node.js 18+, Codex CLI installed and authenticated.
Configuration
{
"mcpServers": {
"codex-cli": {
"command": "npx",
"args": ["-y", "@trishchuk/codex-mcp-tool"]
}
}
}Config locations: macOS: ~/Library/Application Support/Claude/claude_desktop_config.json | Windows: %APPDATA%\Claude\claude_desktop_config.json
Usage Examples
// File analysis
'explain the architecture of @src/';
'analyze @package.json and list dependencies';
// With specific model
'use codex with model gpt-5.6-sol to analyze @algorithm.py';
// Multi-turn conversations (v1.4.0+)
'ask codex sessionId:"my-project" prompt:"explain @src/"';
'ask codex sessionId:"my-project" prompt:"now add error handling"';
// Brainstorming
'brainstorm ways to optimize CI/CD using SCAMPER method';
// Sandbox mode
'use codex sandbox:true to create and run a Python script';
// Web search
'ask codex search:true prompt:"latest TypeScript 5.7 features"';
// Local OSS model (Ollama)
'ask codex localProvider:"ollama" model:"qwen3:8b" prompt:"explain @src/"';Tools
Tool | Description |
| Execute Codex CLI with files, models, sessions, and safety controls |
| Run multiple atomic Codex tasks sequentially or concurrently |
| Run the native non-interactive Codex review command |
| Execute, verify with a shell command, and retry fixes |
| Generate ideas with structured creative frameworks |
| View, delete, or clear MCP conversation mappings |
| List skills visible from the selected workspace |
| Diagnose CLI installation, version, features, and sessions |
| Retrieve a chunk from cached change-mode output |
| Test the MCP connection |
| Return current |
| Report Codex CLI, Node.js, platform, and package versions |
| Exercise keepalive and timeout behavior |
Models
By default the model parameter is omitted and Codex CLI applies the
default model from your ~/.codex/config.toml (for example model = "gpt-5.6-sol").
Pass model only when you need to override the configured default for a
single call. Reasoning depth is calibrated per tool:
ask-codex— uses the Codex CLI default reasoning (medium). Increase it only when the task needs more planning or checking.brainstorm,do-act,review-changes— defaultreasoningEffort: "high"(creative ideation, act-check-fix loops, and code review benefit from deeper reasoning).
Model | Recommendation |
| Complex, ambiguous, high-value work; strongest default |
| Everyday coding with a better capability/cost balance |
| Clear, repeatable, high-volume tasks |
| Previous-generation fallback |
| Professional coding fallback |
| Small, fast, cost-efficient fallback |
GPT-5.6 Sol and Terra can expose max and ultra reasoning. ultra may
delegate work to subagents; most tasks should remain on medium or high.
Key Features
Session Management (v1.4.0+)
Multi-turn conversations with workspace isolation:
{ "prompt": "analyze code", "sessionId": "my-session" }
{ "prompt": "continue from here", "sessionId": "my-session" }
{ "prompt": "start fresh", "sessionId": "my-session", "resetSession": true }Environment:
CODEX_SESSION_TTL_MS- Session TTL (default: 24h)CODEX_MAX_SESSIONS- Max sessions (default: 50)
Codex CLI version
Requires Codex CLI 0.95.0 or newer. On older versions the server fails
with an explicit upgrade message rather than silently dropping unsupported
flags. Upgrade with npm install -g @openai/codex@latest; run the health tool
to see the detected version.
Troubleshooting: "codex not found"
MCP clients launched from a GUI (Dock, Finder, Start menu) inherit a minimal
PATH that excludes Homebrew, nvm, and volta directories, so codex may work
from a terminal but not from the app. The server searches those locations
automatically; if it still cannot find the CLI, pin it explicitly:
{ "env": { "CODEX_CLI_PATH": "/opt/homebrew/bin/codex" } }Find the value with which codex. Run the health tool to see which
executable was resolved and how.
Local OSS Models (v1.6.0+)
Run with local Ollama or LM Studio instead of OpenAI:
// Ollama
{ "prompt": "analyze @src/", "localProvider": "ollama", "model": "qwen3:8b" }
// LM Studio
{ "prompt": "analyze @src/", "localProvider": "lmstudio", "model": "my-model" }
// Auto-select provider
{ "prompt": "analyze @src/", "oss": true }Requirements: Ollama running locally with a model that supports tool calling (e.g. qwen3:8b).
Advanced Options
Parameter | Description |
| Model selection |
| Enable conversation continuity |
| Compatibility automation: workspace-write + never |
| Enable web search |
| Structured OLD/NEW edits |
| Additional writable directories |
| Cap response verbosity (100-10,000) |
| low, medium, high, xhigh, max, ultra |
| Use local OSS model provider |
| Local provider: |
| Fail on unknown Codex configuration keys |
| Do not persist Codex session files |
| Ignore |
| Ignore execpolicy |
CLI Compatibility
Validated against Codex CLI 0.144.3. The server keeps older feature guards,
but current releases are recommended. Notable current behavior:
--full-autoand approval policyon-failurehave been removed by Codex CLI.MCP
sandbox: true/fullAuto: trueremain compatibility aliases for--sandbox workspace-write --ask-for-approval never; they do not bypass the sandbox.Native
--searchis used without the deprecatedweb_search_requestfeature.Current
execflags include--strict-config,--ephemeral,--ignore-user-config, and--ignore-rules.
Troubleshooting
codex --version # Check CLI version
codex login # AuthenticateUse health tool for diagnostics: 'use health verbose:true'
Migration
v2.3.x → v2.4.0: Codex CLI 0.144.3 compatibility audit; added GPT-5.6
Sol/Terra/Luna, max/ultra reasoning, current exec flags, native-only search,
and safe compatibility handling for the removed --full-auto flag and
on-failure approval policy.
Current CLI compatibility: added GPT-5.6 Sol/Terra/Luna, max/ultra
reasoning, current exec flags, native-only search, and safe expansion of the
removed --full-auto compatibility option.
v2.2.x → v2.3.0: gpt-5.5 as new default, added gpt-5.4-mini, dropped retired models (gpt-5.3-codex-spark, gpt-5.2-codex, gpt-5.1-codex-max, gpt-5.1-codex-mini).
v2.0.x → v2.1.0: gpt-5.4 as new default model, updated fallback chain.
v1.5.x → v1.6.0: Local OSS model support (localProvider, oss), gpt-5.3-codex default model, xhigh reasoning effort.
v1.3.x → v1.4.0: New sessionId parameter, list-sessions/health tools, structured error handling. No breaking changes.
License
MIT License. Not affiliated with OpenAI.
Documentation | Issues | Inspired by jamubc/gemini-mcp-tool
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityFmaintenanceAn MCP server that integrates Codex CLI into Claude Code workflows for code writing, execution, and review with session management. It features real-time progress monitoring via a local HTTP dashboard and supports detailed configuration for various coding tools.612165MIT
- AlicenseBqualityDmaintenanceAn open-source MCP server that connects your IDE or AI assistant to the Codex CLI, enabling non-interactive automation with codex exec, safe sandboxed edits with approvals, and large-scale code analysis via @ file references.834MIT
- Flicense-qualityDmaintenanceAn MCP server wrapping the Cursor CLI agent, enabling Claude Code and other MCP clients to delegate tasks to Cursor's AI agent for file writing, bash commands, and codebase queries.
- Alicense-qualityAmaintenanceAn MCP server that bridges CLI coding agents like Claude Code, Codex, opencode, and Antigravity into any MCP client, enabling synchronous and asynchronous task execution, follow-up input, and a structured code review tool.3,147MIT
Related MCP Connectors
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
Real-time chat hub for AI agents — Claude Code, Cursor, Cline, Codex over MCP or REST.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/x51xxx/codex-mcp-tool'
If you have feedback or need assistance with the MCP directory API, please join our Discord server