mcp-codebase-index
by MikeRecognex·★ 51·综合分 47
零依赖的 MCP 服务器,提供 17 个代码库导航工具,具有持久缓存和增量更新功能。
概述
mcp-codebase-index 是一个结构化代码库索引器,将源文件解析为元数据并通过 MCP 提供 18 个查询工具。它支持 Python、TypeScript/JS、Go、Rust 和 C# 文件,在 git 仓库中自动进行增量重新索引。服务器使用持久磁盘缓存来消除冷启动延迟,并能高效处理大型代码库(已在拥有 110 万行代码的 CPython 上测试)。
试试问 AI
装完之后,这里有 6 个你可以让 AI 做的事:
什么时候选它
使用中等至大型Python/TypeScript/Go/Rust/C#代码库的开发者,需要高效的代码导航和影响分析,而不希望为读取整个文件支付token成本。
什么时候不要选它
使用此索引器不支持语言的项目,或者当你需要对代码库进行写访问时(此工具只读)。
此 server 暴露的工具
从 README 抽取出 12 个工具get_project_summaryGet file count, packages, top classes/functions
list_filesList indexed files with optional glob filter
get_structure_summaryGet structure of a file or the whole project
get_functionsList functions with name, lines, params
get_classesList classes with name, lines, methods, bases
get_importsList imports with module, names, line
get_function_sourceGet full source of a function/method
get_class_sourceGet full source of a class
find_symbolFind where a symbol is defined (file, line, type)
get_dependenciesGet what a symbol calls/uses
get_dependentsGet what calls/uses a symbol
get_change_impactGet direct + transitive dependents of a symbol
可对比工具
安装
pip install "mcp-codebase-index[mcp]"**Claude Desktop 配置:** 添加到 claude_desktop_config.json:
{
"mcpServers": {
"codebase-index": {
"command": "mcp-codebase-index",
"env": {
"PROJECT_ROOT": "/path/to/project"
}
}
}
}FAQ
- 它如何高效处理大型代码库?
- 它使用持久磁盘缓存和基于 git diff 的增量更新,只重新解析已更改的文件(约 1-2 毫秒)。在 CPython(110 万行)上,初始索引构建需要 56 秒,但后续启动时从缓存加载不到 1 秒。
- 支持哪些编程语言?
- Python(AST 解析)、TypeScript/JS、Go、Rust、C#(基于正则表达式)以及 Markdown/Text 文件。其他文件仅提供行数统计。
Hacker News 讨论
开发者社区最近的相关讨论。
- 帖子 by localforthewin · 2026-02-17
mcp-codebase-index 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。