
让Claude Code作为MCP服务器,工具最少。
概览
MCP 服务器将 Claude Code(Claude Agent SDK)包装为工具,使任何 MCP 客户端都能调用 Claude Code 进行自主编码任务。设计为本地使用——MCP 服务器和客户端预计在同一台机器上运行。它特别适合偏好异步轮询和显式权限决策的 OpenCode/Codex 风格客户端。 灵感来源于Codex MCP的设计理念——最小工具,最大能力。 该包是:它旨在作为MCP服务器进程(npx @leo000001/claude-code-mcp)运行,而非稳定的程序库API。 并非所有文档对MCP连接的编码代理都能看到。 - MCP工具名称、工具描述、输入字段描述以及客户端显式读取的MCP资源。- 该 README.md、docs/DESIGN.md、AGENTS.md 及其他仓库文件,除非客户端或编排器将该内容复制到模型上下文中。
概述(AI 翻译)
MCP 服务器将 Claude Code(Claude Agent SDK)包装为工具,使任何 MCP 客户端都能调用 Claude Code 进行自主编码任务。设计为本地使用——MCP 服务器和客户端预计在同一台机器上运行。它特别适合偏好异步轮询和显式权限决策的 OpenCode/Codex 风格客户端。
灵感来源于Codex MCP的设计理念——最小工具,最大能力。
该包是 CLI 优先:它旨在作为 MCP 服务器进程([npx @leo000001/claude-code-mcp])运行,而非稳定的程序库 API。
能见度边界
并非所有文档对MCP连接的编码代理都能看到。
- 通常对代理可见: MCP 工具名称、工具描述、输入字段描述以及客户端显式读取的 MCP 资源。
- **除非客户端或编排器将这些内容复制到模型上下文中,否则不可假设这些
README.md]、docs/DESIGN.md]及其他仓库文件可见。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
claude-code-mcp
MCP server that wraps Claude Code (Claude Agent SDK) as tools, enabling any MCP client to invoke Claude Code for autonomous coding tasks. Designed for local use — the MCP server and client are expected to run on the same machine. It works especially well with OpenCode/Codex-style clients that prefer async polling and explicit permission decisions.
Inspired by the Codex MCP design philosophy — minimum tools, maximum capability.
This package is CLI-first: it is intended to run as an MCP server process (npx @leo000001/claude-code-mcp), not as a stable programmatic library API.
Visibility Boundary
Not every piece of documentation below is visible to an MCP-connected coding agent.
- Usually visible to the agent: MCP tool names, tool descriptions, input field descriptions, and MCP resources that the client explicitly reads.
- Not safe to assume visible: this
README.md,docs/DESIGN.md,AGENTS.md, and other repository files unless the client or orchestrator copies that content into the model context. - Authoring rule: keep protocol-critical calling rules in tool descriptions and MCP resources first; mirror them in README for humans, but do not rely on README alone.
In practice, the most important runtime rules are duplicated in the claude_code* tool descriptions and the quickstart / gotchas / compat-report resources so async polling clients can succeed even when they never read this file.
Features
- 4 tools covering the full agent lifecycle: start, continue, check/poll, manage
- Read-only MCP resources for server info, internal tool catalog, and compatibility diagnostics
- Session management with resume and fork support
- Local settings loaded by default — automatically reads
~/.claude/settings.json,.claude/settings.json,.claude/settings.local.json, andCLAUDE.mdso the agent behaves like your local Claude Code CLI - Async permissions — allow/deny lists + explicit approvals via
claude_code_check - Custom subagents — define specialized agents per session
- Cost tracking — per-session turn and cost accounting
- Session cancellation via AbortController
- Auto-cleanup — 30-minute idle timeout for expired sessions
- Security — callers control tool permissions via allow/deny lists + explicit permission decisions
See CHANGELOG.md for release history.
Prerequisites
- Node.js >= 18 is required.
安装
npx -y @leo000001/claude-code-mcp配置
{
"mcpServers": {
"claude-code": {
"command": "npx",
"args": ["-y", "@leo000001/claude-code-mcp"]
}
}
}