Skip to content

Codex → Claude 的 MCP 接口,用 Claude Code 做 review / plan / 架构分析。Expose Claude Code as an MCP server so Codex can offload review, planning, and architecture analysis.

License

Notifications You must be signed in to change notification settings

snakeying/Claudemcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔗 ClaudeMCP

让 Codex 与 Claude Code 无缝协作

将 Claude Code CLI 封装为 MCP 协议接口
让 Codex 能够调用 Claude 进行代码审查、架构规划


简体中文 | English

🤔 这是什么?

你可能已经用过 CodexMCPGeminiMCP — 它们让 Claude Code 能够调用 Codex/Gemini。

ClaudeMCP 是反过来的版本。

项目 方向
CodexMCP Claude → Codex
GeminiMCP Claude → Gemini
ClaudeMCP Codex → Claude

当你在 Codex 中工作时,可以调用 Claude Code 来:

  • 📝 审查代码改动
  • 🏗️ 规划实现方案(Plan 模式)
  • 🔍 分析架构设计

✨ 核心特性

特性 说明
🔄 会话持久化 通过 SESSION_ID 支持多轮对话
🛡️ 权限控制 支持 permission_mode 配置(plan/default 等)
🎯 工具限制 通过 allowed_tools 控制 Claude 可用的工具
🤖 模型选择 支持 sonnet/opus/haiku
⏱️ 轮次限制 max_turns 防止无限循环

🚀 快速开始

1️⃣ 前置要求

# 安装 uv (如果还没有)
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

2️⃣ 配置 MCP

在 Codex 的 MCP 配置中添加:

{
  "mcpServers": {
    "claude": {
      "command": "uvx",
      "args": ["--from", "/path/to/claudemcp", "claudemcp"]
    }
  }
}

📖 工具参数

参数 类型 必填 默认值 说明
PROMPT str - 发送给 Claude 的任务指令
cd Path - 工作目录
SESSION_ID str "" 会话 ID(多轮对话)
model str "" 模型(sonnet/opus/haiku)
permission_mode str "" 权限模式(plan/default/bypassPermissions)
allowed_tools str "" 允许的工具(逗号分隔)
max_turns int 0 最大轮次(0=无限制)
return_all_messages bool False 返回完整消息记录

返回值

// 成功
{
  "success": true,
  "SESSION_ID": "550e8400-e29b-41d4-a716-446655440000",
  "agent_messages": "Claude 的回复..."
}

// 失败
{
  "success": false,
  "error": "错误信息"
}

🎯 使用场景

代码审查

使用 claude 工具审查当前目录的代码改动,设置 allowed_tools="Read,Grep,Glob"

Plan 模式

调用 claude 工具,设置 permission_mode="plan",分析如何重构 auth 模块

多轮对话

继续上次的会话,SESSION_ID="之前返回的ID",追问实现细节

❓ FAQ

Q: 与直接用 Claude Code 有什么区别?

ClaudeMCP 让 Codex 能够程序化调用 Claude Code,支持会话管理和结构化返回。适合在 Codex 工作流中集成 Claude 的能力。

Q: 会话会冲突吗?

不会。每个会话使用独立的 SESSION_ID,完全隔离。

Q: 如何限制 Claude 的权限?

两种方式:

  • permission_mode="plan" — Claude 只能规划,不能执行
  • allowed_tools="Read,Grep,Glob" — 只允许只读工具

📜 许可证

License: MIT

Copyright (c) 2025 Ying

About

Codex → Claude 的 MCP 接口,用 Claude Code 做 review / plan / 架构分析。Expose Claude Code as an MCP server so Codex can offload review, planning, and architecture analysis.

Topics

Resources

License

Stars

Watchers

Forks

Languages