Claude Code MCP Server
An MCP (Model Context Protocol) server that allows running Claude Code in one-shot mode with permissions bypassed automatically.

Overview

Did you notice that Cursor often struggles to apply smaller edits via edit_file, especially when linting? And then it tries multiple times till it eventually works? Yeah... no more. It LOVES magic_file.
This MCP server provides two tools that can be used by LLMs to interact with Claude Code. When integrated with Claude Desktop or other MCP clients, it allows LLMs to:
- Run Claude Code with all permissions bypassed (using
--dangerously-skip-permissions) - Execute Claude Code with any prompt without permission interruptions
- Access file editing capabilities directly
- Enable specific tools by default
Prerequisites
- Node.js v16 or later
- TypeScript (for development)
- Claude CLI installed and working. Ensure Claude CLI is installed and accessible, preferably by running
/doctor. This installs/updates the CLI to~/.claude/local/claude, which this server checks by default.
Installation
- Clone or download this repository:
git clone https://github.com/yourusername/claude-mcp-server.git
cd claude-mcp-server
- Install dependencies (this will also install
tsxfor direct TypeScript execution):
npm install
- Make the start script executable:
chmod +x start.sh
Connecting to Cursor/Windsurf/Visual Studio Code
macOS
Locate the MCP configuration file:
~/.cursor/mcp.jsonCreate this file if it doesn't exist.
Add the server configuration to the file:
{
"mcpServers": {
"claude_code": {
"type": "stdio",
"command": "/absolute/path/to/claude-mcp-server/start.sh",
"args": []
}
}
}
Make sure to replace /absolute/path/to/claude-mcp-server with the actual path to where you installed this server.
Windows
Locate the MCP configuration file:
%APPDATA%\cursor\mcp.jsonCreate this file if it doesn't exist.
Add the server configuration to the file, making sure to use Windows path format:
{
"mcpServers": {
"claude_code": {
"type": "stdio",
"command": "C:\\path\\to\\claude-mcp-server\\start.bat",
"args": []
}
}
}
For Windows, you should use the batch file (start.bat) instead of the shell script.
Linux
Locate the MCP configuration file:
~/.config/cursor/mcp.jsonCreate this file if it doesn't exist.
Add the server configuration to the file:
{
"mcpServers": {
"claude_code": {
"type": "stdio",
"command": "/absolute/path/to/claude-mcp-server/start.sh",
"args": []
}
}
}
- After updating the configuration, restart your IDE to load the MCP server.
Environment Variables
You can customize the server behavior with the following environment variables (edit them in start.sh or start.bat):
CLAUDE_CLI_PATH: Optional. Set a custom absolute path to the Claude CLI executable. If set and the path points to an existing file, this path will be used directly.MCP_CLAUDE_DEBUG: Set totrueto enable verbose debug logging from the server to stderr (e.g.,MCP_CLAUDE_DEBUG=true ./start.sh).
Claude CLI Discovery Order:
- The path specified by the
CLAUDE_CLI_PATHenvironment variable (if set and valid). - The default installation path for Unix-like systems:
~/.claude/local/claude(where~is the user's home directory). For Windows users, this automatic check may not apply; relying onCLAUDE_CLI_PATHor ensuringclaudeis in the system PATH is recommended. - Defaults to simply
claude, relying on the system's PATH for resolution (a warning will be logged if this fallback is used).
Connecting to VSCode Claude
To use this MCP server with Claude in VSCode:
Install the Claude extension in VSCode
Create or edit the MCP settings file:
~/.vscode/extensions/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonAdd the server configuration:
{
"mcpServers": {
"claude_code": {
"command": "/absolute/path/to/claude-mcp-server/start.sh",
"args": [],
"disabled": false
}
}
}
Usage
Once installed and connected to an MCP client, you can invoke the tools using the following formats:
Claude Code Tool (renamed to code)
{
"tool_name": "code",
"params": {
"prompt": "Your prompt to Claude Code here",
"options": {
"tools": ["Bash", "Read", "Write"]
}
}
}
If no tools are specified, the server enables common tools by default.
Claude File Edit Tool (renamed to magic_file)
{
"tool_name": "magic_file",
"params": {
"file_path": "/path/to/your/file.js",
"instruction": "Refactor the processData function to use async/await instead of promises."
}
}
Tool Descriptions
The server provides two tools:
Tool name:
code- Description: "Executes a given prompt directly with the Claude Code CLI, bypassing all permission checks (
--dangerously-skip-permissions). Ideal for a wide range of tasks including: complex code generation, analysis, and refactoring; performing web searches and summarizing content; running arbitrary terminal commands (e.g.,open .to open Finder,open -a Calculatorto open apps, oropen https://example.comto open a URL in a web browser). For example, you could open a GitHub PR page once all tests are green. Handles general tasks requiring the Claude CLI's broad capabilities without interactive prompts.options.toolscan be used to specify internal Claude tools (e.g.,Bash,Read,Write); common tools are enabled by default if this is omitted." - Parameters:
prompt(required): The prompt to send to Claude Codeoptions.tools(optional): Array of specific tools to enable
- Implementation: Uses
claude --dangerously-skip-permissions(invoked viachild_process.spawn) to bypass all permission checks. The server locates the Claude CLI by first checking theCLAUDE_CLI_PATHenvironment variable, then looking in~/.claude/local/claude, and finally falling back toclaudein the system PATH.
- Description: "Executes a given prompt directly with the Claude Code CLI, bypassing all permission checks (
Tool name:
magic_file- Description: "Edits a specified file based on natural language instructions, leveraging the Claude Code CLI with all editing permissions bypassed (
--dangerously-skip-permissions). Best for complex or semantic file modifications where describing the desired change in plain language is more effective than precise line-by-line edits. Requires an absolutefile_pathand a descriptiveinstruction. Also a great alternative if a general-purposeedit_filetool is struggling with complex edits or specific file types. Example instruction: 'Refactor the processData function to use async/await instead of promises.'" - Parameters:
file_path(required): The absolute path to the file to editinstruction(required): Free text description of the edits to make to the file
- Implementation: Uses
claude --dangerously-skip-permissions(invoked viachild_process.spawn) with Edit tools enabled. The server locates the Claude CLI by first checking theCLAUDE_CLI_PATHenvironment variable, then looking in~/.claude/local/claude, and finally falling back toclaudein the system PATH.
- Description: "Edits a specified file based on natural language instructions, leveraging the Claude Code CLI with all editing permissions bypassed (
Troubleshooting
- Tool not showing up: Check the Claude logs for errors when starting the MCP server. Ensure
start.shorstart.batis executable andtsxis installed and runnable (usually vianpx). - Command not found / "Error: spawn claude ENOENT" / "[Warning] Claude CLI not found... Falling back to "claude" in PATH...": This means the server could not find the
claudeexecutable via theCLAUDE_CLI_PATHenvironment variable (if set), at the default Unix-like location (~/.claude/local/claude), or in the system PATH (if it fell back to just'claude').- Ensure the Claude CLI is installed correctly. For Unix-like systems, this is often at
~/.claude/local/claude(verify by running/doctorin a Claude context). For Windows, ensure it's in your system PATH or setCLAUDE_CLI_PATH. - Explicitly set the
CLAUDE_CLI_PATHenvironment variable instart.shorstart.batto the correct absolute path of yourclaudeexecutable.
- Ensure the Claude CLI is installed correctly. For Unix-like systems, this is often at
- Permission errors: Ensure the
start.shscript is executable and that Node.js has permission to executetsxand the Claude CLI (whether found viaCLAUDE_CLI_PATH, the default path, or the system PATH).
License
MIT
Server test complete.