Codex MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Codex MCP Server Perform a deep project-level code review and suggest refactoring."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🤖 Codex MCP Server
连接您的 AI 助手与本地强大的 Codex 引擎
这是一个符合 Model Context Protocol (MCP) 标准的服务器,旨在充当桥梁,让 Claude Code、Cursor、Trae、Gemini CLI 等现代 AI 客户端能够安全地调用本地环境中的 Codex Agent 进行代码审查与修复。
🌟 核心价值
通过本项目,您的 AI 助手将获得“第二大脑”,实现:
🔍 全项目深度审查:不再局限于单个文件,而是理解整个代码库的上下文。
🛠️ 自动化智能重构:基于项目架构进行安全的、系统级的代码修改。
🐛 上下文感知修复:精准定位 Bug 根源,而非仅修复表面错误。
Related MCP server: Codex Context Engine
💻 客户端支持
完美适配支持 MCP 协议的主流 AI 编程工具:
客户端 | 支持情况 | 备注 |
💎 Gemini CLI | ✅ 完美支持 | 需配置 |
🟣 Claude Desktop | ✅ 完美支持 | 支持 Claude 4.5 Sonnet / Opus |
🖱️ Cursor | ✅ 完美支持 | 在 Features > MCP 中配置 |
🚀 Trae | ✅ 完美支持 | 兼容标准 MCP 协议 |
🆚 VS Code | ✅ 支持 | 需配合 MCP 扩展使用 |
✨ 功能特性
🛡️ 企业级安全 (Secure Local Execution) 封装本地
codex二进制文件,严格遵循您系统的权限和沙盒设置,确保代码安全。🧠 记忆增强 (Continuous Context) 通过智能的
session_id管理,维护多轮对话的历史上下文,支持迭代式的代码改进。📂 全局视野 (Project-Level Awareness) 提供专用工具
review_project,轻松处理跨文件夹、跨模块的复杂架构变更。⚡ 极速响应 (High Performance) 专为 Agent 通信优化的低延迟架构,让审查过程行云流水。
🚀 快速开始
1. 环境准备
Node.js: v16 或更高版本
Codex CLI: 确保你已安装
codex并启用过codex CLI完成了认证。
2. 安装与构建
# 1. 克隆仓库
git clone <your-repo-url>
cd Coagent
# 2. 安装依赖
npm install
# 3. 编译项目
npm run build💡 提示: 编译后的产物将位于
dist/目录下。
⚙️ 配置指南
为了获得最佳体验,我们强烈建议将此 MCP 服务器配置为项目级别。
标准配置 (JSON)
无论您使用哪种客户端,请参考以下配置结构:
{
"mcpServers": {
"codex-reviewer": {
"command": "node",
"args": ["<您的项目绝对路径>/dist/index.js"],
"description": "Codex Project Reviewer"
}
}
}⚠️ 注意: 请将
<您的项目绝对路径>替换为本仓库实际的完整路径(例如:E:\Project\Codex_Reviewer)。Windows 路径请注意转义\\反斜杠。
常见客户端配置文件路径
Gemini CLI:
[项目根目录]/.gemini/settings.jsonVS Code:
[项目根目录]/.vscode/mcp.jsonClaude Desktop:
~/Library/Application Support/Claude/claude_desktop_config.json(MacOS)其余客户端:
自行查找文档查看相应的项目级mcp和rules的配置规范
🤖 最佳实践:自动化审查流
想让 AI 自动帮您检查代码?
将以下规则写入您的项目规则文件(如 .cursorrules, .gemini/GEMINI.md, 或 Claude Projects Instructions),即可实现全自动化的代码质量守护。
📋 推荐规则模板
# Code Review Workflow
## Mandatory Review Process
After modifying code (using `write_file`, `replace`, `edit_file`, etc.), you **MUST** immediately call the Codex MCP tool to verify the work.
1. **Complex Changes**: Use `review_project` for multi-file changes or system refactoring.
2. **Simple Edits**: Use `review_file` for single-file syntax/logic checks.
## Protocol
- **Context**: You MUST provide a detailed `change_description` explaining *what* changed and *why*.
- **Memory**: You MUST generate and maintain a consistent `session_id` for the duration of a task.🛠️ 工具列表
您可以在对话中直接调用以下工具:
工具名称 | 图标 | 类型 | 用途 |
| 🏢 | 核心 | 系统级审查 - 扫描全项目,处理复杂逻辑与架构变更。 |
| 📄 | 轻量 | 文件级审查 - 快速检查单文件语法、风格与逻辑错误。 |
| 💬 | 通用 | 通用审查 - 发送任意代码片段进行分析。 |
| 🔄 | 会话 | 多轮对话 - 针对之前的审查结果进行追问或微调。 |
📄 许可证
本项目基于 MIT License 开源。
Available Tools
4 toolscontinue_reviewB
【会话工具】在现有会话中继续讨论。用于追问 Codex 更多细节或请求进一步的修改建议。
Inputs: message (required), session_id (required).
review_code_changesB
【通用工具】将代码或文本发送给 Codex 代理进行审查、修改和验证。Codex 将分析代码,执行必要的编辑或命令,并返回修复摘要。每次 Gemini 修改代码后,应该调用此工具获取 Codex 的审查意见。
Inputs: content (required), session_id, context.
review_fileA
【次要工具】审查单个文件的内容。适用于改动仅在单个或两个文件内的情况。Codex 将读取文件并根据变更描述提供审查建议。
Inputs: file_path (required), change_description (required), session_id.
review_projectB
【核心工具】审查整个项目的代码。适用于跨文件夹修改、系统级重构或需要全面上下文的情况。Codex 将分析项目结构和代码,根据提供的变更描述进行审查和修复。
Inputs: project_path (required), change_description (required), session_id.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
The tools have significant overlap in purpose, as all four are focused on code review with Codex. While there are distinctions between reviewing a file, project, or code changes, the boundaries are unclear—for example, 'review_code_changes' and 'review_file' could easily be confused for similar tasks, and the descriptions do not fully resolve this ambiguity.
The tool names follow a highly consistent verb_noun pattern throughout (e.g., continue_review, review_code_changes, review_file, review_project). All use snake_case and start with a verb related to reviewing, making them predictable and easy to parse.
With 4 tools, the count is reasonable for a code review server, though it feels slightly thin. Each tool appears to serve a distinct niche (e.g., file vs. project review), but the set might benefit from additional operations like summarization or feedback integration to enhance completeness.
The server covers core review scenarios (file, project, code changes, and session continuation), but there are notable gaps. For example, it lacks tools for managing review sessions (e.g., starting or ending reviews), handling non-code artifacts, or providing post-review actions like approval or rejection, which could limit agent workflows in broader contexts.
Maintenance
Related MCP Connectors
Give your AI agent a persistent map of your project's structure, dependencies, and bugs.
AI colleagues that keep your standards, your project and their reasoning between sessions
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Shared memory for coding agents. Stop re-explaining your codebase every session.
Related MCP Servers
- AlicenseCqualityDmaintenanceConnects AI assistants like Claude to the Codex CLI for code analysis, editing, and execution. Supports file references with @ syntax, sandboxed code execution with approval workflows, and structured code changes for automated refactoring and documentation.8140 npm176MIT
- FlicenseAqualityCmaintenanceIndexes a workspace and exposes code-navigation tools to Codex, enabling symbol lookup, reference finding, dependency analysis, and security audit for local codebases.10-
- AlicenseAqualityDmaintenanceA project-local MCP bridge that allows Codex Desktop to plan tasks and OpenCode to execute them within the current project directory, with session reuse and native OpenCode background subagents.41MIT
- AlicenseNot gradedqualityBmaintenanceA local coding bridge that enables ChatGPT to read, edit, test, and manage Git operations on your local projects.25 npmMIT