Codex Plus MCP
Wraps multiple official ChatGPT Plus/Pro/Team accounts and drives the OpenAI Codex CLI to run GPT sub-agent tasks, monitor real 5h/7d quota, and generate or edit images via Codex.
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 Plus MCP Launch a read-only flagship review of my current changes and flag P0/P1 issues."
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 Plus MCP?(对比一览)
在 Antigravity、Claude Code、Cursor 等主控 Agent 中接入 GPT 时,传统方式各有硬伤。下表直观对比 4 种常见方案:
对比维度 | 原生手敲 | OpenAI API Key MCP | 网页爬虫桥接 ( | Codex Plus MCP(本项目) |
复用 Plus 订阅(0 额外 API 费) | ✅ 单号 | ❌ 按 Token 另付高额 API 费 | ⚠️ 依赖网页 Cookie | ✅ N 个 Plus 账号池,自动剥离 |
多账号并发隔离(零串号) | ❌ 共用 | — | ❌ 易冲突 | ✅ 独立 |
真实 5h / 7d 官方额度 & 429 精准冷却 | ❌ 需手动进交互模式 | ❌ 仅计费账单 | ❌ 盲猜 | ✅ |
突破主控终端无网沙箱限制 | ❌ 每次联网命令需审批 | ✅ Stdio MCP | ⚠️ 依赖常驻浏览器 | ✅ 纯 Stdio MCP,配置一次永久无感直连 |
模型分级路由 + 不支持自动回退 | ❌ 每次手写 | ⚠️ 固定模型 | ❌ 受限于前端 DOM | ✅ |
读图 & 原生 GPT 文生图/改图 | ⚠️ 易踩 | 💰 生图单独按张计费 | ⚠️ DOM 极易失效 | ✅ 修复 |
多轮长对话 & 防 429 跨号串话 | ❌ 手动记 UUID | ⚠️ 状态难跨端 | ❌ 依赖网页 Tab | ✅ 每号自动追踪 15 条命名线程,429 自动提示摘要交接 |
安全写入隔离(单写原则 + Worktree) | ⚠️ 默认权限过宽 | ❌ 无本地文件能力 | ❌ 无本地能力 | ✅ 默认 |
Windows 健壮性(进程树 / BOM / 并发) | ⚠️ 易留孤儿进程 / 引号转义坑 | ✅ | ❌ 经常弹窗/风控 | ✅ |
安装体验(账号录入 + OAuth 授权) | ❌ 全手工改 | 手填 Key | 手动维护 Profile | ✅ |
典型收益:
零额外依赖、零额外 API 费:纯 Node.js(>= 20)内置模块实现,直接复用已有的 1~N 个 ChatGPT Plus 订阅;
智能省额提速:5 分钟额度 TTL 缓存省去重复 RPC 探测(提速 1~2s/轮),
codex_list_accounts自动推荐余量最足的账号(recommendedAccount),并可选接 DeepSeek Flash 做低成本全网调研与文档预消化,把宝贵的 Plus 额度留给科研推导、核心算法与代码终审。
Related MCP server: Pair
系统架构与编排工作流
1. 系统分层架构
2. 多模型 5 阶段协同流(内置于 Antigravity 2.0 规则模板)
flowchart LR
U["用户需求"] --> M["主控 Agent (Antigravity / Claude / Cursor)"]
subgraph S0["Stage 0 · 前置全网调研"]
DS["deepseek_search / flash"] --> Cache["参考缓存区 (research-cache)"]
end
subgraph S1["Stage 1 · 背靠背对齐"]
Plan["GPT 独立方案 (仅原话+客观事实)"] --> Merge["交叉核实与 Spec 拆解"]
end
subgraph S2["Stage 2–3 · 分级执行与双阶段审查"]
Exec["tier 分级: luna / sol / astra / terra"]
Img["codex_generate_image (文生图 / 读图改图)"]
WT["独立大模块可选 --worktree"]
Rev["两阶段审查: Spec合规 -> P0/P1 (最多2轮)"]
Exec --> WT --> Rev
Img --> Rev
end
M -->|"复杂课题/工程"| DS
Cache -->|"精简事实包"| M
M -->|"大方案防锚定"| Plan
Merge --> Exec & Img
Rev -->|"核验 diff/测试 + 人话交付"| M快速开始(交互式安装与账号授权)
前置要求
Node.js >= 20(项目本身 0 第三方 npm 依赖,无需
npm install)OpenAI Codex CLI:
npm install -g @openai/codex至少 1 个 ChatGPT Plus / Pro / Team 官方订阅账号
一步启动交互式安装与授权向导
git clone https://github.com/Mcdull581/codex-plus-mcp.git
cd codex-plus-mcp
npm run setup也可以直接运行对应平台的一键脚本:
Windows PowerShell:
powershell -ExecutionPolicy Bypass -File .\scripts\install-antigravity.ps1macOS / Linux:
bash ./scripts/install-antigravity.sh
安装向导会自动带你完成 5 步
步骤 | 向导执行内容 | 说明 |
1/5 | 环境检测 & 独立目录部署 | 默认部署至 |
2/5 | 交互式账号数据录入 | 自由设置 1~10 个账号槽位,逐个录入 |
3/5 | 逐个官方 OAuth 浏览器授权 | 自动隔离 |
4/5 | 可选配置 DeepSeek API Key | 默认可跳过;填入后写入本地 |
5/5 | 一键接入客户端 & 协议自检 | 可选自动安装为 Antigravity 2.0 原生 Plugin(含 MCP + Skill + Rule),同时输出通用 |
随时补登或刷新单个账号:
node ~/.codex-plus-mcp/scripts/setup.mjs --login plus-2
8 个内置 MCP 工具
工具名 | 分类 | 核心能力 | 关键参数 |
| 账号与额度 | 按余量推荐排序输出 |
|
| 账号与额度 | 修改备注标签、设置默认模型、清除冷却标记或动态新增账号槽位 |
|
| GPT 子 Agent | 无头启动新任务(默认 |
|
| GPT 子 Agent | 在同账号既有长对话中继续追问以命中 Prompt Cache(自动识别最近 |
|
| 代码与方案审查 | 严格只读「两阶段分级审查」(阶段一 Spec 合规 + 阶段二 P0 阻断 / P1 建议,防过度吹毛求疵) |
|
| 原生生图/改图 | 启用 Codex CLI 原生 |
|
| 可选 DeepSeek | 调用 |
|
| 可选 DeepSeek | 优先调用 |
|
模型分级路由
支持在 ~/.codex-plus-mcp/accounts.json 顶层的 modelTiers 自定义任意模型映射:
| 默认模型 | 默认推理深度 | 推荐场景 |
|
|
| 结构化抽取、日志解析、轻量初筛 |
|
|
| 日常模块编码、重构、常规代码审查(性价比甜点) |
|
|
| 科研证明、数学建模核心、复杂架构与疑难 Debug |
|
|
| 配合 |
安全回退保障:如果所选
tier的模型 slug 暂不被当前账号支持,服务端会自动剥离-m回退到 Codex CLI 默认模型重试一次,并在subagent_meta中标记modelFallback: true,确保绝不因模型名变更卡死。
进阶配置与示例
在你的 MCP 客户端配置文件中加入(路径替换为 npm run setup 输出的实际绝对路径):
{
"mcpServers": {
"codex-plus": {
"command": "node",
"args": ["/path/to/home/.codex-plus-mcp/server.mjs"],
"env": {
"CODEX_BRIDGE_HOME": "/path/to/home/.codex-plus-mcp"
}
}
}
}如需通过环境变量提供 DeepSeek 密钥,可在 env 中追加 "DEEPSEEK_API_KEY": "sk-..."。
文生图并保存到指定路径:
{ "account": "plus-1", "prompt": "Clean Nature-style academic schematic of a dual-agent verification pipeline, crisp vector aesthetic, white background", "output_path": "/path/to/project/figures/pipeline.png", "size": "1536x1024", "quality": "high" }先读图再改图(Image-to-Image):
{ "account": "plus-1", "reference_images": ["/path/to/project/figures/draft.png"], "prompt": "保留整体架构布局,将配色调整为蓝灰学术科研配色,放大节点字号并优化箭头对齐", "output_path": "/path/to/project/figures/final.png" }
每次生图约消耗 3–5× 普通轮次额度,工具会在生成结束后自动强制刷新一次官方 Plus 5h/7d 实时额度并写入
subagent_meta。
scripts/setup.mjs 支持自动化参数,便于脚本化部署或二次集成:
node scripts/setup.mjs \
--non-interactive \
--target ~/.codex-plus-mcp \
--accounts '[{"id":"plus-1","label":"Personal"},{"id":"plus-2","label":"Work"}]' \
--skip-auth隐私与安全保障
运行时数据与源码物理隔离:所有
auth.json、accounts.json、deepseek.json、会话日志与生成图片默认存放在仓库外的~/.codex-plus-mcp/,从根源避免git add .泄露个人凭据。严格
.gitignore兜底:已屏蔽accounts/、accounts.json、auth.json、deepseek.json、.env等所有敏感路径。强制走 Plus 订阅防误扣费:拉起 Codex 子进程时自动清除
OPENAI_API_KEY,杜绝意外触发按量 API 账单。单写原则(Single-Writer):默认锁定
--sandbox read-only,仅在显式授权sandbox: "workspace-write"或 Git 仓库开启worktree: true时才允许写入。
测试验证
npm test内置测试套件覆盖:MCP 协议握手、8 工具 Schema、余量推荐排序、5 路并发原子写 mutateRegistry、images / worktree / DeepSeek 守卫、Mock Codex CLI 端到端 -i ... -- - + --enable image_generation 拷贝与强制额度刷新、以及 setup.mjs 账号录入向导。
License
Available Tools
8 toolscodex_execB
以子 Agent 形式启动新的 Codex (ChatGPT Plus) 会话执行任务。支持模型分级路由(tier)、本地图片附件(images)和独立 Git worktree 隔离写入(worktree)。若 tier 模型不被账号支持会自动回退 CLI 默认模型。
Inputs: prompt (required), account (required), tier, model, +7 more.
codex_generate_imageA
使用指定的 ChatGPT Plus 账号通过 Codex CLI 原生 --enable image_generation 生成或编辑图片(零额外 API 费用,走 Plus 订阅额度)。支持传 reference_images 先读图再改图/图生图、透明底、自定义保存路径 output_path,并自动刷新真实 Plus 额度。
Inputs: prompt (required), account (required), size, tier, +8 more.
codex_list_accountsA
查询所有已注册 ChatGPT Plus 隔离账号的状态、备注、额度快照(按余量推荐排序并返回 recommendedAccount)、最近命名会话列表,以及可选 DeepSeek 扩展余额状态。设置 include_live_quota=true 可并行拉取所有账号及 DeepSeek 的实时官方额度。
Inputs: check_live_status, include_live_quota.
codex_manage_accountC
管理 ChatGPT Plus 账号池元数据(改备注、设默认模型、清冷却、新增账号)。
Inputs: action (required), account (required), value.
codex_resumeA
让 GPT 子 Agent 在已有长对话线程中继续推进同一主题以命中 Prompt Cache(支持传图 images 和 tier/reasoning_effort)。严禁跨账号传旧 session_id。
Inputs: prompt (required), account (required), tier, model, +6 more.
codex_reviewB
使用指定 Plus 账号以严格只读模式执行两阶段分级审查(先查 Spec 合规,再查 P0 阻断/P1 建议,防过度吹毛求疵)。默认 balanced 档 + high 推理,高危场景可升 flagship/xhigh。
Inputs: account (required), working_dir (required), tier, focus, +3 more.
deepseek_askA
调用 DeepSeek API(低成本批量预读、资料降噪、实体关系抽取或深度推理备胎),支持 flash(deepseek-flash)和 pro(deepseek-v4-pro)两档及可选服务端联网搜索,返回与 GPT 一致的 Token 用量与真实账户余额。
Inputs: prompt (required), tier, model, thinking, +4 more.
deepseek_searchA
调用 DeepSeek 联网检索与网页摘要能力(优先 /v1/tools/search,不可用时自动降级为 deepseek-flash 联网检索),返回精简带出处的事实清单并记录 Token 用量与余额。
Inputs: query (required), count, summarize, need_content, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Most tools have clearly distinct roles: exec (new session) vs resume (existing thread) vs review (read-only audit) vs generate_image are easy to tell apart, and list_accounts vs manage_account split read/write on the account pool. The one soft overlap is deepseek_ask, which optionally offers server-side web search that parallels deepseek_search; descriptions help but the boundary is slightly blurry.
Names use a consistent snake_case with provider prefixes (codex_/deepseek_), making grouping predictable. Minor deviation: exec, resume, and review are bare verbs without a noun object, unlike list_accounts / manage_account / generate_image / ask / search.
Eight tools is well within the ideal range and each earns its place: four execution modalities, two account operations, and two DeepSeek capabilities. No tool appears redundant or gratuitous for the stated scope.
The surface covers account lifecycle (list/add/annotate/cooldown), task execution (new, resume, review, image gen), and DeepSeek reasoning/search. Gaps are minor: no delete/remove account or session, and no cancel/stop for a running session, but agents can work around these.
Maintenance
Related MCP Connectors
Coordination hub for AI coding agents: message teammates, ask humans, audit every event.
Multiplayer for the coding agents your team already uses: shared tasks, decisions, skills and tools.
AI work orchestration for plans, tasks, teams, and coding-agent dispatch.
Your AI agent is smart enough to code all day. Local firewall & zero-loss runtime.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenancePools multiple Claude Code and Codex subscriptions and routes each coding task to the account with the most available quota, handling cooldowns and failover automatically.MIT
- AlicenseNot gradedqualityCmaintenanceEnables users to delegate coding tasks in a chosen project to the official Codex and Claude CLI agents from within an existing chat, then convene a council of configured models to gather independent opinions and review the resulting files and test runs. It also manages multi-provider API connections, model catalogs, and per-task token, time, and cost limits.MIT
- AlicenseNot gradedqualityAmaintenanceEnables dispatching tasks from coding hosts such as Claude Code, Codex, Antigravity and Grok to DeepSeek Harness agents that appear as native subagents with live progress, tier/effort policy, escalation, and workspace guardrails. Also lends text-only harnesses vision and image generation through DeepSeek VL models or existing CLIs.354 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables coding hosts like Claude Code, Codex, Antigravity and Grok to dispatch tasks to DeepSeek Harness agents as native subagents, with live progress, tier/effort policy, escalation and jobs tracking. It also bridges text-only harnesses to vision, routing image description and generation through DeepSeek's VL model or configured CLIs and OpenAI-compatible endpoints.354 npmMIT