Claude Code MCP Server is a Node.js-based server that interfaces with the locally installed Claude Code command line tool, allowing you to use Claude's code capabilities through the Model Context Protocol (MCP). It provides tools like code explanation, review, fixing, editing, testing, and custom queries, and can be used from various MCP hosts including Claude Desktop.
Run the server directly without installation:
npx @kunihiros/claude-code-mcp
Install the package globally:
npm install -g claude-code-mcp
Then run it as a command:
claude-code-mcp
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 build
Run the built script:
node build/index.js
You need to configure the environment variables using one of these methods:
npx
).env
file in the directory where you run the command~/.claude-code-mcp.env
If using a file, add:
# .env or ~/.claude-code-mcp.env
CLAUDE_BIN=/path/to/your/claude/executable # REQUIRED
LOG_LEVEL=info # Optional
Add the following 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
}
"claude-code-server": {
"command": "claude-code-mcp",
"disabled": false
}
In this case, you must configure environment variables using a .env
file or the global config file.
The server provides these tools:
claude-code-mcp.log
) is created in the project root, user's home directory, or /tmp/
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.
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"
]
}
}
}
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.
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.