# 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. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use Add this to your `.mcp.json` (Cursor, Windsurf, or Claude Desktop): ```json { "mcpServers": { "claude-code-mcp": { "command": "npx", "args": ["-y", "@steipete/claude-code-mcp@latest"] } } } ``` Prerequisites: 1. Node.js v20+ 2. Claude CLI installed with `--dangerously-skip-permissions` flag pre-accepted 3. Restart your AI tool after adding the config --- ## Intro 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. With 1,200+ GitHub stars and MIT license, 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. This is particularly useful when Claude Code outperforms other editors at complex multi-file operations. Best for: developers using Cursor or Windsurf who want Claude Code's file editing power as a sub-agent. Works with: Cursor, Windsurf, Claude Desktop. --- ## Claude Code as a Sub-Agent ### Why Use Claude Code MCP? When your primary AI coding tool (Cursor, Windsurf) hits its limits on complex operations, Claude Code MCP lets it call Claude Code as a specialist: - **Complex file editing** — Claude Code handles multi-file refactors better than most editors - **Git operations** — Stage, commit, push without switching tools - **Terminal execution** — Run build commands, tests, deployments - **Web search** — Access web information during coding sessions - **Context offloading** — Saves your primary tool's context window by delegating tasks ### How It Works 1. Your AI tool (e.g., Cursor) encounters a complex task 2. It calls the `claude_code` MCP tool with a prompt 3. Claude Code CLI executes the task with full file system access 4. Results are returned to your primary AI tool 5. No interactive permission prompts interrupt the flow ### Configuration Options #### Basic Setup (Recommended) ```json { "mcpServers": { "claude-code-mcp": { "command": "npx", "args": ["-y", "@steipete/claude-code-mcp@latest"] } } } ``` #### With Custom Claude CLI Binary ```json { "mcpServers": { "claude-code-mcp": { "command": "npx", "args": ["-y", "@steipete/claude-code-mcp@latest"], "env": { "CLAUDE_CLI_NAME": "claude-custom" } } } } ``` ### Config File Locations | Tool | Path | |------|------| | Cursor | `~/.cursor/mcp.json` | | Windsurf | `~/.codeium/windsurf/mcp_config.json` | | Claude Desktop (macOS) | `~/Library/Application Support/Claude/claude_desktop_config.json` | ### FAQ **Q: What is Claude Code MCP?** A: An MCP server that runs Claude Code CLI inside other AI tools like Cursor and Windsurf, enabling them to delegate complex tasks to Claude Code without interactive prompts. **Q: Is Claude Code MCP free?** A: Yes, it is open source under the MIT license. You need a Claude API subscription for the underlying Claude Code CLI usage. **Q: Does it work with Claude Code itself?** A: It's designed for tools other than Claude Code (Cursor, Windsurf, Claude Desktop) that want to use Claude Code as a sub-agent. --- ## Source & Thanks > Created by [steipete](https://github.com/steipete). Licensed under MIT. > > [claude-code-mcp](https://github.com/steipete/claude-code-mcp) — ⭐ 1,200+ Thanks to steipete for enabling seamless agent-in-agent workflows across AI coding tools. --- ## 快速使用 将以下 JSON 添加到你的 `.mcp.json`(Cursor、Windsurf 或 Claude Desktop): ```json { "mcpServers": { "claude-code-mcp": { "command": "npx", "args": ["-y", "@steipete/claude-code-mcp@latest"] } } } ``` 前提条件: 1. Node.js v20+ 2. 已安装 Claude CLI 并预先接受 `--dangerously-skip-permissions` 3. 添加配置后重启 AI 工具 --- ## 简介 Claude Code MCP 是一个 MCP 服务器,让你在 Cursor、Windsurf、Claude Desktop 等工具中以单次执行模式运行 Claude Code CLI。GitHub 1,200+ stars,MIT 开源。它把 Claude Code 变成"Agent 中的 Agent"——你的主力 AI 工具可以把复杂的文件编辑、Git 操作和终端命令委派给 Claude Code 执行,无需交互式权限确认。 --- ## 为什么用 Claude Code MCP? - **复杂文件编辑** — Claude Code 在多文件重构方面表现优于大多数编辑器 - **Git 操作** — 暂存、提交、推送无需切换工具 - **终端执行** — 运行构建、测试、部署命令 - **上下文卸载** — 将任务委派给 Claude Code,节省主工具的上下文窗口 ### 工作原理 1. 主力 AI 工具遇到复杂任务 2. 调用 `claude_code` MCP 工具并传入提示词 3. Claude Code CLI 以完整文件系统权限执行任务 4. 结果返回给主力 AI 工具 --- ## 来源与感谢 > Created by [steipete](https://github.com/steipete). Licensed under MIT. > > [claude-code-mcp](https://github.com/steipete/claude-code-mcp) — ⭐ 1,200+ --- Source: https://tokrepo.com/en/workflows/095f9359-33aa-11f1-9bc6-00163e2b0d79 Author: MCP Hub