← Back to directory
C

Codex MCP Server

Community
Connect Codex CLI to MCP clients for automated code analysis and editing.
GitHub source repository ↗
★ 178 Stars Category · Dev Tools Popular Source revision 19fbc1b6441f
46FMRS · D
Reliability
5/20
Security and permissions
7/20
Maintenance
11/20
Documentation
12/20
Setup experience
11/20

The project has positive feedback on GitHub, with community recognition of its functionality. v1.2.4 enhanced Windows compatibility and provides detailed documentation. For security, pay attention to sandbox configuration.

Read the FMRS scoring method →

Codex MCP Tool is an open-source Model Context Protocol (MCP) server that connects your IDE or AI assistant (such as Claude, Cursor) to the Codex CLI. It enables non-interactive automation with codex exec, safe sandboxed edits with approvals, and large-scale code analysis via @ file references. Built for reliability and speed, it streams progress updates, supports structured change mode (OLD/NEW patch output), and integrates cleanly with standard MCP clients for code review, refactoring, documentation, and CI automation.

Tools

ask-codex
Sends a prompt to Codex via `codex exec`, supporting `@` file references, model selection, sandbox and approval policies, change mode, and automatically includes `--skip-git-repo-check`.
brainstorm
Generates novel ideas with structured methodologies, supporting multiple frameworks (e.g., SCAMPER, design thinking) and domain-specific context, with feasibility, impact, and innovation scoring.
ping
A simple test tool that echoes back a message to verify MCP connection.
help
Shows the Codex CLI help text and available commands.
fetch-chunk
Retrieves cached chunks from changeMode responses for paginating large structured edit responses.
timeout-test
Test tool for timeout prevention, runs for a specified duration.

Setup

  1. Ensure Node.js v18.0.0 or higher is installed.
  2. Install and authenticate Codex CLI: npm install -g @openai/codex.
  3. For npx usage, run claude mcp add codex-cli -- npx -y @cexll/codex-mcp-server, or add the JSON configuration to your Claude Desktop config file.
  4. Restart your terminal or client.
claude_desktop_config.json
{
  "mcpServers": {
    "codex-cli": {
      "command": "npx",
      "args": ["-y", "@cexll/codex-mcp-server"]
    }
  }
}

Fit and risk

Best for

  • Developers who want to integrate Codex CLI into AI-assisted editors.
  • Teams that need automated code analysis or editing.
  • Users seeking to use Codex models within the MCP ecosystem.

Not for

  • Users requiring official OpenAI support or endorsement.
  • Users who do not use Codex CLI or Node.js.
  • Users needing fully unsupervised high-risk automation (such as yolo mode, not recommended).

Required permissions

  • Requires filesystem access to read code files (depending on sandbox mode).
  • Can modify workspace files in `workspace-write` mode.
  • Has full system access in `danger-full-access` mode (not recommended).
  • May require network access depending on configuration and tasks.

Risks and side effects

  • Setting sandbox mode to `danger-full-access` or `yolo` may lead to unintended modifications or data loss.
  • Automated code edits may introduce errors or security issues.
  • Codex CLI requires authentication and may incur API costs.
  • Using @file references may expose sensitive code content.

Troubleshooting

  1. For timeout errors, set environment variable `MCP_TOOL_TIMEOUT` (in milliseconds).
  2. If file write permission errors occur, check if sandbox mode is `read-only`; use `workspace-write` instead.
  3. If Codex CLI is not found, ensure it is installed globally and authenticated.
  4. On Windows, if ENOENT errors occur, update to v1.2.4+ or follow the troubleshooting guide in the docs.

Use cases

Ask Codex questions or brainstorm ideas from your MCP client.
Analyze codebases, files, or directories and get explanations or suggestions.
Safely edit code with approvals and sandbox modes.
Perform large-scale code analysis with @file references.
Automate code review, refactoring, documentation, and CI integration.

Supported clients

Claude DesktopFull support
Claude CodeFull support