
How to add MCP Claude Code to Cursor
Claude Code-style coding agent over MCP: read/edit files, run commands, search code, delegate to sub-agents. Paste the config into ~/.cursor/mcp.json and restart Cursor.
Last updated June 14, 2026 · 301★ · stdio · no auth
Cursor config for MCP Claude Code
uvx --from mcp-claude-code claudecode --install{
"mcpServers": {
"mcp-claude-code": {
"command": "uvx",
"args": [
"--from",
"mcp-claude-code",
"claudecode",
"--allow-path",
"/path/allow",
"--project",
"/path/project1",
"--project",
"/path/project2"
]
}
}
}Requires `uv` (the Python package runner). Install it from https://docs.astral.sh/uv/ if `uvx` is not found.
Setup steps
- 1Open Cursor → Settings → MCP → Add new MCP server (or edit ~/.cursor/mcp.json directly).
- 2Paste the MCP Claude Code config below into the "mcpServers" object.
- 3Fill in placeholder secrets, then save.
- 4Cursor reloads MCP servers automatically — check Settings → MCP for a green status dot.
- 5Ask Cursor to use one of MCP Claude Code's tools to confirm it's connected.
Before you start
- Python 3.12 or later
- Claude Desktop application (or another MCP client)
- uv/uvx or pip to install the mcp-claude-code package
- Optional: ripgrep for enhanced search performance
- Optional: an LLM provider API key (LiteLLM-compatible) to enable the agent tool
What MCP Claude Code can do in Cursor
readRead file contents with line numbers, offset, and limit capabilities.
writeCreate or overwrite files.
editMake line-based edits to text files.
multi_editMake multiple precise text replacements in a single file operation with atomic transactions.
directory_treeGet a recursive tree view of directories.
grepFast pattern search in files with ripgrep integration for best performance.
content_replaceReplace patterns in file contents.
grep_astSearch code with AST context showing matches within functions, classes, and other structures.
Security
Access is restricted to directories passed via --allow-path; file modifications and command execution trigger permission handling, with input validation and sanitization. The run_command tool executes arbitrary shell commands within allowed paths, so only grant access to directories you trust. The optional agent tool requires an LLM provider API key (passed via --agent-api-key or environment variables such as OPENAI_API_KEY / ANTHROPIC_API_KEY).
MCP Claude Code + Cursor FAQ
Where is the Cursor config file?
Cursor reads MCP servers from ~/.cursor/mcp.json. Paste the MCP Claude Code config there under the "mcpServers" key and restart the client.
Is MCP Claude Code safe to use with Cursor?
Access is restricted to directories passed via --allow-path; file modifications and command execution trigger permission handling, with input validation and sanitization. The run_command tool executes arbitrary shell commands within allowed paths, so only grant access to directories you trust. The optional agent tool requires an LLM provider API key (passed via --agent-api-key or environment variables such as OPENAI_API_KEY / ANTHROPIC_API_KEY).
How do I install and configure it?
The recommended method is uvx: run `uvx --from mcp-claude-code claudecode --install` to auto-configure Claude Desktop, or add a manual `mcpServers` entry with command `uvx` and args `--from mcp-claude-code claudecode --allow-path /path/allow`. You can also `pip install mcp-claude-code` and use the `claudecode` command directly.
How is filesystem access secured?
The server only accesses directories you explicitly pass via `--allow-path` (multiple allowed). File modifications and command execution use permission handling, and inputs are validated and sanitized.
How do I enable the agent (sub-agent) tool?
Add `--enable-agent-tool` and configure an LLM provider with `--agent-model` (LiteLLM format, e.g. `openai/gpt-4o` or `anthropic/claude-3-5-sonnet-20241022`) plus `--agent-api-key`, or use environment variables like OPENAI_API_KEY / ANTHROPIC_API_KEY. It is disabled by default.