Local Code Indexing for Cursor

Um servidor baseado em Python que indexa localmente bases de código usando ChromaDB para fornecer busca semântica para ferramentas como Cursor.

O que você pode fazer com Local Code Indexing for Cursor?

  • Semantic code search — Ask the assistant to find relevant code across your indexed projects using search_code instead of relying on grep or file scanning.
  • Configure indexed folders — Specify which project folders to index by setting FOLDERS_TO_INDEX in the .env file.
  • Run indexing as a Docker service — Start the ChromaDB-backed indexing server with docker-compose up -d for background operation.
  • Integrate with Cursor Agent — Connect the server via mcp.json and add a .cursorrules instruction so the agent prefers search_code before other search methods.

Documentação

Local Code Indexing for Cursor

An experimental Python-based server that locally indexes codebases using ChromaDB and provides a semantic search tool via an MCP (Model Context Protocol) server for tools like Cursor.

Setup

  1. Clone and enter the repository:

    git clone <repository-url>
    cd cursor-local-indexing
    
  2. Create a .env file by copying .env.example:

    cp .env.example .env
    
  3. Configure your .env file:

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

    Example:

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

    docker-compose up -d
    
  5. Configure Cursor to use the local search server: Create or edit ~/.cursor/mcp.json:

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

The server will start indexing your specified projects, and you'll be able to use semantic code search within Cursor when those projects are active.

  1. Open a project that you configured as indexed.

Create a .cursorrules file and add the following:

<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>
  1. Start using the Cursor Agent mode and see it doing local vector searches!