Cursor MCP Server
Turns Claude Desktop into a Cursor-like assistant for code browsing, editing, searching, linting, formatting, and version control.
README
Cursor MCP Server – AI Coding Assistant for Claude Desktop
Turn Claude Desktop into a Cursor‑like assistant that can browse, search, edit, lint, format, and version‑control your entire codebase – all through a single MCP server.
Directory Tree cursor-mcp-server/ ├── README.md ├── .gitignore ├── requirements.txt ├── mcp_server.py # main server – entry point ├── config.py # global configuration ├── tools/ │ ├── init.py │ ├── file_tools.py # file read/write/diff/tree │ ├── search_tools.py # grep, semantic search, find files │ ├── command_tools.py # safe command execution │ ├── git_tools.py # git status/diff/log/branch │ ├── code_quality_tools.py # linting & formatting │ └── rag.py # ChromaDB indexing & semantic search └── claude_desktop_config.json # ready-to-paste configuration
🚀 Overview
This project provides a Model Context Protocol (MCP) server written in Python. Once connected to Claude Desktop, it gives Claude the ability to:
- Explore the file tree and read/write files
- Search code with regex (
grep) and semantic search (ChromaDB + embeddings) - Apply unified diffs safely (with optional backups)
- Run terminal commands inside the project (sandboxed)
- Inspect Git status, diff, log, and branch
- Lint and format code (detects Python / JavaScript projects)
- Build and query a semantic code index (fully local)
Everything runs offline after installing dependencies – no API keys needed.
📋 Prerequisites
- Python 3.10 or higher
pip(Python package manager)- Git (optional, for Git‑related tools)
- Linters / formatters are optional – the tools will detect them if installed:
- Python:
flake8andblack - JavaScript/TypeScript:
eslintandprettier
- Python:
📦 Installation
-
Clone or download this repository into a directory of your choice.
-
Create and activate a virtual environment (recommended):
python3 -m venv .venv source .venv/bin/activate -
Install the required Python packages:
pip install -r requirements.txtNote: The first time you run the semantic search tools,
sentence-transformerswill download a small embedding model (~80 MB). This is only needed once and works completely offline afterwards.
⚙️ Setup
1. Build the semantic code index (recommended)
The semantic search tool needs an index. You can build it by running the server and calling the rebuild_index tool, or by running the indexing script manually:
python -m tools.rag
This will walk the entire project, chunk files, and store embeddings inside .chroma_db/.
2. Configure Claude Desktop
-
Open Claude Desktop settings:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
-
Replace or merge the
mcpServerssection with the content ofclaude_desktop_config.jsonfrom this project. Edit the paths to match your setup:{ "mcpServers": { "cursor-assistant": { "command": "/path/to/your/project/.venv/bin/python3", "args": [ "/path/to/your/project/mcp_server.py", "--project-root", "/path/to/your/project" ], "env": { "PROJECT_ROOT": "/path/to/your/project", "PYTHONPATH": "/path/to/your/project" } } } }- Replace
/path/to/your/projectwith the absolute path to the project you want to work on. - The
commandshould point to the Python binary inside your virtual environment.
- Replace
-
Restart Claude Desktop completely (quit and reopen).
Once restarted, you’ll see an integration named cursor-assistant. Enable it and start using the assistant.
🧠 Usage
- In Claude Desktop, start a conversation. The tools are automatically available.
- You can ask in natural language:
- “Show me the file tree”
- “Find where authentication logic is”
- “Search for all places where we use the
requestslibrary” - “Apply this diff to login.py”
- “What’s the git status?”
- “Run tests and show me the output”
All destructive actions (writing files, running commands) are described clearly. Always review the proposed actions before Claude executes them. You have full control.
🔧 Tools Reference
Workspace
get_workspace_info– project root and top‑level entries
Files
read_file(path)– read a fileread_multiple_files(paths)– read several files at oncewrite_file(path, content)– overwrite/create a file ⚠️list_directory(path=".")– list non‑hidden contentsget_file_tree(path=".", max_depth=4)– recursive tree as JSONapply_diff(path, diff, create_backup=True)– apply a unified diff
Search
grep(pattern, path=".", include=None)– regex search (respects.gitignore)semantic_search(query, n_results=5)– semantic (embedding‑based) searchfind_files(pattern, path=".")– glob‑based file search
Commands
execute_command(command, cwd=".")– run a shell command (⚠️ use with approval)
Git
git_status()– short statusgit_diff(staged=False)– working directory diffgit_log(max_count=10)– recent commitsgit_branch()– current branch name
Code Quality
lint_file(path, linter="auto")– run flake8/eslintformat_file(path)– run black/prettier (returns formatted code, does not write)
Indexing
rebuild_index()– rebuild the semantic search index
🛡️ Safety
- All file and command operations are restricted to the project root – path traversal is blocked.
write_fileandapply_diffmodify files. Always review the changes before approving.execute_commandruns in a sandboxed directory, but the command itself is not restricted. Claude will ask for your confirmation before calling this tool.- Backups are automatically created when applying diffs (can be disabled).
🔍 Offline Capabilities
- Semantic search uses a local embedding model (
all-MiniLM-L6-v2) viasentence-transformers. The model is downloaded automatically on first use. - ChromaDB storage is local (
.chroma_db/folder). - No internet connection is required after the initial model download and dependency installation.
🐛 Troubleshooting
- “Module not found: mcp” – Ensure you are using the Python from your virtual environment and have run
pip install -r requirements.txtinside it. rebuild_indexfails / semantic search returns nothing – Ensure the.chroma_db/folder is writable and thatsentence-transformersis installed.- Git tools error – Make sure Git is installed and the project is a Git repository.
- Linter / formatter not found – Install the required tools (e.g.,
pip install flake8 black,npm install -g eslint prettier) or simply ignore those tools. - Path outside project root – You may be trying to access a file outside the configured project root. Adjust
PROJECT_ROOT. - Server disconnects immediately – Check the Claude Desktop logs for error messages. A common fix is to run the server manually (
python3 mcp_server.py --project-root .) and see the traceback.
📝 License
https://github.com/tariqnasheed – use it, modify it, share it.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.