local-only server
The server can only run on the client’s local machine because it depends on local resources.
claude-code-mcp Project
Update
Now this MCP Server works without local install by npx!!
Overview
The claude-code-mcp project is an MCP server for Claude Code.
It calls the locally installed Claude Code command and provides the following tools: explain_code
, review_code
, fix_code
, edit_code
, test_code
, simulate_command
, and your_own_query
. The server is implemented using Node.js and the MCP SDK, receiving JSON format requests from clients via stdio. Internally, it adopts Base64 encoding to smoothly process special characters (newlines, quotation marks, etc.) in natural language text, resulting in improved stability and flexibility. Its main roles are receiving requests, encoding input, generating and executing commands, and returning execution results in JSON format.
This project has been confirmed to work in Claude Code CLI environments (Ubuntu/WSL2, etc.).
💡 MCP Host with less capable LLM, can tame and make use of Claude power💪! With claude-code-mcp, you can also call Claude Code from Claude Desktop!! 😇😜😎 (unconfirmed)
Functions
The main roles of the server are:
- Request Reception: Receive JSON format tool requests from clients (e.g.
code
,context
,focus_areas
, etc.). - Input Processing: Internally Base64 encode the received natural language text.
- Tool Selection and Command Generation: Based on the tool name in the request, assemble a command string for the query using a fixed template or free format (
your_own_query
). - Command Execution: Use Node.js's
child_process.spawn
to execute the assembled command and get the result from standard output. - Result Return: Return the execution result to the client in JSON format.
Getting Started
Prerequisites
- Node.js (>= v18 recommended, tested with v22.14.0)
- npm (or yarn)
- Claude Code command installed and auth completed. https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview
Installation & Usage
There are several ways to use claude-code-mcp
:
1. Using npx (Recommended for quick use)
You can run the server directly without installation using npx
:
2. Global Installation
Install the package globally:
Then, you can run it as a command:
3. Local Installation (For development)
Clone the repository and install dependencies:
You can then run the built script directly:
Configuration
Environment Variables:
Regardless of the installation method, you need to configure the environment variables. Create one of the following files:
- Using MCP Host Settings (Recommended for
npx
): Configure environment variables directly within your MCP Host's settings (see "MCP Host Configuration" below). This is the easiest way when usingnpx
. - Using a
.env
file: Create a.env
file in the directory where you run thenpx @kunihiros/claude-code-mcp
command. - Using a global config file: Create a
.claude-code-mcp.env
file in your home directory (~/.claude-code-mcp.env
).
If using a file (.env
or ~/.claude-code-mcp.env
), add the following content, adjusting the CLAUDE_BIN
path:
MCP Host Configuration (Recommended for npx
):
Add the following to your MCP Host application settings (e.g., Claude Desktop settings). This method allows you to set environment variables directly.
(Restarting the host application might be required.)
Alternative MCP Host Configuration (Global Install / Local Dev):
If you installed the package globally or are running it locally from the cloned repository, and the claude-code-mcp
command is in your system's PATH, you can use:
In this case, you must configure environment variables using a .env
file or the global ~/.claude-code-mcp.env
file as described above.
Environment Variables Details
This server uses the following environment variables (set via MCP Host env
settings, .env
, or ~/.claude-code-mcp.env
):
CLAUDE_BIN
: Specifies the path to the Claude CLI executable. (Required) Example:/home/linuxbrew/.linuxbrew/bin/claude
orC:\Users\YourUser\AppData\Local\bin\claude.exe
LOG_LEVEL
: Specifies the log level. (Optional, defaults toinfo
). Possible values:debug
,info
,warn
,error
.
Available Tools
The claude-code-mcp
server provides the following tools:
explain_code
: Provides a detailed explanation of the given code.review_code
: Reviews the given code.fix_code
: Fixes bugs or issues in the given code.edit_code
: Edits the given code based on instructions.test_code
: Generates tests for the given code.simulate_command
: Simulates the execution of a given command.your_own_query
: Sends a custom query with context.
Note
- Log file (
claude-code-mcp.log
) location:- Attempts to create in the project root first.
- Falls back to the user's home directory (
~/.claude-code-mcp.log
). - Finally falls back to
/tmp/claude-code-mcp.log
.
- Log rotation is not implemented yet (be careful with log file size).
- Primarily tested with Claude CLI on Ubuntu/WSL2.
License
This project is licensed under the MIT License - see below for details.
Disclaimer
This software is provided for educational and research purposes only. This project is not officially associated with or endorsed by Anthropic. Claude is a trademark of Anthropic.
The project uses the Claude CLI as a dependency, but is an independent, community-driven effort. Users should ensure they comply with Anthropic's terms of service when using this project.
The maintainers of this project are not responsible for any misuse of the software or violations of the terms of service of any third-party APIs or services.
This server cannot be installed
This project aims to build a Claude Code MCP server and implement its associated tools (explain_code, review_code, fix_code, edit_code, test_code, simulate_command, your_own_query). The server is implemented using Node.js and the MCP SDK. It receives tool requests from clients via Stdio, dynamically
- Update
- Overview
- Functions
- Getting Started
- Environment Variables Details
- Available Tools
- Note
- License
- Disclaimer