Skip to main content
Glama

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_run

启动 codex 任务(镜像 codex exec 参数)。wait 默认 true(阻塞→自动后台化);wait:false 即发即弃。支持 resumeSessionId 续接。

codex_list

查询任务状态。ended:N 包含最近 N 个已结束任务(默认 0)。含 token 明细、耗时、退出码、最后消息等。

codex_messages

查询某任务消息。level/types/since/tail/limit/fromFile 过滤;fromFile 默认从磁盘会话文件读(权威);未指定 tail/limit 时默认最近 100 条。

codex_send

向运行中任务注入消息(codex exec resume),实现中途通信。

codex_stop

停止/杀死任务。

codex_hook

消息 hook 增/删/列。

codex_discover

扫描外部 codex 会话(只读,不含已采纳的)。

codex_adopt

把外部会话纳入本 manager 管理(纳入后可 send/messages/stop/hook)。

消息分级

codex_messageslevel 取值: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,完成通知会一并携带。

外部会话

  1. codex_discover 列出近期外部会话(只读)。

  2. codex_adopt {sessionId} 纳入管理 → 出现在 codex_list,可 send/messages/hook。

  3. 未采纳的会话不能执行任何操作。

自动重启(失败重连)

  • 启动失败或非正常退出(exit≠0)→ 1 分钟后自动重启,最多 maxAttempts(默认 3)次。

  • 第 3 次仍失败 → 任务状态 failed + 通知。

  • 单任务可覆盖:codex_run {..., maxAttempts:5}

环境变量

变量

作用

默认

CODEX_MANAGER_STATE

状态文件路径

~/.codex-manager/state.json

CODEX_MANAGER_CODEX_PATH

显式指定 codex 可执行文件(否则自动解析)

自动解析

CODEX_MANAGER_CODEX_WINDOWS_HIDE

设为 1CREATE_NO_WINDOW 隐藏 codex 窗口(仅无控制台环境需要;正常终端下保持关闭,否则其子进程反而会各自弹黑窗)

关闭

CODEX_MANAGER_CHANNELS

设为 1 启用 claude/channel 推送(需以 --dangerously-load-development-channels server:codex-manager 启动 Claude Code)

关闭

CODEX_HOME

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)

Available Tools

8 tools
codex_adoptD
ParametersJSON Schema
NameRequiredDescriptionDefault
cwdNo
sessionIdYes

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

codex_discoverD
ParametersJSON Schema
NameRequiredDescriptionDefault
daysNo

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

codex_hookD
ParametersJSON Schema
NameRequiredDescriptionDefault
idNo
nameNo
levelNo
matchNo
actionYes
hookIdNo
notifyNo
patternNo

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

codex_listD
ParametersJSON Schema
NameRequiredDescriptionDefault
endedNo
statusNo

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

codex_messagesD
ParametersJSON Schema
NameRequiredDescriptionDefault
idYes
tailNo
levelNo
limitNo
sinceNo
typesNo
fromFileNo

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

codex_runD
ParametersJSON Schema
NameRequiredDescriptionDefault
cwdNo
nameNo
waitNo
colorNo
modelNo
configNo
imagesNo
promptYes
profileNo
sandboxNo
ephemeralNo
timeoutMsNo
maxAttemptsNo
approveForMeNo
outputSchemaNo
skipGitCheckNo
strictConfigNo
resumeSessionIdNo
ignoreUserConfigNo
outputLastMessageNo

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

codex_sendD
ParametersJSON Schema
NameRequiredDescriptionDefault
idYes
messageYes

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

codex_stopD
ParametersJSON Schema
NameRequiredDescriptionDefault
idYes
gracefulNo

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 8 tool updatesv0.1.0
    • First observedcodex_adopt
    • First observedcodex_discover
    • First observedcodex_hook
    • First observedcodex_list
    • First observedcodex_messages
    • First observedcodex_run
    • First observedcodex_send
    • First observedcodex_stop

TDQS

D1.7/5.0
Disambiguation2/5

Without descriptions, tools like codex_hook, codex_discover, and codex_adopt are highly ambiguous. codex_send, codex_messages, and codex_run could easily be confused for similar actions.

Naming Consistency4/5

All tools share the codex_ prefix and mostly use verb-like names (run, list, send, stop, adopt), though codex_messages is a noun, creating a minor deviation.

Tool Count5/5

Eight tools is a well-scoped count for a manager-style server, providing enough varied operations without being overwhelming.

Completeness2/5

The surface appears to cover run/stop/send/list but lacks evident update/delete or configuration operations. The absence of descriptions makes it impossible to confirm full lifecycle coverage.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables MCP clients to spawn and control Codex CLI and Claude Code sessions on the host machine, with session management and filesystem access.
    4
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Enables AI agents to interact programmatically with Claude Code CLI, managing sessions, streaming outputs, and handling permission requests.
    7
    14
    1
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables 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.
    -

Latest Blog Posts

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