An MCP server that wraps Claude Code CLI as a tool, enabling clients like Cursor/Windsurf/Claude Desktop to invoke Claude Code in one-shot mode with permissions bypassed automatically.
Overview#
Claude Code MCP Server is an MCP (Model Context Protocol) server that wraps Anthropic's official Claude Code CLI as an MCP tool (claude_code), enabling any MCP-compatible client to leverage Claude Code's full capabilities. It runs Claude Code with the --dangerously-skip-permissions flag, eliminating interactive permission confirmation interruptions.
Core Capabilities#
Exposed Tool: claude_code#
Parameters:
prompt(string, required): The complete prompt to send to Claude Codeoptions(object, optional):tools(array of strings, optional): Specific Claude tools to enable, e.g.,Bash,Read,Write
Key Features#
| Feature | Description |
|---|---|
| Auto Permission Bypass | Uses --dangerously-skip-permissions flag to execute all operations without interactive confirmation |
| Working Directory Parsing | Automatically extracts "Your work folder is..." instructions from prompt to set CWD |
| Extended Timeout | 30-minute default timeout, suitable for complex tasks |
| Custom CLI Path | Supports specifying Claude CLI binary name or absolute path via environment variables |
| Debug Mode | Enable verbose logging via MCP_CLAUDE_DEBUG environment variable |
Problems Solved#
- Poor File Editing Quality: Claude/Windsurf/Cursor often make mistakes when editing files; Claude Code is faster and more accurate
- Context Waste: Complex operations can be batched through Claude Code, reducing main agent compaction frequency
- Cost Optimization: Basic tasks like file operations and Git don't consume expensive model tokens from main conversation
- Capability Boundary: Claude Code can perform system-level operations that Cursor/Windsurf cannot
Use Cases#
- Code generation, analysis, and refactoring
- File system operations (create, read, edit, manage)
- Version control (Git)
- Terminal command execution
- Web search and summarization
- Complex multi-step workflows (releases, changelog updates)
- Fixing syntax error files
- GitHub interactions (create PRs, check CI status)
Environment Variables#
| Variable | Default | Description |
|---|---|---|
CLAUDE_CLI_NAME | claude | Override Claude CLI binary name |
CLAUDE_CLI_PATH | Auto-detected | Absolute path to Claude CLI executable |
MCP_CLAUDE_DEBUG | false | Enable debug logging |
Quick Start#
Prerequisites#
- Node.js v20 or higher
- Claude CLI installed locally
Install Claude CLI#
npm install -g @anthropic-ai/claude-code
claude --dangerously-skip-permissions
⚠️ Important: You must manually run
claude --dangerously-skip-permissionsonce to accept the usage terms
MCP Client Configuration#
Add to mcp.json or mcp_config.json:
{
"mcpServers": {
"claude-code-mcp": {
"command": "npx",
"args": ["-y", "@steipete/claude-code-mcp@latest"]
}
}
}
Configuration File Paths#
| Client | macOS | Windows | Linux |
|---|---|---|---|
| Cursor | ~/.cursor/mcp.json | %APPDATA%\Cursor\mcp.json | ~/.config/cursor/mcp.json |
| Windsurf | ~/.codeium/windsurf/mcp_config.json | %APPDATA%\Codeium\windsurf\mcp_config.json | ~/.config/.codeium/windsurf/mcp_config.json |
Example Usage#
{
"toolName": "claude_code:claude_code",
"arguments": {
"prompt": "Your work folder is /Users/dev/myproject\n\nRefactor the function foo in main.py to be async.",
"options": {
"tools": ["Bash", "Read", "Write"]
}
}
}
Prompt Examples#
Code Generation:
"Generate a Python script to parse CSV data and output JSON."
File Operations:
"Your work folder is /Users/steipete/my_project
Create a new file named 'config.yml' in the 'app/settings' directory..."
Git Operations:
"Your work folder is /Users/steipete/my_project
1. Stage 'src/main.java'.
2. Commit with message 'feat: Implement user authentication'.
3. Push to 'develop' branch."