claude-code-mcp
The claude-code-mcp server provides tools for interacting with the locally installed Claude Code CLI to analyze, modify, and test code. You can:
Explain Code: Provides detailed explanations of code snippets
Review Code: Reviews code, optionally focusing on specific areas
Fix Code: Fixes bugs or issues based on provided descriptions
Edit Code: Modifies code according to specific instructions
Generate Tests: Creates tests for code, optionally specifying a framework
Simulate Command: Simulates execution of a specified command with optional input
Custom Query: Sends personalized requests with additional context
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@claude-code-mcp explain this Python function that calculates Fibonacci numbers"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
claude-code-mcp Project
β οΈ Maintenance Ended (2026-08-25)
This project is no longer maintained. No further updates, including security fixes, will be made. The repository has been archived and the npm package has been marked as deprecated. Existing installations will continue to work, but use at your own risk β dependency vulnerabilities reported after this date will not be addressed.
If you need equivalent functionality, please fork the repository or look for actively maintained alternatives.
Related MCP server: MCP Practice
[0.1.9] - 2026-03-06
Security Update
Add pnpm overrides to pin transitive dependencies to patched versions.
hono^4.12.4 (fixes serveStatic path traversal, SSE CRLF injection, Cookie attribute injection, basicAuth/bearerAuth timing)@hono/node-server>=1.19.10 (fixes authorization bypass via encoded slashes)ajv>=8.18.0 (fixes ReDoS with$dataoption)qs>=6.14.2 (fixes DoS via arrayLimit bypass)
[0.1.8] - 2026-02-05
Security Update
Update @modelcontextprotocol/sdk version.
Add zod dependency to satisfy peer dependency requirements.
Bump TypeScript version for compatibility with updated dependencies.
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.spawnto 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:
npx @kunihiros/claude-code-mcp2. Global Installation
Install the package globally:
npm install -g claude-code-mcpThen, you can run it as a command:
claude-code-mcp3. Local Installation (For development)
Clone the repository and install dependencies:
git clone https://github.com/KunihiroS/claude-code-mcp.git
cd claude-code-mcp/claude-code-server
npm install
npm run buildYou can then run the built script directly:
node build/index.jsConfiguration
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
.envfile: Create a.envfile in the directory where you run thenpx @kunihiros/claude-code-mcpcommand.Using a global config file: Create a
.claude-code-mcp.envfile 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:
# .env or ~/.claude-code-mcp.env
CLAUDE_BIN=/path/to/your/claude/executable # REQUIRED: Set the full path to your Claude CLI
LOG_LEVEL=info # Optional: Set log level (e.g., debug, info, warn, error)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.
"claude-code-server": {
"command": "npx",
"args": [
"-y",
"@kunihiros/claude-code-mcp"
],
"env": {
"CLAUDE_BIN": "/path/to/your/claude/executable", // REQUIRED: Set the absolute path
"LOG_LEVEL": "info" // Optional: Set log level
},
"disabled": false
}(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:
"claude-code-server": {
"command": "claude-code-mcp",
"disabled": false
}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/claudeorC:\Users\YourUser\AppData\Local\bin\claude.exeLOG_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.
MIT License
Copyright (c) 2024 KunihiroS
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.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.
Available Tools
7 toolsedit_codeC
Edits the given code based on instructions.
Inputs: code (required), instructions (required).
explain_codeC
Provides detailed explanation of the given code.
Inputs: code (required), context.
fix_codeC
Fixes bugs or issues in the given code.
Inputs: code (required), issue_description (required).
review_codeD
Reviews the given code.
Inputs: code (required), focus_areas.
simulate_commandC
Simulates the execution of a given command.
Inputs: command (required), input.
test_codeC
Generates tests for the given code.
Inputs: code (required), test_framework.
your_own_queryC
Sends a custom query with context.
Inputs: query (required), context.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 7 tools
There is significant overlap between edit_code, fix_code, and review_code, as all involve modifying or analyzing code for improvements, which could confuse an agent about which to use for specific tasks. However, explain_code, simulate_command, test_code, and your_own_query have more distinct purposes, providing some clarity.
Most tools follow a consistent verb_noun pattern (e.g., edit_code, explain_code, fix_code), which is predictable and readable. The only deviation is your_own_query, which uses a different style but doesn't severely disrupt the overall consistency.
With 7 tools, the count is well-scoped for a code-focused server, falling within the typical 3-15 range. Each tool appears to serve a specific purpose in code development and analysis, making the set appropriately sized for the domain.
The tool set covers key aspects of code interaction such as editing, explaining, fixing, reviewing, simulating, testing, and custom queries, which aligns well with a code assistant domain. Minor gaps might include operations like code generation or version control integration, but core workflows are adequately supported.
Related MCP Connectors
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Nifty's MCP server β exposes tasks, projects, messages, and files as tools for AI agents.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that implements Claude Code-like functionality, allowing the AI to analyze codebases, modify files, execute commands, and manage projects through direct file system interactions.15306MIT
- AlicenseCqualityDmaintenanceA Model Context Protocol (MCP) server that demonstrates how to build and implement custom tools for Claude using the mcp-framework.10ISC
- AlicenseNot gradedqualityDmaintenanceA Node.js/TypeScript MCP server template with sample tools (ping and system_info) that demonstrates how to build custom tools for Claude Desktop using stdio transport.6 npmISC
- AlicenseAqualityBmaintenanceLocal MCP server that wraps the headless Claude Code CLI as MCP tools, providing stateless access to Claude's coding capabilities through prompt-based interactions. It enables users to execute Claude Code commands with various prompt formats and structured outputs directly from MCP clients.3MIT