claude-code-mcp
by KunihiroS
claude-code-mcp is an MCP server for Claude Code that allows you to call Claude Code commands locally. It receives JSON requests, encodes input, generates commands, and returns execution results in JSON format, improving stability and flexibility.
Last updated: N/A
What is claude-code-mcp?
claude-code-mcp is a server that acts as a bridge between an MCP Host and the Claude Code CLI, enabling the execution of Claude Code commands through a standardized interface. It handles request reception, input processing (Base64 encoding), command generation, command execution, and result return.
How to use claude-code-mcp?
The server can be used via npx, global installation, or local installation. Configuration involves setting the CLAUDE_BIN
environment variable to point to the Claude CLI executable, either through MCP Host settings, a .env
file, or a global .claude-code-mcp.env
file. Once configured, the server listens for JSON requests and executes the corresponding Claude Code commands.
Key features of claude-code-mcp
Receives JSON format tool requests
Base64 encodes natural language text for stability
Generates commands based on tool name and input
Executes commands using Node.js's
child_process.spawn
Returns execution results in JSON format
Use cases of claude-code-mcp
Integrating Claude Code functionality into MCP Hosts
Calling Claude Code from Claude Desktop (unconfirmed)
Automating code explanation, review, fixing, editing, and testing
Executing custom queries with Claude Code
Extending the capabilities of less capable LLMs by leveraging Claude's power
FAQ from claude-code-mcp
What is the purpose of Base64 encoding?
What is the purpose of Base64 encoding?
Base64 encoding is used to handle special characters (newlines, quotation marks, etc.) in natural language text, ensuring stability and preventing issues during command execution.
What environment variables are required?
What environment variables are required?
The CLAUDE_BIN
environment variable is required and specifies the path to the Claude CLI executable.
How do I configure the server?
How do I configure the server?
You can configure the server by setting environment variables through MCP Host settings, a .env
file, or a global .claude-code-mcp.env
file.
What tools are available?
What tools are available?
The server provides tools such as explain_code
, review_code
, fix_code
, edit_code
, test_code
, simulate_command
, and your_own_query
.
Where are the logs stored?
Where are the logs stored?
The log file (claude-code-mcp.log
) is created in the project root, the user's home directory (~/.claude-code-mcp.log
), or /tmp/claude-code-mcp.log
.