MCP ConfigsApr 9, 2026·3 min read

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.

TL;DR
MCP server that lets Cursor, Windsurf, and Claude Desktop delegate complex tasks to Claude Code CLI in one-shot mode.
§01

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.

§02

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.

§03

How to use

  1. Install Node.js v20+ and Claude CLI
  2. Accept the --dangerously-skip-permissions flag on Claude CLI
  3. Add the MCP server config to your .mcp.json
  4. Restart your AI tool
§04

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'
§05

Related on TokRepo

§06

Common pitfalls

  • The --dangerously-skip-permissions flag 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

Why would I use Claude Code MCP instead of Claude Code directly?+

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.

Does it work with Claude Desktop?+

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.

Is there a token or cost overhead?+

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.

Can multiple AI tools share the same MCP server?+

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.

What permissions does Claude Code have in this mode?+

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)
🙏

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.

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.