Local Code Indexing for Cursor logo

Local Code Indexing for Cursor

by LuotoCompany

This is an experimental Python-based server that locally indexes codebases using ChromaDB. It provides a semantic search tool via an MCP server for tools like Cursor.

View on GitHub

Last updated: N/A

What is Local Code Indexing for Cursor?

A local code indexing server designed for use with the Cursor IDE. It leverages ChromaDB to create a vector database of your codebase, enabling semantic search capabilities within Cursor.

How to use Local Code Indexing for Cursor?

  1. Clone the repository. 2. Configure the .env file with your project root and folders to index. 3. Start the indexing server using Docker Compose. 4. Configure Cursor to use the local search server by editing ~/.cursor/mcp.json. 5. Restart Cursor. 6. Open an indexed project and create a .cursorrules file to instruct the agent to use the search tool.

Key features of Local Code Indexing for Cursor

  • Local code indexing

  • Semantic code search

  • Integration with Cursor IDE

  • Uses ChromaDB for vector storage

  • MCP server for communication with Cursor

Use cases of Local Code Indexing for Cursor

  • Finding code snippets based on meaning rather than exact matches

  • Improving code understanding and navigation

  • Enabling AI agents within Cursor to effectively search and utilize code

  • Quickly locating relevant code within large projects

  • Enhancing the capabilities of Cursor's agent mode

FAQ from Local Code Indexing for Cursor

What is ChromaDB?

ChromaDB is an open-source embedding database. Chroma makes it easy to build LLM apps by making knowledge, facts, and skills pluggable for LLMs.

What is an MCP server?

MCP stands for Model Context Protocol. It's a communication protocol used by Cursor to interact with external services, such as this local indexing server.

How do I specify which projects to index?

You configure the PROJECTS_ROOT and FOLDERS_TO_INDEX variables in the .env file. PROJECTS_ROOT should point to the directory containing your projects, and FOLDERS_TO_INDEX should be a comma-separated list of folder names within the PROJECTS_ROOT that you want to index.

Why do I need a .cursorrules file?

The .cursorrules file allows you to instruct the Cursor agent to prioritize using the @search_code tool for code-related requests. This ensures that the agent leverages the local indexing server for relevant tasks.

What if I encounter issues during setup?

Double-check your .env configuration, ensure that Docker Compose is running correctly, and verify that the mcp.json file in your Cursor configuration is correctly configured. Consult the ChromaDB documentation if issues with ChromaDB arise.