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
- Your AI tool (e.g., Cursor) encounters a complex task
- It calls the
claude_codeMCP tool with a prompt - Claude Code CLI executes the task with full file system access
- Results are returned to your primary AI tool
- No interactive permission prompts interrupt the flow
Configuration Options
Basic Setup (Recommended)
{
"mcpServers": {
"claude-code-mcp": {
"command": "npx",
"args": ["-y", "@steipete/claude-code-mcp@latest"]
}
}
}With Custom Claude CLI Binary
{
"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.