codex-manager-mcp
Provides management of local OpenAI Codex CLI sessions, enabling starting, monitoring, messaging, stopping, hooking, and adopting Codex tasks.
Click on "Install 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-manager-mcpstart a codex task to fix the failing test"
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 Manager MCP
Disclaimer: This project is not affiliated with or endorsed by OpenAI. "OpenAI Codex" is a trademark of OpenAI. This tool merely wraps and manages the locally-installed Codex CLI using the user's own login; it does not bypass authentication, scrape, or redistribute any OpenAI proprietary content.
一个在 Claude Code 里管理本机 codex CLI 会话的 MCP 服务器。它直接 spawn codex exec 子进程并统一管理:启动、状态、消息、中途注入、停止、消息 hook、崩溃自动重启、外部会话采纳。
核心理念: 每个 codex 任务就是一个由本 manager 启动的 codex exec 进程。codex_run 是阻塞式工具调用,Claude Code 客户端会自动后台化超时的调用——因此每个运行中的 codex 任务自动成为 Claude Code 的原生后台任务,计入底部 "N background tasks",完成时任务通知唤醒 agent。UI 展示零成本。
安装
npm install # 安装依赖
npm run build # 编译到 dist/配置到 Claude Code(.mcp.json 或 ~/.claude/settings.json):
{
"mcpServers": {
"codex-manager": {
"command": "node",
"args": ["~/codex-manager/dist/src/index.js"]
}
}
}建议(唤醒/后台化): 启动 Claude Code 时设 CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS=1000,让 codex_run 约 1 秒后自动转入后台,完成时以任务通知唤醒 agent(无需等默认的 2 分钟)。
Related MCP server: Claude Code MCP
工具
工具 | 说明 |
| 启动 codex 任务(镜像 |
| 查询任务状态。 |
| 查询某任务消息。 |
| 向运行中任务注入消息( |
| 停止/杀死任务。 |
| 消息 hook 增/删/列。 |
| 扫描外部 codex 会话(只读,不含已采纳的)。 |
| 把外部会话纳入本 manager 管理(纳入后可 send/messages/stop/hook)。 |
消息分级
codex_messages 的 level 取值:user / commentary(agent 实时评论)/ final(回合最终输出)/ reasoning / tool(工具调用)/ result(工具结果)/ event(会话事件)/ token(用量)。
Hook 示例
codex_hook add {pattern:"ERROR", match:"contains", level:"commentary"}
codex_hook add {pattern:"\\d{3} tokens", match:"regex", id:3} # 仅任务3
codex_hook list
codex_hook remove {hookId:"..."}命中后 hook 的 hitCount 递增。若命中消息属于阻塞中的 codex_run,完成通知会一并携带。
外部会话
codex_discover列出近期外部会话(只读)。codex_adopt {sessionId}纳入管理 → 出现在codex_list,可 send/messages/hook。未采纳的会话不能执行任何操作。
自动重启(失败重连)
启动失败或非正常退出(exit≠0)→ 1 分钟后自动重启,最多
maxAttempts(默认 3)次。第 3 次仍失败 → 任务状态
failed+ 通知。单任务可覆盖:
codex_run {..., maxAttempts:5}。
环境变量
变量 | 作用 | 默认 |
| 状态文件路径 |
|
| 显式指定 codex 可执行文件(否则自动解析) | 自动解析 |
| 设为 | 关闭 |
| 设为 | 关闭 |
| codex 配置/会话目录(若非常规位置) |
|
可选增强
状态行:
scripts/statusline.mjs输出n codex,配置statusLine+refreshInterval:2。codex 任务本身会被自动计入底部后台任务计数,通常无需此脚本。/codex页面:commands/codex.md是 prompt 型斜杠命令,让 Claude 渲染任务状态页。Channels 推送:完成/hook 命中事件主动唤醒 agent(需
CODEX_MANAGER_CHANNELS=1+ 启动 flag,research preview)。
测试
npm test # 单元测试(vitest)
CODEX_MANAGER_INTEGRATION=1 node scripts/smoke-integration.mjs # 真实 codex 端到端(消耗少量 token)Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceEnables MCP clients to spawn and control Codex CLI and Claude Code sessions on the host machine, with session management and filesystem access.4MIT
- AlicenseAqualityDmaintenanceEnables AI agents to interact programmatically with Claude Code CLI, managing sessions, streaming outputs, and handling permission requests.7131MIT
- Flicense-qualityCmaintenanceEnables ISLI agents and MCP clients to dispatch natural-language coding and terminal tasks to a locally-installed Claude Code CLI, supporting both one-shot execution and persistent sessions with workspace and security controls.
- Alicense-qualityBmaintenanceA stdio MCP server that lets Codex Desktop/CLI delegate implementation tasks to Claude Code CLI with workspace validation, Git status checks, and session resume capabilities.4MIT
Related MCP Connectors
Live SEO workflow tools for Claude Code, Codex, and AI agents.
Persistent context for Claude. Your AI always knows your projects and next actions across sessions.
Cross-agent artifact workspace with provenance across Claude Code, Codex, Cursor, LangGraph.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/SinCircle/codex-manager-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server