Local Code Search MCP server

Locally indexes codebases using ChromaDB to enable semantic code search without sending code to external services, featuring real-time updates through file system watchers and configurable ignore patterns.
Back to servers
Provider
Luoto Company
Release date
Mar 20, 2025
Language
Python
Stats
16 stars

This MCP server provides a local code indexing solution for Cursor IDE, allowing you to search your codebase semantically without sending your code to external services. It uses ChromaDB to create and query a local vector database of your code.

Installation

Prerequisites

  • Docker and Docker Compose
  • Cursor IDE
  • Git

Setup Steps

  1. Clone and enter the repository:

    git clone <repository-url>
    cd cursor-local-indexing
    
  2. Create a configuration file:

    cp .env.example .env
    
  3. Configure your environment by editing the .env file:

    PROJECTS_ROOT=~/your/projects/root    # Path to your projects directory
    FOLDERS_TO_INDEX=project1,project2    # Comma-separated list of folders to index
    

    For example:

    PROJECTS_ROOT=~/projects
    FOLDERS_TO_INDEX=project1,project2
    
  4. Launch the indexing server:

    docker-compose up -d
    

Configuring Cursor IDE

To connect Cursor with your local indexing server:

  1. Create or modify the MCP configuration file:

    mkdir -p ~/.cursor
    nano ~/.cursor/mcp.json
    
  2. Add the following content to the file:

    {
      "mcpServers": {
        "workspace-code-search": {
          "url": "http://localhost:8978/sse"
        }
      }
    }
    
  3. Restart Cursor IDE to apply the changes.

Using Local Code Search

After setup, you can use semantic code search within Cursor:

  1. Open one of the projects you configured for indexing.

  2. Create a .cursorrules file in your project root with the following content:

    <instructions>
    For any request, use the @search_code tool to check what the code does.
    Prefer that first before resorting to command line grepping etc.
    </instructions>
    
  3. Activate Cursor's Agent mode to start using local vector searches.

Verifying Functionality

When properly set up, Cursor will use your local index when performing code searches instead of sending your code to external services. You can test this by asking the Cursor Agent questions about your codebase.

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