$git clone https://github.com/tuannvm/codex-mcp-serverBridge between Claude and OpenAI's Codex CLI — get AI-powered code analysis, generation, and review right in your editor.
| 1 | # Codex MCP Server |
| 2 | |
| 3 | [](https://www.npmjs.com/package/codex-mcp-server) |
| 4 | [](https://www.npmjs.com/package/codex-mcp-server) |
| 5 | [](https://www.npmjs.com/package/codex-mcp-server) |
| 6 | |
| 7 | Bridge between Claude and OpenAI's Codex CLI — get AI-powered code analysis, generation, and review right in your editor. |
| 8 | |
| 9 | ```mermaid |
| 10 | graph LR |
| 11 | A[Claude Code] --> B[Codex MCP Server] |
| 12 | B --> C[Codex CLI] |
| 13 | C --> D[OpenAI API] |
| 14 | |
| 15 | style A fill:#FF6B35 |
| 16 | style B fill:#4A90E2 |
| 17 | style C fill:#00D4AA |
| 18 | style D fill:#FFA500 |
| 19 | ``` |
| 20 | |
| 21 | ## Quick Start |
| 22 | |
| 23 | ### 1. Install Codex CLI |
| 24 | |
| 25 | ```bash |
| 26 | npm i -g @openai/codex |
| 27 | codex login --api-key "your-openai-api-key" |
| 28 | ``` |
| 29 | |
| 30 | ### 2. Add to Claude Code |
| 31 | |
| 32 | ```bash |
| 33 | claude mcp add codex-cli -- npx -y codex-mcp-server |
| 34 | ``` |
| 35 | |
| 36 | ### 3. Start Using |
| 37 | |
| 38 | ``` |
| 39 | Ask codex to explain this function |
| 40 | Use codex to refactor this code for better performance |
| 41 | Use review to check my uncommitted changes |
| 42 | ``` |
| 43 | |
| 44 | ## One-Click Install |
| 45 | |
| 46 | [](https://vscode.dev/redirect/mcp/install?name=codex-cli&config=%7B%22type%22%3A%22stdio%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22codex-mcp-server%22%5D%7D) |
| 47 | [](https://insiders.vscode.dev/redirect/mcp/install?name=codex-cli&config=%7B%22type%22%3A%22stdio%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22codex-mcp-server%22%5D%7D) |
| 48 | [](https://cursor.com/en/install-mcp?name=codex&config=eyJ0eXBlIjoic3RkaW8iLCJjb21tYW5kIjoibnB4IC15IGNvZGV4LW1jcC1zZXJ2ZXIiLCJlbnYiOnt9fQ%3D%3D) |
| 49 | |
| 50 | ## Tools |
| 51 | |
| 52 | | Tool | Description | |
| 53 | |------|-------------| |
| 54 | | `codex` | AI coding assistant with session support, model selection, and structured output metadata | |
| 55 | | `review` | AI-powered code review for uncommitted changes, branches, or commits | |
| 56 | | `websearch` | Web search using Codex CLI with customizable result count and search depth | |
| 57 | | `listSessions` | View active conversation sessions | |
| 58 | | `ping` | Test server connection | |
| 59 | | `help` | Get Codex CLI help | |
| 60 | |
| 61 | ## Examples |
| 62 | |
| 63 | **Code analysis:** |
| 64 | ``` |
| 65 | Use codex to analyze this authentication logic for security issues |
| 66 | ``` |
| 67 | |
| 68 | **Multi-turn conversations:** |
| 69 | ``` |
| 70 | Use codex with sessionId "refactor" to analyze this module |
| 71 | Use codex with sessionId "refactor" to implement your suggestions |
| 72 | ``` |
| 73 | Passing a sessionId creates the session on first use, so listSessions will show |
| 74 | it (for this server instance) and subsequent calls can resume context. |
| 75 | |
| 76 | **Code review:** |
| 77 | ``` |
| 78 | Use review with base "main" to check my PR changes |
| 79 | Use review with uncommitted true to review my local changes |
| 80 | ``` |
| 81 | |
| 82 | **Advanced options:** |
| 83 | ``` |
| 84 | Use codex with model "o3" and reasoningEffort "high" for complex analysis |
| 85 | Use codex with fullAuto true and sandbox "workspace-write" for automated tasks |
| 86 | Use codex with callbackUri "http://localhost:1234/callback" for static callbacks |
| 87 | Use codex to return structuredContent with threadId metadata when available |
| 88 | ``` |
| 89 | |
| 90 | **Web search:** |
| 91 | ``` |
| 92 | Use websearch with query "TypeScript 5.8 new features" |
| 93 | Use websearch with query "Rust vs Go performance 2025" and numResults 15 |
| 94 | Use websearch with query "React Server Components" and searchDepth "full" |
| 95 | ``` |
| 96 | |
| 97 | ## Requirements |
| 98 | |
| 99 | - **Codex CLI v0.75.0+** — Install with `npm i -g @openai/codex` or `brew install codex` |
| 100 | - **OpenAI API key** — Run `codex login --api-key "your-key"` to authenticate |
| 101 | |
| 102 | ## Codex 0.87 Compatibility |
| 103 | - **Thread ID + structured output**: When Codex CLI emits `threadId`, this server returns it in content metadata and `structuredContent`, and advertises an `outputSchema` for structured responses. |
| 104 | |
| 105 | ## Documentation |