
为OpenAI Codex的CLI提供MCP服务器包装器,使Claude Code能够直接利用Codex的AI能力。
概览
连接 Claude 与 OpenAI 的 Codex CLI——直接在编辑器中获得 AI 驱动的代码分析、生成和审核。 传递 sessionId 在首次使用时创建会话,因此 listSessions 会显示该实例(针对该服务器实例),后续调用可以恢复上下文。 - — 用npm i -g @openai/codex安装或brew安装codex- — 运行codex登录 --api-key “your-key”以进行认证 - : 当Codex CLI发出threadId时,该服务器会以内容元数据和structuredContent形式返回该文件,并为结构化响应发布outputSchema。 - — 完整工具参数和响应格式 - — 对话工作原理 - — 版本兼容性及CLI细节 - CODEX_MCP_CALLBACK_URI:静态MCP回调URI在设定时传递给Codex(被callbackUri工具arg覆盖) - — 为 Gemini CLI 提供 1M+ 令牌上下文、网页搜索和媒体分析的 MCP 服务器- — macOS 上的 Claude Code 动态岛 — 实时监控多台机器和服务提供商间的会话
概述(AI 翻译)
连接 Claude 与 OpenAI 的 Codex CLI——直接在编辑器中获得 AI 驱动的代码分析、生成和审核。
快速启动
1.安装Codex CLI。
2.添加到Claude代码中
3.开始使用
一键安装
工具
| 工具 | 描述 |
|---|---|
codex |
具备会话支持、模型选择和结构化输出元数据的AI编码助手 |
review |
AI驱动的代码审查,针对未提交的更改、分支或提交 |
websearch |
使用Codex CLI进行网页搜索,支持可自定义的结果计数和搜索深度 |
listSessions |
查看活跃对话会话 |
ping |
测试服务器连接 |
help |
获取Codex CLI帮助 |
示例
代码分析:
多回合对话:
传递 sessionId 会在首次使用时创建会话,因此 listSessions 会显示 对于该服务器实例,它及其后续调用可以恢复上下文。
代码审查:
高级选项:
网络搜索:
要求
- Codex CLI v0.75.0+ — 安装时可使用
npm i -g @openai/codex或brew install codex - OpenAI API 密钥 — 运行
codex login --api-key "your-key"以认证
Codex 0.87 兼容性
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Codex MCP Server
Bridge between Claude and OpenAI’s Codex CLI — get AI-powered code analysis, generation, and review right in your editor.
graph LR
A[Claude Code] --> B[Codex MCP Server]
B --> C[Codex CLI]
C --> D[OpenAI API]
style A fill:#FF6B35
style B fill:#4A90E2
style C fill:#00D4AA
style D fill:#FFA500
Quick Start
1. Install Codex CLI
npm i -g @openai/codex
codex login --api-key "your-openai-api-key"
2. Add to Claude Code
claude mcp add codex-cli -- npx -y codex-mcp-server
3. Start Using
Ask codex to explain this function
Use codex to refactor this code for better performance
Use review to check my uncommitted changes
One-Click Install
Tools
| Tool | Description |
|---|---|
codex |
AI coding assistant with session support, model selection, and structured output metadata |
review |
AI-powered code review for uncommitted changes, branches, or commits |
websearch |
Web search using Codex CLI with customizable result count and search depth |
listSessions |
View active conversation sessions |
ping |
Test server connection |
help |
Get Codex CLI help |
Examples
Code analysis:
Use codex to analyze this authentication logic for security issues
Multi-turn conversations:
Use codex with sessionId "refactor" to analyze this module
Use codex with sessionId "refactor" to implement your suggestions
Passing a sessionId creates the session on first use, so listSessions will show it (for this server instance) and subsequent calls can resume context.
Code review:
Use review with base "main" to check my PR changes
Use review with uncommitted true to review my local changes
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →