Claude Code MCP — Run Claude as Agent-in-Agent
MCP server that runs Claude Code CLI in one-shot mode inside other AI tools. Enables Cursor, Windsurf, and Claude Desktop to delegate complex tasks to Claude Code. 1.2K+ stars, MIT.
这个资产会安全暂存
这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。
npx -y tokrepo@latest install 095f9359-33aa-11f1-9bc6-00163e2b0d79 --target codex先暂存文件;激活前需要读取暂存 README 和安装计划。
What it is
Claude Code MCP is an MCP server that lets you run Claude Code CLI in one-shot mode inside other AI tools like Cursor, Windsurf, and Claude Desktop. It turns Claude Code into an agent inside your agent -- your primary AI tool can delegate complex file editing, git operations, and terminal commands to Claude Code without interactive permission prompts.
It is designed for developers using Cursor or Windsurf who want Claude Code's file editing and codebase understanding capabilities as a sub-agent for complex multi-file operations.
How it saves time or tokens
When your primary AI tool hits its limits on complex operations (multi-file refactors, large git diffs, cross-codebase analysis), it can hand off the task to Claude Code rather than attempting it with degraded quality. The one-shot mode avoids the overhead of interactive sessions, and results flow back to your primary tool seamlessly.
How to use
- Install Node.js v20+ and Claude CLI
- Accept the
--dangerously-skip-permissionsflag on Claude CLI - Add the MCP server config to your
.mcp.json - Restart your AI tool
Example
{
"mcpServers": {
"claude-code-mcp": {
"command": "npx",
"args": ["-y", "@steipete/claude-code-mcp@latest"]
}
}
}
Once configured, your primary AI tool can delegate tasks:
'Use Claude Code to refactor all API handlers to use the new error format'
'Ask Claude Code to analyze the git history and summarize recent changes'
'Have Claude Code fix the failing test suite in the backend module'
Related on TokRepo
- AI Tools for Coding -- Developer productivity tools powered by AI
- AI Tools for Automation -- Automate development workflows
Common pitfalls
- The
--dangerously-skip-permissionsflag is required, which means Claude Code runs without confirmation prompts -- review the security implications before enabling - Node.js v20+ is a hard requirement; older versions cause silent failures
- Each invocation starts a fresh Claude Code session, so context from previous calls is not retained between delegations
常见问题
Claude Code MCP is useful when your primary editor is Cursor or Windsurf but you want to leverage Claude Code's strengths for specific tasks. Your primary tool stays in control and delegates only when needed, keeping your workflow in one interface.
Yes. Claude Desktop supports MCP servers, so you can add the claude-code-mcp config to Claude Desktop's MCP settings. This lets Claude Desktop delegate complex file operations to Claude Code CLI.
Each delegation creates a separate Claude Code session that consumes tokens independently. The one-shot mode is efficient, but complex tasks can use significant tokens. Monitor usage through your Anthropic dashboard.
The MCP server runs per-client, so each AI tool launches its own instance. They do not share state or sessions. Each tool gets its own independent Claude Code sub-agent.
With --dangerously-skip-permissions, Claude Code can read and write files, execute shell commands, and perform git operations without asking for confirmation. This is necessary for one-shot mode but means you should only use it in trusted environments.
引用来源 (3)
- Claude Code MCP GitHub— Claude Code MCP runs Claude Code CLI in one-shot mode inside other AI tools
- MCP Specification— Model Context Protocol specification for AI tool integration
- Anthropic Docs— Claude Code CLI documentation
来源与感谢
Created by steipete. Licensed under MIT.
claude-code-mcp — ⭐ 1,200+
讨论
相关资产
Serena — Semantic Code Agent via MCP
Serena is a coding agent MCP server with semantic code retrieval and editing. 22K+ stars. Understands classes, functions, symbols for precise context-aware edits. MIT.
pentest-ai — Offensive Security MCP for Claude Code
pentest-ai is a Python CLI and MCP server that lets Claude Code run verified probes, chain attack paths, and export reports for authorized testing.
Linear MCP — Project Management for Claude Code & Cursor
Linear's official MCP lets Claude Code, Cursor, Codex CLI manage Linear issues, projects, cycles. Search by status, create issues from chat, link PRs.
OpenRouter MCP — One Server for 300+ LLMs in Claude Code
OpenRouter MCP exposes all 300+ OpenRouter models to Claude Code, Cursor, Codex CLI as one MCP server. Switch models per task, BYO routing, no extra SDKs.