codex
MCP server wrapper for OpenAI Codex CLI that enables Claude Code to leverage Codex's AI capabilities directly.
claude mcp add --transport stdio tuannvm-codex-mcp-server npx -y codex-mcp-server \ --env CODEX_MCP_CALLBACK_URI="Optional static MCP callback URI passed to Codex when set"
How to use
Codex MCP Server acts as a bridge between Claude/Codex and the Codex CLI, enabling AI-powered code analysis, generation, and review directly through your MCP-enabled editor or workflow. The server exposes a Codex CLI integration layer that accepts typical Codex CLI commands and augments them with MCP session management, structured outputs, and session persistence. Tools available through this MCP server include: the codex CLI for code analysis, generation, and refactoring tasks; a review utility for assessing uncommitted changes or PR diffs; and session management capabilities to persist and resume multi-turn conversations. Typical usage involves starting the MCP server (via npx codex-mcp-server) and then invoking codex commands through your editor or Claude Code integration to analyze, generate, or review code with model-assisted guidance. You can also use sessionId-based interactions to maintain context across multiple calls and enable more advanced conversational workflows.
How to install
Prerequisites:
- Node.js and npm installed on your system
- Optional: Codex CLI installed for a smoother workflow
Install and set up:
- Ensure Node.js and npm are installed. Download from https://nodejs.org/ or use a package manager.
- Install Codex CLI globally (optional but recommended):
- npm i -g @openai/codex
- codex login --api-key "your-openai-api-key" # authenticate
- Use the MCP server via npx (as recommended by the Quick Start):
- npx -y codex-mcp-server This will start the Codex MCP Server using the codex-mcp-server package from npm.
- If you are integrating with Claude Code, add the MCP server via:
- claude mcp add codex-cli -- npx -y codex-mcp-server
Notes:
- You can also pin the server version by using a specific npm tag or version, e.g., npx -y codex-mcp-server@1.0.0.
- If you prefer to configure the server manually for an editor workflow, you can run it in a script action and point your editor’s MCP config to the server’s endpoint.
Additional notes
Tips and caveats:
- Environment variable CODEX_MCP_CALLBACK_URI can be set to provide a static MCP callback URI to Codex (overridden by callbackUri tool arg in Codex CLI integration).
- Ensure the Codex CLI is reachable from the environment running the MCP server (network access for npm install and npx execution).
- Compatibility: Codex CLI should be v0.75.0+ for best integration; verify your installation matches the prerequisites listed in the Codex documentation.
- If you encounter rate-limiting or API key issues, verify your OpenAI API key and ensure proper billing/quota in your OpenAI account.
- The MCP server expects typical Codex CLI commands; you can use commands like analyze, review, and multi-turn session commands as described in Codex CLI usage guides.
Related MCP Servers
google-ai-mode
MCP server for free Google AI Mode search with citations. Query optimization, CAPTCHA handling, multi-agent support. Works with Claude Code, Cursor, Cline, Windsurf.
agent-security-scanner
Security scanner MCP server for AI coding agents. Prompt injection firewall, package hallucination detection (4.3M+ packages), 1000+ vulnerability rules with AST & taint analysis, auto-fix.
mcp-image
MCP server for AI image generation and editing with automatic prompt optimization and quality presets (fast/balanced/quality). Powered by Gemini (Nano Banana 2 & Pro).
sub-agents
Define task-specific AI sub-agents in Markdown for any MCP-compatible tool.
modular
A Model Context Protocol (MCP) proxy server that enables efficient management of large tool collections across multiple MCP servers by grouping them and loading tool schemas on-demand.
RLM-Memory
A Model Context Protocol (MCP) server that provides AI agents with persistent memory and semantic file discovery.