MCP server wrapping Codex CLI for stdio-based tool calls.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent — or use 1-click editor setup below.
💡 Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
codex-mcp-go 是一个基于 Go 语言实现的 MCP (Model Context Protocol) 服务器。它封装了 OpenAI 的 Codex CLI,使其能够作为 MCP 工具被 KiloCode、Roo Code、Cline 等各种 "Vibe Coding" AI 客户端调用。
这个项目的初衷很简单:让强者更强,让专才专用。
在我自己的工作流中(在 KiloCode 里使用 Gemini 3.0 Pro),我发现像 Gemini 这样的先进模型拥有强大的规划能力和想象力,但在修复自己生成的复杂代码时偶尔会“卡壳”。而 Codex,这位老练的“代码老师傅”,虽然在宏大叙事上稍逊一筹,但在具体的代码实现、Bug 修复和遵循精确指令方面却无人能及。
所以,为什么不让它们合作呢?
受到 codexmcp (Python 实现) 的启发,我决定用我更喜欢的 Go 语言,边学 mcp-go-sdk 边重复造了这个轮子,主要目的是练手并打造一个更适合我自己的工具。
现在,你可以用一句话,在任何支持 MCP 的 Vibe Coding 工具中,让 Gemini 或 Claude 这样的“总指挥”去调用 Codex 这个“特种兵”来完成最棘手的编码任务。
主要特性:
SESSION_ID 维持多轮对话上下文。read-only、workspace-write 等安全策略。本工具依赖 OpenAI 的 codex CLI。请确保您已安装并配置好它。
安装 Codex CLI:
无需安装 Go 环境,直接运行:
从 Releases 页面下载对应平台的二进制文件。
需要 Go 1.24+ 环境。
根据您使用的 AI 客户端,选择对应的配置方式。
在 Roo Code 的 MCP 设置中添加:
配置文件路径参考:
~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json~/.config/Cursor/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json在 ~/.kilocode/mcp.json 中添加:
codexstdionpx-y @zenfun510/codex-mcp-go如果您已通过 go build 构建了二进制文件(假设路径为 /path/to/codex-mcp-go),可使用以下配置:
codexstdio/path/to/codex-mcp-go需先完成 initialize 握手,然后才能调用 tools/list。若返回包含 codex 工具的 JSON 数据,即表示运行正常。
支持通过 TOML 配置文件 或 环境变量 调整运行策略。优先级:默认值 < 配置文件 < 环境变量。
环境变量(会覆盖配置文件):
CODEX_MCP_SERVER_NAME / CODEX_MCP_VERSIONCODEX_DEFAULT_TIMEOUT / CODEX_MAX_TIMEOUT / CODEX_NO_OUTPUT_TIMEOUT(单位:秒)CODEX_MAX_BUFFERED_LINES / CODEX_EXECUTABLE_PATHCODEX_ALLOWED_MODELS / CODEX_ALLOWED_PROFILES(逗号分隔;* 表示允许任意值;默认空=全部拒绝)CODEX_DEFAULT_SANDBOX / CODEX_ALLOWED_SANDBOX_MODES(逗号分隔)CODEX_ALLOWED_WORK_DIRS(逗号分隔的目录前缀列表;空=不限制)CODEX_DISABLE_YOLO(true/false)CODEX_LOG_LEVEL / CODEX_LOG_FORMAT / CODEX_LOG_OUTPUT / CODEX_LOG_FILE为了获得最佳体验,建议根据您使用的客户端类型配置相应的系统提示词。
适用于能够自主规划和执行多步任务的 Agent。
对于 KiloCode / Roo Code / Cline 用户: 本项目提供了针对不同客户端的预配置专家模式文件。请根据您使用的客户端选择对应的文件导入:
codex-engineer-kilocode.yamlcodex-engineer-roocode.yamlcodex-engineer-cline.yaml导入后,您将获得经过调优的 "Codex 协作专家" 模式,该模式已针对您的客户端进行了身份认同适配。
对于 Claude Code 或手动配置: 请将以下内容添加到您的 Agent 配置或作为任务的初始指令:
适用于作为 IDE 插件运行的助手。建议添加到 .clinerules (Roo Code) 或 "Rules for AI" (Cursor) 中:
工具名称:codex
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
PROMPT | string | ✅ | - | 发送给 Codex 的指令 |
cd | string | ✅ | - | 工作目录路径 |
sandbox | string | ❌ | "read-only" | 策略:read-only / workspace-write / danger-full-access |
SESSION_ID | string | ❌ | "" | 会话 ID,用于多轮对话 |
skip_git_repo_check | bool | ❌ | true | 允许在非 Git 目录运行 |
return_all_messages | bool | ❌ | false | 返回完整推理日志 |
image | []string | ❌ | [] | 附加图片路径 |
model | string | ❌ | "" | 默认禁止,除非显式允许 |
yolo | bool | ❌ | false | 跳过所有确认(非交互) |
profile | string | ❌ | "" | 默认禁止,除非显式允许 |
timeout_seconds | int | ❌ | 1800 | Codex 调用的总超时(秒,最多 1800) |
no_output_seconds | int | ❌ | 0 | 无输出达到该秒数后终止运行(0 表示关闭) |
运行时行为: 默认 30 分钟总超时(上限 30 分钟),无输出看门狗默认关闭;出现错误行、非零退出会携带最近输出返回,便于定位卡住原因。若网络慢或 MCP 客户端自身有较短的 RPC 超时,调用时保持 timeout_seconds=1800,以避免过早被取消。
默认策略: sandbox=read-only、yolo=false、skip_git_repo_check=false;model/profile 默认拒绝,需显式放行;timeout_seconds=1800(最多 1800)、no_output_seconds=0(关闭)。
| 特性 | 官方 Codex CLI | CodexMCP (本工具) |
|---|---|---|
| 基本 Codex 调用 | ✅ | ✅ |
| 多轮对话 | ❌ | ✅ (通过 Session 管理) |
| 推理详情追踪 | ❌ | ✅ (完整日志捕获) |
| 并行任务支持 | ❌ | ✅ (MCP 协议支持) |
| 错误处理 | ❌ | ✅ (结构化错误返回) |
No reviews yet — be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/codex-mcp-go)<a href="https://allmcps.com/mcp/codex-mcp-go"><img src="https://allmcps.com/api/badge/codex-mcp-go?style=directory" alt="Codex MCP Go on AllMCPs" /></a>