Get the FREE Ultimate OpenClaw Setup Guide →

claude-code

MCP Server connects with claude code local command.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio kunihiros-claude-code-mcp npx -y @kunihiros/claude-code-mcp \
  --env LOG_LEVEL="info" \
  --env CLAUDE_BIN="/path/to/your/claude/executable"

How to use

The claude-code-mcp MCP server wraps the Claude Code CLI and exposes a set of tooling actions that you can request via JSON over stdio. It accepts requests to run tools such as explain_code, review_code, fix_code, edit_code, test_code, simulate_command, and your_own_query. Internally it Base64-encodes input to reliably handle newlines and special characters, constructs a command from the requested tool, executes it with Node.js child_process.spawn, and returns the results in JSON. To use it, run the server through npx (or your preferred installation method) and connect a client that sends the appropriate tool name and input payload; the server will respond with the execution output and any results or errors.

How to install

Prerequisites:

  • Node.js (>= v18 recommended)
  • npm (or yarn)
  • Claude Code command installed and authenticated

Installation options:

  1. Using npx (recommended for quick use)
npx @kunihiros/claude-code-mcp
  1. Global installation
npm install -g claude-code-mcp

Then, run the server as a command:

claude-code-mcp
  1. Local installation (development)
git clone https://github.com/KunihiroS/claude-code-mcp.git
cd claude-code-mcp/claude-code-server
npm install
npm run build

You can then run the built script directly:

node build/index.js

Additional notes

Environment variables can be provided via MCP Host settings (recommended for npx), a .env file, or a global ~/.claude-code-mcp.env file. Required CLAUDE_BIN should point to your Claude CLI executable. LOG_LEVEL is optional (defaults to info). The server writes to claude-code-mcp.log with a fallback order if writing to the project root fails. Ensure Claude Code CLI is installed and authenticated on the host where you run the MCP server. If you use the npx method, you may configure env vars in the MCP host configuration payload as shown in the README example.

Related MCP Servers

Sponsor this space

Reach thousands of developers