OpenAI Codex
An MCP server to communicated with, use, and wrap the API for the OpenAI Codex CLI tool.
What is OpenAI Codex?
OpenAI Codex is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mcp server to communicated with, use, and wrap the api for the openai codex cli tool.
An MCP server to communicated with, use, and wrap the API for the OpenAI Codex CLI tool.
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- An MCP server to communicated with, use, and wrap the API fo
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx openai-codexConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use OpenAI Codex
The OpenAI Codex MCP Server wraps the OpenAI Codex CLI tool in an MCP-compatible HTTP server, giving AI assistants like Claude access to OpenAI's full range of models for specialized coding tasks. It exposes four tools — code generation, code explanation, bug debugging, and flexible completions — and supports models including o4-mini, o3, gpt-4.1, and gpt-4o. Developers use it to delegate specific coding subtasks to OpenAI models while orchestrating the overall workflow through Claude, effectively creating a multi-model coding pipeline.
Prerequisites
- Python 3.12+ and the uv package manager installed
- Node.js and npm for installing the OpenAI Codex CLI (npm install -g @openai/codex)
- A valid OpenAI API key configured with the Codex CLI (the key is used by the CLI, not passed to this server directly)
- Claude Desktop or another MCP-compatible AI client that supports HTTP-based MCP servers
Install the OpenAI Codex CLI
Install the OpenAI Codex CLI globally via npm. This is the underlying tool that the MCP server wraps.
npm install -g @openai/codexClone the repository and set up the Python environment
Clone the MCP server repository and create a virtual environment using uv.
git clone https://github.com/agency-ai-solutions/openai-codex-mcp.git
cd openai-codex-mcp
uv venv
source .venv/bin/activateInstall the Python package
Install the package and its dependencies into the virtual environment.
uv pip install .Start the MCP server
Launch the server using the codex_server command or the setup script. It listens on http://localhost:8000/ by default.
codex_server
# Or use the automated script:
./setup_and_run.shRegister with Claude Code CLI
Add the running HTTP server as an MCP tool in Claude Code using the config file path, or configure it manually in Claude Desktop settings pointing to http://localhost:8000/.
claude mcp add /path/to/openai_codex_mcp.jsonOpenAI Codex Examples
Client configuration
Claude Desktop configuration for the OpenAI Codex MCP Server running locally on port 8000.
{
"mcpServers": {
"openai-codex": {
"command": "python",
"args": ["-m", "uvicorn", "codex_server:app", "--host", "localhost", "--port", "8000"],
"cwd": "/path/to/openai-codex-mcp",
"env": {
"OPENAI_API_KEY": "your_openai_api_key"
}
}
}
}Prompts to try
Example prompts for using the OpenAI Codex MCP Server through Claude.
- "Use the Codex server to write a Python function that generates prime numbers up to N"
- "Explain how this quicksort implementation works using the Codex explain tool"
- "Debug this JavaScript function — it's returning NaN unexpectedly"
- "Use the o4-mini model to generate a binary search tree in TypeScript"
- "Generate a Rust implementation of a thread-safe message queue"
- "Use o3 to explain the time complexity of this dynamic programming solution"Troubleshooting OpenAI Codex
codex_server command not found after installation
Ensure you have activated the virtual environment with 'source .venv/bin/activate' before running codex_server. The command is only available within the venv. Alternatively, run it with the full path: .venv/bin/codex_server.
OpenAI API key errors when calling write_code or debug_code
The API key is used by the OpenAI Codex CLI, not by the MCP server environment directly. Run 'codex --help' in your terminal to confirm the CLI is installed and your API key is configured. You may need to run 'export OPENAI_API_KEY=your_key' in the terminal session where the server runs.
Server starts but Claude cannot connect to it
Verify the server is listening on the expected port by checking http://localhost:8000/ in your browser. If using Claude Desktop, ensure the URL in your MCP tool config matches exactly. Firewalls or port conflicts may prevent connection — try specifying a different port with --port flag.
Frequently Asked Questions about OpenAI Codex
What is OpenAI Codex?
OpenAI Codex is a Model Context Protocol (MCP) server that mcp server to communicated with, use, and wrap the api for the openai codex cli tool. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install OpenAI Codex?
Follow the installation instructions on the OpenAI Codex GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with OpenAI Codex?
OpenAI Codex works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is OpenAI Codex free to use?
Yes, OpenAI Codex is open source and available under the NOASSERTION license. You can use it freely in both personal and commercial projects.
OpenAI Codex Alternatives — Similar Developer Tools Servers
Looking for alternatives to OpenAI Codex? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up OpenAI 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 OpenAI Codex?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.