Codex Claude Code MCP

Codex Claude Code MCP

Enables Codex to delegate long-running work to Claude Code via blocking MCP calls, with tools for model discovery, run, and resume without polling.

Category
访问服务器

README

Codex Claude Code MCP

A small MCP server for delegating long-running work from Codex to Claude Code without application-level polling.

It intentionally exposes only:

  • claude_code_models: list models available to the authenticated Claude Code CLI without running a model inference turn.
  • claude_code_run: start a persisted Claude Code session and block until the turn ends.
  • claude_code_resume: resume a returned session ID and block until the turn ends.

There is no poll, check, or get_status tool. Model discovery is a short read-only initialization request, not a background task. For background behavior, a Codex parent delegates the blocking run/resume call to a native Codex subagent and waits on Codex's own agent mailbox. See the Codex subagent workflow.

The repository also ships two global Codex skills:

  • claude-code-blocking-direct: the current agent makes one blocking MCP call and waits.
  • claude-code-blocking-background: the parent spawns a native Codex subagent to own the blocking call, continues useful work, and later receives the result through Codex's native agent mailbox.

One-command install

Install the MCP server, validate its build, update ~/.codex/config.toml, and install both skills globally:

curl -fsSL https://raw.githubusercontent.com/Happenmass/codex-claude-code-mcp/main/install.sh | bash

If you already cloned the repository:

./install.sh

The installer requires Node.js 20+, npm, Git, and an authenticated Claude Code CLI. It installs remote bootstrap checkouts under ~/.codex/tools/codex-claude-code-mcp by default and skills under ${CODEX_HOME:-$HOME/.codex}/skills. It creates config.toml.bak before replacing an existing claude-code-blocking MCP entry.

Restart Codex after installation so it discovers the new MCP server and skills.

Example prompts:

Use $claude-code-blocking-direct to ask Claude Code to review this change and wait for the result.
Use $claude-code-blocking-background to have Claude Code review the test strategy while you continue implementing.

How it works

Codex parent
  ├─ continues its own work
  └─ Codex subagent
       └─ one blocking MCP call
            └─ Claude Agent SDK query stream
                 └─ final result / failure / cancellation

MCP progress notifications are throttled (20 seconds by default). They describe activity but are not required for completion and do not require a model turn to poll.

Requirements

  • Node.js 20 or newer
  • A working Claude Code installation/authentication
  • Codex with MCP stdio support

Claude executable resolution

The bridge prefers the user's current system Claude Code installation so model routing and authentication match interactive Claude Code. Resolution order:

  1. Tool input pathToClaudeCodeExecutable
  2. Environment variable CLAUDE_CODE_MCP_PATH
  3. Command named by CLAUDE_CODE_MCP_COMMAND
  4. claude, then claude-internal, from PATH
  5. The Claude Agent SDK bundled binary

CLAUDE_CODE_MCP_PATH and CLAUDE_CODE_MCP_COMMAND are mutually exclusive. For a deterministic Codex installation, set:

[mcp_servers.claude-code-blocking.env]
CLAUDE_CODE_MCP_PATH = "/opt/homebrew/bin/claude"

Model discovery

Call claude_code_models before run/resume when the user asks what models are available or when a model identifier needs validation. It returns a stable normalized catalog containing:

  • the model value accepted by claude_code_run and claude_code_resume;
  • the resolved model when Claude Code reports one;
  • display name and description;
  • supported effort levels and adaptive-thinking, fast-mode, or auto-mode capabilities.

The tool starts Claude Code only long enough to read its authenticated initialization catalog, then closes the query. It does not submit a prompt to a model, create a persisted session, or incur an inference turn.

Manual build

npm install
npm run typecheck
npm test
npm run build
npm run smoke

The smoke test launches the built server through an MCP stdio client and verifies that exactly the model-discovery, run, and resume tools are advertised. It does not spend Claude API credits.

To verify authenticated model discovery through the real MCP stdio path:

npm run smoke:claude:models

This initializes and closes Claude Code without submitting a model prompt. It requires Claude Code authentication but does not create an inference turn. Keep it out of default CI environments that lack a Claude login.

Manual Codex configuration

Build the project, then add an MCP server entry to ~/.codex/config.toml:

[mcp_servers.claude-code-blocking]
command = "node"
args = ["/Users/guhappen/code/codex-claude-code-mcp/dist/index.js"]
tool_timeout_sec = 7200
enabled_tools = ["claude_code_models", "claude_code_run", "claude_code_resume"]

[mcp_servers.claude-code-blocking.env]
CLAUDE_CODE_MCP_PATH = "/absolute/path/to/claude"

Restart Codex after changing its MCP configuration. The long client-side tool timeout is intentional: the MCP request itself is the wait primitive.

To install the bundled skills manually:

cp -R skills/claude-code-blocking-direct "${CODEX_HOME:-$HOME/.codex}/skills/"
cp -R skills/claude-code-blocking-background "${CODEX_HOME:-$HOME/.codex}/skills/"

Tool policy

The default auto-approved tools are only Read, Grep, and Glob.

  • allowedTools: visible and automatically approved.
  • askTools: visible, but each use requires MCP elicitation approval.
  • disallowedTools: always denied and hidden; deny wins over the other lists.

Any tool outside those explicit lists is denied. For an implementation task you might use:

{
  "allowedTools": ["Read", "Grep", "Glob", "Edit", "Write"],
  "askTools": ["Bash"],
  "disallowedTools": ["WebFetch", "WebSearch"]
}

If the MCP client does not support elicitation, every askTools request is denied rather than silently approved.

Result and resume

Each call returns compact structured data including status, result, duration, turn count, cost, and the Claude sessionId. Pass that ID to claude_code_resume to continue the same context.

MCP request cancellation is forwarded to Claude Code. A server-side runtime limit defaults to two hours and may be set up to eight hours.

Phase 1 boundary

This design avoids repeated status requests while the Codex task remains active. MCP alone cannot complete a call after its client has disconnected or independently reopen a finished Codex task. Durable cross-turn wake-up requires a Codex-owned thread/automation callback and is outside phase 1.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选