代码索引MCP服务器
一个帮助大型语言模型索引、搜索和分析代码仓库的上下文协议服务器,开箱即用。
快速入门
安装
- 确保已安装 Python 3.10 或更高版本。
- 安装 uv(推荐):
- Windows:
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
- macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
- Windows:
- 克隆代码:
git clone https://github.com/johnhuang316/code-index-mcp.git
使用
直接运行服务器
- 使用 uv 运行:
uv run run.py
集成 Claude Desktop
- 找到配置文件路径:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS/Linux:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
- 添加以下内容并替换为实际路径:
- Windows 示例: { "mcpServers": { "code-indexer": { "command": "uv", "args": [ "--directory", "C:\path\to\code-index-mcp", "run", "run.py" ] } } }
- macOS/Linux 示例:将
C:\\...
替换为/home/username/path/to/code-index-mcp
- 重启 Claude Desktop。
基本操作
- 设置项目路径:首次使用需通过命令设置项目路径。
- 搜索代码:支持关键词或过滤文件类型。
- 分析文件:获取特定文件摘要或函数列表。
- 导航项目:查看项目结构或查找匹配模式的文件。