Cursor MCP Server

Cursor MCP Server

Turns Claude Desktop into a Cursor-like assistant for code browsing, editing, searching, linting, formatting, and version control.

Category
Visit Server

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: flake8 and black
    • JavaScript/TypeScript: eslint and prettier

📦 Installation

  1. Clone or download this repository into a directory of your choice.

  2. Create and activate a virtual environment (recommended):

    python3 -m venv .venv
    source .venv/bin/activate
    
  3. Install the required Python packages:

    pip install -r requirements.txt
    

    Note: The first time you run the semantic search tools, sentence-transformers will 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

  1. Open Claude Desktop settings:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. Replace or merge the mcpServers section with the content of claude_desktop_config.json from 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/project with the absolute path to the project you want to work on.
    • The command should point to the Python binary inside your virtual environment.
  3. 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 requests library”
    • “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 file
  • read_multiple_files(paths) – read several files at once
  • write_file(path, content) – overwrite/create a file ⚠️
  • list_directory(path=".") – list non‑hidden contents
  • get_file_tree(path=".", max_depth=4) – recursive tree as JSON
  • apply_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) search
  • find_files(pattern, path=".") – glob‑based file search

Commands

  • execute_command(command, cwd=".") – run a shell command (⚠️ use with approval)

Git

  • git_status() – short status
  • git_diff(staged=False) – working directory diff
  • git_log(max_count=10) – recent commits
  • git_branch() – current branch name

Code Quality

  • lint_file(path, linter="auto") – run flake8/eslint
  • format_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_file and apply_diff modify files. Always review the changes before approving.
  • execute_command runs 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) via sentence-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.txt inside it.
  • rebuild_index fails / semantic search returns nothing – Ensure the .chroma_db/ folder is writable and that sentence-transformers is 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

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured