Claude Code MCP server

Use Claude Code with less capable LLMs.
Back to servers
Provider
Kunihiro Setogawa
Release date
Mar 14, 2025
Language
TypeScript
Package
Stats
692 downloads
18 stars

The claude-code-mcp server enables you to harness Claude Code's capabilities through an MCP server implementation. It provides tools like code explanation, review, fixing, editing, testing, and more by interfacing with your locally installed Claude Code command.

Installation Requirements

Before installing, ensure you have:

Installation Methods

Quick Start with npx (Recommended)

Run the server directly without installation:

npx @kunihiros/claude-code-mcp

Global Installation

Install the package globally for command-line access:

npm install -g claude-code-mcp

Then run it as a command:

claude-code-mcp

Configuration

You must configure the environment variables using one of these methods:

Option 1: MCP Host Settings (Recommended for npx)

Add this to your MCP Host application settings:

"claude-code-server": {
  "command": "npx",
  "args": [
    "-y",
    "@kunihiros/claude-code-mcp"
  ],
  "env": {
    "CLAUDE_BIN": "/path/to/your/claude/executable",
    "LOG_LEVEL": "info"
  },
  "disabled": false
}

Option 2: Using .env File

Create a .env file in the directory where you run the command:

CLAUDE_BIN=/path/to/your/claude/executable
LOG_LEVEL=info

Option 3: Global Config File

Create a .claude-code-mcp.env file in your home directory:

CLAUDE_BIN=/path/to/your/claude/executable
LOG_LEVEL=info

Environment Variables

  • CLAUDE_BIN: Required - Full path to your Claude CLI executable Example: /home/linuxbrew/.linuxbrew/bin/claude or C:\Users\YourUser\AppData\Local\bin\claude.exe
  • LOG_LEVEL: Optional - Set log level (debug, info, warn, error)

Available Tools

The server provides several tools for working with code:

  • explain_code: Provides detailed explanations of given code
  • review_code: Reviews code for issues and improvements
  • fix_code: Fixes bugs or issues in the provided code
  • edit_code: Edits code based on specific instructions
  • test_code: Generates tests for the given code
  • simulate_command: Simulates command execution
  • your_own_query: Sends custom queries with context

Usage Notes

  • Log files are created in the project root, user's home directory, or /tmp/ folder
  • The server has been tested primarily with Claude CLI on Ubuntu/WSL2
  • The server functions by:
    • Receiving JSON requests from clients
    • Processing input with Base64 encoding
    • Generating and executing Claude Code commands
    • Returning execution results in JSON format

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later