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.
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
Frequently Asked Questions
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.
Citations (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
Related on TokRepo
Source & Thanks
Created by steipete. Licensed under MIT.
claude-code-mcp — ⭐ 1,200+
Thanks to steipete for enabling seamless agent-in-agent workflows across AI coding tools.