
基于 ChromaDB 的本地索引支持,作为 MCP 服务器公开
概览
一台基于 Python 的实验性服务器,使用 ChromaDB 索引代码库,并通过 MCP(模型上下文协议)服务器为 Cursor 等工具提供语义搜索工具。 2. 通过复制 .env.example 创建 .env 文件: 5. 配置光标以使用本地搜索服务器:创建或编辑 ~/.cursor/mcp.json: 6. 重启光标IDE以应用更改。 服务器会开始索引你指定的项目,当这些项目活跃时,你可以在光标内使用语义代码搜索。 7. 打开你配置为索引的项目。 创建一个 .cursorrules 文件并添加以下内容: 8. 开始使用光标代理模式,看看它做局部矢量搜索!
概述(AI 翻译)
这是一个基于Python的实验性服务器,本地使用 ChromaDB 索引代码库,并通过 MCP(模型上下文协议)服务器为 Cursor 等工具提供语义搜索工具。
布置
-
克隆并进入仓库:
-
通过复制
.env.example创建.env文件: -
配置你的
.env文件:
示例:
-
启动索引服务器:
-
配置光标以使用本地搜索服务器: 创建或编辑
~/.cursor/mcp.json: -
重启光标IDE以应用更改。
服务器会开始索引你指定的项目,当这些项目活跃时,你可以在光标内使用语义代码搜索。
- 打开你配置为索引的项目。
创建一个 .cursorrules 文件并添加以下内容:
- 开始使用光标代理模式,看看它做局部矢量搜索!
本页由 AI 翻译,技术细节请以原文为准。
README
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
-
Clone and enter the repository:
git clone cd cursor-local-indexing -
Create a
.envfile by copying.env.example:cp .env.example .env -
Configure your
.envfile:PROJECTS_ROOT=~/your/projects/root # Path to your projects directory FOLDERS_TO_INDEX=project1,project2 # Comma-separated list of folders to indexExample:
PROJECTS_ROOT=~/projects FOLDERS_TO_INDEX=project1,project2 -
Start the indexing server:
docker-compose up -d -
Configure Cursor to use the local search server: Create or edit
~/.cursor/mcp.json:{ "mcpServers": { "workspace-code-search": { "url": "http://localhost:8978/sse" } } } -
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.
- Open a project that you configured as indexed.
Create a .cursorrules file and add the following:
For any request, use the @search_code tool to check what the code does.
Prefer that first before resorting to command line grepping etc.
- Start using the Cursor Agent mode and see it doing local vector searches!
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"workspace-code-search": {
"url": "http://localhost:8978/sse"
}
}
}