Codex
An MCP server for the OpenAI Codex CLI that provides coding assistance with multi-turn session management and reasoning depth control. It enables users to perform code analysis, generation, and refactoring through Claude with native resume support fo
What is Codex?
Codex is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mcp server for the openai codex cli that provides coding assistance with multi-turn session management and reasoning depth control. it enables users to perform code analysis, generation, and refactori...
An MCP server for the OpenAI Codex CLI that provides coding assistance with multi-turn session management and reasoning depth control. It enables users to perform code analysis, generation, and refactoring through Claude with native resume support fo
This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- An MCP server for the OpenAI Codex CLI that provides coding
Use Cases
Maintainer
Works with
Installation
NPM
npx -y @cexll/codex-mcp-serverManual Installation
npx -y @cexll/codex-mcp-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Codex
codex-mcp-server wraps the OpenAI Codex CLI as an MCP server, letting Claude and other MCP clients delegate coding tasks directly to Codex-class models (gpt-5-codex, o3, codex-mini-latest, and others). It exposes tools for executing arbitrary coding prompts, brainstorming with structured frameworks, paginating large responses, and testing connectivity, while supporting multi-turn session resumption and configurable sandbox modes so AI-suggested code runs safely. Teams using Claude for coding who also want to leverage OpenAI's code-specialized models in the same workflow will find it a useful bridge.
Prerequisites
- Node.js 18 or later and npm installed
- OpenAI Codex CLI installed and configured with an OpenAI API key (OPENAI_API_KEY)
- An MCP-compatible client such as Claude Desktop or Claude Code
- Optional: set MCP_TOOL_TIMEOUT for long-running tasks
Install the Codex CLI
The MCP server delegates to the Codex CLI, so install it globally first and verify it can run.
npm install -g @openai/codex
export OPENAI_API_KEY=your_openai_api_key_hereInstall the codex-mcp-server package
Install the MCP server globally so it is available as a command for your MCP client to launch.
npm install -g @cexll/codex-mcp-server@latestConfigure Codex CLI defaults
Create a Codex config file to set your preferred model, reasoning effort, approval policy, and sandbox mode. These defaults are used by every tool invocation.
mkdir -p ~/.codex
cat > ~/.codex/config.toml << 'EOF'
model = "gpt-5-codex"
model_reasoning_effort = "high"
approval_policy = "never"
sandbox_mode = "danger-full-access"
EOFRegister the server with Claude Code (recommended)
Use the Claude Code CLI to add the MCP server in one command. Verify it loaded with /mcp.
claude mcp add codex-cli -- npx -y @cexll/codex-mcp-serverAdd to Claude Desktop configuration
Alternatively, edit claude_desktop_config.json to register the server for Claude Desktop.
Set a longer timeout for complex tasks
Codex tasks can take several minutes for deep reasoning. Set MCP_TOOL_TIMEOUT to avoid premature timeouts.
export MCP_TOOL_TIMEOUT=36000000 # 10 hours in millisecondsCodex Examples
Client configuration
Claude Desktop configuration that runs codex-mcp-server via npx. The server picks up OPENAI_API_KEY from the environment block.
{
"mcpServers": {
"codex-cli": {
"command": "npx",
"args": ["-y", "@cexll/codex-mcp-server"],
"env": {
"OPENAI_API_KEY": "your_openai_api_key_here",
"MCP_TOOL_TIMEOUT": "36000000"
}
}
}
}Prompts to try
Use Claude to delegate coding tasks to Codex through the MCP bridge.
- "Use ask-codex to refactor the authentication module in src/auth.ts for better error handling"
- "Use the brainstorm tool to generate 5 approaches for implementing a rate limiter in Node.js"
- "Ask Codex to analyze @package.json and suggest dependency upgrades with reasoning"Troubleshooting Codex
ask-codex tool times out before returning a result
Set MCP_TOOL_TIMEOUT to a large value like 36000000 (10 hours in ms) in the env block of your MCP config. Complex Codex tasks with high reasoning effort can take several minutes to complete.
'codex: command not found' when the MCP server tries to run a task
The Codex CLI must be installed globally and on the PATH that the MCP server process sees. Run 'npm install -g @openai/codex' and verify with 'which codex'. If running inside Claude Desktop, the PATH may differ from your interactive shell — add the full path to codex in your shell profile.
Codex returns sandbox permission errors
Adjust sandbox_mode in ~/.codex/config.toml. Use 'read-only' for safe code analysis, 'workspace-write' for edits within the project directory, or 'danger-full-access' only when you trust the AI's actions fully. The approval_policy can be set to 'on-request' to require confirmation before each file write.
Frequently Asked Questions about Codex
What is Codex?
Codex is a Model Context Protocol (MCP) server that mcp server for the openai codex cli that provides coding assistance with multi-turn session management and reasoning depth control. it enables users to perform code analysis, generation, and refactoring through claude with native resume support fo It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Codex?
Install via npm with the command: npx -y @cexll/codex-mcp-server. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).
Which AI clients work with Codex?
Codex works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Codex free to use?
Yes, Codex is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
Codex Alternatives — Similar Coding Agents Servers
Looking for alternatives to Codex? Here are other popular coding agents servers you can use with Claude, Cursor, and VS Code.
Dify
★ 142.2kProduction-ready platform for agentic workflow development.
Ruflo
★ 54.0k🌊 The leading agent orchestration platform for Claude. Deploy intelligent multi-agent swarms, coordinate autonomous workflows, and build conversational AI systems. Features enterprise-grade architecture, self-learning swarm intelligence, RAG integrat
Goose
★ 45.7kan open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM
Antigravity Awesome Skills
★ 38.3kInstallable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.
AgentScope
★ 25.5kBuild and run agents you can see, understand and trust.
Serena
★ 24.5kA coding agent toolkit that provides IDE-like semantic code retrieval and editing tools, enabling LLMs to efficiently navigate and modify codebases using symbol-level operations instead of basic file reading and string replacements.
Browse More Coding Agents MCP Servers
Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Codex in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Codex?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.