OpenAI Codex

v1.0.0Developer Toolsstable

An MCP server to communicated with, use, and wrap the API for the OpenAI Codex CLI tool.

openai-codexmcpai-integration
Share:
53
Stars
0
Downloads
0
Weekly
0/5

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

Integrate with OpenAI Codex CLI tool through MCP.
LicenseNOASSERTION
Languagepython
Versionv1.0.0
UpdatedApr 1, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx openai-codex

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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/codex
2

Clone 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/activate
3

Install the Python package

Install the package and its dependencies into the virtual environment.

uv pip install .
4

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.sh
5

Register 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.json

OpenAI 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.

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.

Quick Config Preview

{ "mcpServers": { "openai-codex": { "command": "npx", "args": ["-y", "openai-codex"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides