Get the FREE Ultimate OpenClaw Setup Guide →

codex

MCP server wrapper for OpenAI Codex CLI that enables Claude Code to leverage Codex's AI capabilities directly.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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:

  1. Ensure Node.js and npm are installed. Download from https://nodejs.org/ or use a package manager.
  2. Install Codex CLI globally (optional but recommended):
    • npm i -g @openai/codex
    • codex login --api-key "your-openai-api-key" # authenticate
  3. 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.
  4. 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

Sponsor this space

Reach thousands of developers