codex-executor
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-executor Start a Codex job to add tests for the payment module, then review the diff."
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.
Antigravity × Codex CLI MCP Orchestrator
将 Google Antigravity(Gemini 主控大脑)与本机 OpenAI Codex CLI 执行层深度联动 原生 Antigravity 侧边栏 CLI 终端 · GPT 多模型分层路由 · 并发多智能体任务组 · 跨模型对抗审校闭环
盲测质量实证 · 系统架构 · 核心能力 · 快速开始 · MCP 工具手册 · 复现评测
💡 为什么需要它?
在大型工程开发与缺陷排查中,单智能体串行闭环往往存在两个结构性短板:
盲区同源:同一个模型既写代码又自查,容易放过同源边界假设(例如乐观并发控制 ABA 异常、定时器 32 位整数溢出、原型链属性碰撞、WAL 损坏尾部处理等深水区缺陷)。
黑盒不可观测:普通后台命令执行只吐纯文本日志,难以在 IDE 侧栏实时观察多个执行代理的进度、命令执行详情与会话状态。
antigravity-codex-mcp (codex-executor v2.1.0) 构建了一套**“策划层与执行层解耦”**的双层工作流:
Antigravity(Gemini 主控) 担任 Chief Orchestrator:负责读懂需求、架构拆解、划分无冲突文件域、动态选择 GPT 模型与推理强度,并用独立隐藏测试与跨模型审查验收结果。
本机 Codex CLI 集群 担任 Execution Workers:在严格沙箱与持久化账本下并发执行只读审计、代码落地、单元测试与 Git 审查;遇到深水区缺陷时,通过
codex_resume回到原会话定点返工闭环。原生侧边栏控制台(MCP App):直接在 Antigravity 右侧边栏 / 全局入口渲染富排版卡片终端,无需切出 IDE。
Related MCP server: Roundtable AI MCP Server
📊 盲测质量与抓错能力实证
为了验证“Gemini 主控 + Codex 并发执行 + 跨模型对抗审查”是否确实优于单兵工作模式,仓库内置了可完全复现的双赛道受控盲测套件(原始评测数据见 benchmark/results.json,完整报告见 docs/QUALITY_BENCHMARK.md):

图注:(a) Track 1 十项隐蔽生产缺陷盲测召回率与沙箱实证复现率对比;(b) Track 2
MiniStore事务存储引擎在 18 项核心规格测试与 4 项深水区对抗压测下的通过率分布;(c) 22 项隐藏盲测累计可靠性对比;(d) 跨三个真实工程仓库的交叉审错与当轮修复统计。
Track 1:10 处隐蔽生产缺陷盲测抓错(benchmark/bug_hunt_fixture/)
在 4 个独立 Node.js ESM 模块(限流器、LRU/TTL 缓存、Webhook 验签、批处理器)中预埋 10 处典型线上缺陷(ground_truth.json),三组均在只读隔离盲测下执行:
参评方案 | 严格全命中 (Strict Recall) | 含部分命中 (Incl. Partial) | 精确率 (Precision) | 沙箱运行时实证复现率 |
Antigravity 单兵 (Gemini) | 9/10 (90%) | 9.5/10 (95%) | 100% ( | 0/10 (0%)(仅静态阅读) |
Codex CLI 单兵 ( | 10/10 (100%) | 10/10 (100%) | 100% ( | 4/10 (40%) |
Gemini + Codex 协同 ( | 10/10 (100%) | 10/10 (100%) | 100% ( | 6/10 (60%) |
关键发现:协同组将安全/并发审校(
gpt-6.2-sol)与状态机/数学边界审校(gpt-6.2-astra)按领域拆分后,不仅保持 10/10 全命中与零误报,还把在 Node 沙箱内写 POC 实证复现的缺陷比例从0%提升至60%(覆盖__proto__驱逐残留、未单飞缓存覆盖、第 26 次指数退避 32 位溢出塌缩为1ms等)。
Track 2:MiniStore 事务存储引擎盲测正确率(benchmark/mini_store_spec.md)
两组均从同一份只读规格从零实现支持 WAL 崩溃恢复、TTL 过期、原型污染防护、structuredClone 隔离、快照隔离事务与 OCC 乐观并发控制的存储引擎,之后经受 22 项隐藏盲测(18 项核心规格 + 4 项深水区对抗压测):
测试阶段 | 考察范围 | Antigravity 单兵 | Gemini + Codex 协同 |
核心规格盲测(18 题) | CRUD、原型键、 | 18/18 (100%) | 18/18 (100%) |
深水区对抗压测(4 题) |
| 0/4 (0%) | 4/4 (100%) |
隐藏盲测总通过率(22 题) | 全部隐藏盲测题 | 18/22 (81.8%) | 22/22 (100%) |
闭环机制:
gpt-6.2-astra初版自测通过 11/11 后,Gemini 主控派出另一模型gpt-6.2-sol编写 VM 沙箱反例进行对抗审查,揪出 5 项深水区缺陷,再经codex_resume派回原会话定点修补,最终 4/4 全部通过深水区盲测;而单兵组在全部 4 道深水区测试上均触发CONFLICT漏检或初始化崩溃。
更多真实仓库交叉审错数据及并发加速/缓存遥测,请参阅:
docs/QUALITY_BENCHMARK.md — 完整质量与抓错盲测报告
docs/BENCHMARK.md — 并发加速比(最高
2.29×)与 Prompt 缓存命中率(83%–89.5%)遥测
🏗 系统架构
flowchart TD
host["Antigravity (Gemini) · Chief Orchestrator"] <-->|Stdio JSON-RPC 2.0| mcp["codex-executor MCP Server"]
host -->|MCP App UI| ui["原生侧边栏控制台 · Codex 终端监控"]
ui -->|App 工具轮询与控制| mcp
mcp -->|任务调度与模型路由| mgr["Job Manager & Router"]
mgr <-->|原子快照持久化| ledger["运行账本 · _runs/"]
subgraph workers["本地 Codex CLI 并发执行层"]
w1["gpt-6.2-sol · 审校与对抗压测"]
w2["gpt-6.2-astra · 编码、单测与返工"]
end
mgr -->|并发派发| w1
mgr -->|并发派发| w2核心设计文档详见 docs/ARCHITECTURE.md。
✨ 核心能力一览
1. 原生 Antigravity 侧边栏控制台(MCP App)
通过标准 MCP App 协议暴露资源
ui://codex-executor/console.html,并声明 Antigravity 原生aux_pane与global双入口(标题:Codex 终端监控)。Codex CLI 级富排版:将 JSON/CLI 事件流渲染为结构化 Markdown 卡片、可折叠
• Ran命令执行面板、自动识别文件路径生成一键跳转链接,并在主视图中过滤良性unrecognized configuration setting提示。双视图切换 + 交互控制:支持“对话与执行实况”与“原始日志(stdout/stderr)”独立切换,可直接在侧栏修改默认 GPT 模型与推理强度或一键中止运行中的任务。
零外部运行时依赖:构建产物
dist/console.html已预打包随仓库分发,服务本身直接用原生 Node.js ESM 模块运行。
2. GPT 模型与推理强度动态分层路由
按 显式参数 > preset > <ANCHOR_DIR>/_runs/routing.json 默认值 > <CODEX_HOME>/config.toml 四级优先级解析模型与 model_reasoning_effort:
内置 Preset / 角色建议 | 模型 ( | 推理强度 ( | 典型分工 |
|
|
| 快速只读扫盘、摘要、轻量探活 |
|
|
| 日常模块编码、单元测试补齐 |
|
|
| 复杂状态机实现、多文件重构 |
|
|
| 极高难度算法与核心协议攻坚 |
跨模型对抗审查推荐 |
|
| 作为独立审查官编写反例压测 |
3. 并发任务组(Group Fan-Out)与会话闭环(codex_resume)
通过
group+task_name+wait_seconds: 0将多个互不冲突的子任务同时派发给多个 Codex 进程。使用
codex_group_status支持wait_mode: all | any | none统一回收结果;若审查发现缺陷,通过codex_resume直接复用原session_id定向返工,保留完整上下文。每次执行元数据与消息流自动原子持久化到
<ANCHOR_DIR>/_runs/index.json(保留最近 500 条)与_runs/jobs/<job_id>.json;进程异常退出重启后自动将遗留running标记为interrupted。
4. 自动二进制发现与沙箱保护
src/codex-locator.mjs自动遍历CODEX_BIN、全局npm、WindowsApps(含 PowerShellGet-AppxPackage回退)、LocalAppData与PATH,按语义化版本择优(正式版优先于预发布版)。支持
sandbox: read-only | workspace-write | danger-full-access,默认配合-c approval_policy="never"非交互运行。
🧭 实事求是的工程边界(何时派发 Codex?)
基于实测冷启动基线(单次拉起 codex.exe 与加载上下文固定耗时约 12.6s – 14.4s),建议采用**“大小活动态路由”**:
任务类型 | 推荐执行方式 | 原因 |
小活(单文件小改、查几行代码、预计 | Antigravity 主控直接完成 | 避免 ~13s 进程冷启动等待,响应最快 |
大活 / 并发活(多模块改造、全仓扫盘、大段单测) |
| 按文件域并行拆分实测加速可达 1.56×–2.29×,节省主控上下文 |
高风险关键逻辑(存储、并发、鉴权、事务) |
| 借助跨模型异源审查捕捉深度边界 Bug,突破单模型盲区 |
注意:Antigravity 等宿主对单次 MCP 工具调用通常有 ~180s 超时限制,轮询等待
codex_status/codex_group_status时建议将wait_seconds控制在<= 90秒并分段轮询。
🚀 快速开始
前置条件
Node.js ≥ 20(服务运行本身零第三方依赖)
本机已安装并登录 OpenAI Codex CLI(建议
codex-cli 0.174.0+,终端执行codex --version可正常输出)Google Antigravity(或其他支持 MCP Stdio / MCP App 的客户端)
第一步:克隆仓库
git clone https://github.com/WenNinghan/antigravity-codex-mcp.git
cd antigravity-codex-mcp仓库已包含预编译好的
dist/console.html,一般使用者无需运行npm install即可直接配置启动。只有修改了src/app/前端控制台源码时,才需要执行npm ci && npm run build:app重新构建面板。
第二步:接入 Antigravity MCP 配置
参考 mcp_config.example.json,在你的 MCP 配置文件(如 ~/.gemini/config/mcp_config.json)中添加:
{
"mcpServers": {
"codex-executor": {
"command": "<PATH_TO_NODE>",
"args": ["<REPO_DIR>/src/server.mjs"],
"env": {
"CODEX_ANCHOR_DIR": "<ANCHOR_DIR>",
"CODEX_TEMP_DIR": "<TEMP_DIR>"
}
}
}
}环境变量说明
变量名 | 是否必填 | 默认值 | 说明 |
| 推荐设置 |
| 持久化账本 |
| 推荐设置 |
| 临时运行日志与消息文件目录(Windows 用户建议设到非系统盘如 |
| 可选 | 自动探测最高版本 | 显式指定 |
| 可选 |
| 指定读取 |
| 可选 |
| 独立 HTTP 看板监听端口(仅用于 standalone 模式) |
第三步:在 Antigravity 中开始指挥
重载 MCP 服务后,你可以直接对 Antigravity 说:
“先调用
codex_info检查 Codex CLI 与锚点状态,再打开codex_dashboard侧边栏控制台。”“用
gpt-6.2-sol(只读)和gpt-6.2-astra并发审计当前仓库:一个查安全与并发隐患,一个查测试覆盖率与边界缺陷。”“让
astra按规格实现这个模块并跑通自测,再用sol对抗审查构造反例,有问题就用codex_resume退回修改。”
🛠 MCP 工具与资源参考
src/server.mjs 共向宿主注册了 13 个工具(其中 9 个对模型可见、4 个仅供侧边栏 UI 面板调用)与 1 个 MCP App 资源。
模型可调用工具(9 个)
工具名 | 核心参数 | 功能说明 |
|
| 启动新的 |
|
| 沿用既有 Codex 会话上下文继续执行或定点返工 |
|
| 调用 |
|
| 查询单个任务状态或阻塞等待其完成 |
|
| 列出全部任务组,或聚合查看/等待同一任务组下所有子智能体 |
|
| 终止指定 |
|
| 查看本机可用 GPT 模型与推理等级,或更新/重置全局默认路由 |
| (无参数) | 返回运行统计并附带 |
|
| 检查当前探测到的 |
面板专用工具(4 个,_meta.ui.visibility: ["app"])
工具名 | 说明 |
| 读取任务组树、统计计数与模型目录 |
| 按 |
| 在侧边栏内实时更新默认 GPT 模型/推理强度或重置默认值 |
| 从侧边栏 UI 一键中止指定任务 |
MCP 资源(1 个)
资源 URI | MIME 类型 | 说明 |
|
| 读取 |
🧪 测试与盲测复现
1. 运行离线单元测试与 MCP App 协议测试
# 离线单元测试(账本原子写、模型路由优先级、Codex 路径发现等)
node --test test/unit.test.mjs
# MCP App 协议 + 原生控制台 CLI 流集成测试(需本机可用 Codex CLI)
node test/mcp-app-test.mjs
# 多智能体并发编排端到端测试(需本机可用 Codex CLI)
node test/orchestrator-test.mjsWindows PowerShell 环境下如需将临时文件定向到非系统盘,可先设置:
$env:CODEX_TEMP_DIR = 'D:\path\to\tmp'; $env:TEMP = 'D:\path\to\tmp'
2. 复现 Track 2 MiniStore 隐藏与深水区对抗盲测
# 协同组实现(核心 18 题 + 深水区 4 题 = 22/22 通过)
MINISTORE_MODULE=./benchmark/impl_orchestrated/src/mini-store.mjs \
node --test benchmark/mini-store.hidden.test.mjs benchmark/mini-store.adversarial.test.mjs
# 单兵基线实现(核心 18/18 通过,深水区 0/4 失败)
MINISTORE_MODULE=./benchmark/impl_baseline/src/mini-store.mjs \
node --test benchmark/mini-store.hidden.test.mjs benchmark/mini-store.adversarial.test.mjs3. 重绘出版级盲测图表(可选,需 Python matplotlib + numpy)
python scripts/generate-quality-chart.py脚本将基于 benchmark/results.json 与 scripts/editorial_style.py 同步输出 600 DPI PNG、PDF 与 SVG 至 docs/assets/,并自动执行字号、边框与重叠 QA 门禁检查。
📂 项目结构
antigravity-codex-mcp/
├── src/
│ ├── server.mjs # Stdio JSON-RPC 2.0 MCP Server (9 模型工具 + 4 App 工具 + UI 资源)
│ ├── job-manager.mjs # Codex 进程调度、任务组管理、ANSI/事件流解析与状态机
│ ├── codex-locator.mjs # 跨位置自动探测最高版本 Codex CLI 可执行文件
│ ├── models-catalog.mjs # models_cache.json / config.toml 读取与四级路由解析
│ ├── ledger.mjs # 原子落盘账本 (_runs/index.json & jobs/<id>.json)
│ ├── app/ # Antigravity 原生 MCP App 前端控制台源码
│ └── dashboard-*.mjs/.html # 独立 HTTP 看板兼容入口
├── dist/
│ └── console.html # 预编译单文件 MCP App 控制台(开箱即用)
├── scripts/
│ ├── build-app.mjs # esbuild 控制台单文件构建脚本
│ ├── editorial_style.py # 出版级图表规范与自动 QA 门禁模块
│ └── generate-quality-chart.py# 盲测质量图表生成脚本
├── benchmark/
│ ├── bug_hunt_fixture/ # Track 1:含 10 处隐蔽缺陷的 4 个 Node.js ESM 模块
│ ├── ground_truth.json # Track 1 缺陷真值表
│ ├── mini_store_spec.md # Track 2:MiniStore 事务存储引擎规格书
│ ├── mini-store.hidden.test.mjs # Track 2 核心 18 项隐藏测试
│ ├── mini-store.adversarial.test.mjs # Track 2 深水区 4 项对抗测试 (ABA / WAL)
│ ├── impl_baseline/ # Antigravity 单兵实现对照
│ ├── impl_orchestrated/ # Gemini + Codex 协同 + 对抗返工实现
│ └── results.json # 全量实测结果数据
├── test/
│ ├── unit.test.mjs # 离线单元测试 (11/11)
│ ├── mcp-app-test.mjs # MCP App 协议与终端流校验
│ ├── orchestrator-test.mjs # 双模型并发编排端到端测试
│ └── smoke-test.mjs # 基础冒烟测试
├── docs/
│ ├── ARCHITECTURE.md # 系统架构与内部机制详解
│ ├── QUALITY_BENCHMARK.md # 双赛道盲测质量分析报告
│ ├── BENCHMARK.md # 并发加速与缓存命中遥测
│ └── assets/ # 600 DPI PNG / PDF / SVG 盲测图表
├── mcp_config.example.json # Antigravity MCP 客户端配置模板
├── package.json
└── LICENSE # MIT License📄 License
本项目基于 MIT License 开源。
Available Tools
13 toolscodex_app_cancel_jobD
Internal MCP App running job canceller.
Inputs: job_id (required).
codex_app_job_detailC
Internal MCP App job detail & live CLI stream.
Inputs: job_id (required).
codex_app_overviewC
Internal MCP App overview snapshot.
Inputs: no named parameters.
codex_app_update_routingD
Internal MCP App GPT routing configuration updater.
Inputs: reset, defaultModel, defaultReasoningEffort.
codex_cancelA
Terminate a running Codex job (by job_id) or all running jobs in a group.
Inputs: group, job_id.
codex_dashboardCodex 终端监控A
Open or refresh the native Antigravity side-pane / sidebar Codex CLI terminal monitor and multi-agent tree.
Inputs: no named parameters.
codex_group_statusB
List all task groups or wait for/inspect all child agents inside a specific group. Essential for multi-agent concurrent fan-out.
Inputs: group, wait_mode, wait_seconds.
codex_infoC
Inspect the resolved local Codex CLI executable path, version, anchor directory, effective GPT defaults, and tracked jobs.
Inputs: refresh.
codex_modelsA
Inspect available GPT models & reasoning levels from Codex models_cache.json, and optionally configure global orchestrator defaults or reset to config.toml.
Inputs: include_hidden, reset_defaults, set_default_model, set_default_reasoning_effort.
codex_resumeA
Continue an existing Codex CLI session (codex exec resume) with follow-up instructions or fixes, keeping full prior context.
Inputs: prompt (required), session_id (required), cwd, group, +7 more.
codex_reviewB
Run non-interactive Codex code review (codex review) on uncommitted changes, a branch diff, or a specific commit.
Inputs: cwd (required), base, group, title, +5 more.
codex_runA
Delegate a coding, research, refactoring, or audit task to the local OpenAI Codex CLI (codex exec). Supports anchor project grouping (group + task_name), concurrent async fan-out (wait_seconds: 0), GPT model/reasoning presets (fast, balanced, deep, ultra), and returns session_id for follow-ups via codex_resume.
Inputs: cwd (required), prompt (required), group, model, +12 more.
codex_statusB
Check status or continue waiting for an in-progress or finished Codex job by job_id.
Inputs: job_id (required), wait_seconds.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
The four `codex_app_*` tools duplicate public surface: `codex_app_cancel_job` overlaps `codex_cancel`, `codex_app_job_detail` overlaps `codex_status`, `codex_app_update_routing` overlaps `codex_models` configuration, and `codex_app_overview` overlaps `codex_info`/`codex_dashboard`. An agent must guess whether to use the 'app' variant or the core tool for the same operation, and `codex_status` vs `codex_group_status` is a further near-collision. The 'Internal MCP App' labels hint at UI-only usage but do not clearly state when to prefer one over the other.
All names use a `codex_` prefix with snake_case, and the core set follows a predictable verb/target pattern (`run`, `resume`, `cancel`, `status`, `review`, `models`, `info`). The `codex_app_*` subgroup introduces a second namespace with slightly mixed forms (`overview` and `job_detail` are nouns, `update_routing`/`cancel_job` are verb_noun), but it is still readable and internally coherent.
Thirteen tools sit comfortably in the well-scoped range for an orchestration server covering launch, resume, cancel, status, review, and configuration. The only inefficiency is that roughly a third of the set is dedicated to internal app/UI plumbing rather than distinct agent-facing operations.
The core lifecycle is well covered: delegate (`run`), follow up (`resume`), monitor (`status`, `group_status`, `info`), terminate (`cancel`), review diffs (`review`), and configure models (`models`). Minor gaps exist around explicit job listing/log retrieval as first-class tools (partially hidden in `codex_info` and `codex_app_job_detail`) and group creation semantics, but agents can work around these.
Maintenance
Related MCP Connectors
Context, runtime and review for AI coding agents. One local install.
Command center for developers coordinating AI coding agents across projects.
Run parallel coding agents: Git-worktree workspaces, agent sessions, automations, tasks.
Task manager for AI agents. Orchestrate agents to achieve large goals in unified control plane.
Related MCP Servers
- AlicenseBqualityCmaintenanceEnables a local Codex chat to ask a second opinion, review staged, unstaged, or revision-based diffs, and delegate coding tasks to the Antigravity CLI running in isolated or disposable workspaces. Supports starting, polling, retrieving, and cancelling tasks with returned answers, diffs, changed-file lists, exit codes, and time/output limits, while never auto-applying returned patches.81MIT
- FlicenseNot gradedqualityAmaintenanceEnables a primary AI coding assistant to delegate tasks to specialized local CLI agents such as Gemini, Claude, Codex, and Cursor, coordinating shared context, parallel execution, and synthesized responses from within an IDE.-
- AlicenseNot gradedqualityBmaintenanceEnables Gemini in Google Antigravity to delegate coding, testing, debugging, and review tasks to a local OpenAI Codex CLI while providing zero-token live monitoring of progress, quotas, sessions, and history.7MIT
- AlicenseNot gradedqualityBmaintenanceEnables Antigravity/Gemini to draft structured task briefs, dispatch them to a local OpenAI Codex agent, monitor logs and git diffs, and independently review or test results with bounded rework loops. It also supports parallel worktree runs, session-scoped collaboration boards, and on-demand trace inspection.39MIT