经 AI Skill Hub 精选评估,代码库内存MCP服务 获评「强烈推荐」。已获得 2.3k 颗 GitHub Star,这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 8.2 分,适合有一定技术背景的用户使用。
高性能代码智能MCP服务器,可将代码库索引到持久化存储中。支持AST分析和代码智能功能,为Claude Code和Aider等工具提供代码上下文理解能力,适合开发者和AI编程工具集成使用。
代码库内存MCP服务 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
高性能代码智能MCP服务器,可将代码库索引到持久化存储中。支持AST分析和代码智能功能,为Claude Code和Aider等工具提供代码上下文理解能力,适合开发者和AI编程工具集成使用。
代码库内存MCP服务 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/DeusData/codebase-memory-mcp
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"-----mcp--": {
"command": "npx",
"args": ["-y", "codebase-memory-mcp"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 代码库内存MCP服务 执行以下任务... Claude: [自动调用 代码库内存MCP服务 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"_____mcp__": {
"command": "npx",
"args": ["-y", "codebase-memory-mcp"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
The fastest and most efficient code intelligence engine for AI coding agents. Full-indexes an average repository in milliseconds, the Linux kernel (28M LOC, 75K files) in 3 minutes. Answers structural queries in under 1ms. Ships as a single static binary for macOS, Linux, and Windows — download, run install, done.
High-quality parsing through tree-sitter AST analysis across all 155 languages, enhanced with LSP-style hybrid type resolution for Go, C, C++, and TypeScript / JavaScript / JSX / TSX (more languages coming soon) — producing a persistent knowledge graph of functions, classes, call chains, HTTP routes, and cross-service links. 14 MCP tools. Zero dependencies. Plug and play across 11 coding agents.
Research — The design and benchmarks behind this project are described in the preprint Codebase-Memory: Tree-Sitter-Based Knowledge Graphs for LLM Code Exploration via MCP (arXiv:2603.27277). Evaluated across 31 real-world repositories: 83% answer quality, 10× fewer tokens, 2.1× fewer tool calls vs. file-by-file exploration.
Security & Trust — This tool reads your codebase and writes to your agent configuration files. That is what it is designed to do. If you prefer to audit before running, the full source is here — every release binary is signed, checksummed, and scanned by 70+ antivirus engines. All processing happens 100% locally; your code never leaves your machine. Found a security issue? We want to know — see SECURITY.md. Security is Priority #1 for us.
<p align="center"> <img src="docs/graph-ui-screenshot.png" alt="Graph visualization UI showing the codebase-memory-mcp knowledge graph" width="800"> <br> <em>Built-in 3D graph visualization (UI variant) — explore your knowledge graph at localhost:9749</em> </p>
Invoke-WebRequest -Uri https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.ps1 -OutFile install.ps1
codebase-memory-mcp uninstall
Removes all agent configs, skills, hooks, and instructions. Does not remove the binary or SQLite databases.
<details> <summary>Automated download + install</summary>
macOS / Linux:
curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/scripts/setup.sh | bash
Windows (PowerShell):
irm https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/scripts/setup-windows.ps1 | iex
</details>
You: "Install this MCP server: https://github.com/DeusData/codebase-memory-mcp"
<details> <summary>Prerequisites: C compiler + zlib</summary>
| Requirement | Check | Install |
|---|---|---|
| **C compiler** (gcc or clang) | gcc --version or clang --version | macOS: xcode-select --install, Linux: apt install build-essential |
| **C++ compiler** | g++ --version or clang++ --version | Same as above |
| **zlib** | — | macOS: included, Linux: apt install zlib1g-dev |
| **Git** | git --version | Pre-installed on most systems |
</details>
```bash git clone https://github.com/DeusData/codebase-memory-mcp.git cd codebase-memory-mcp scripts/build.sh # standard binary scripts/build.sh --with-ui # with graph visualization
```
One-line install (macOS / Linux):
curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash
With graph visualization UI:
curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash -s -- --ui
Windows (PowerShell): ```powershell
notepad install.ps1
<details> <summary>If you prefer not to use the install command</summary>
Add to ~/.claude/.mcp.json (global) or project .mcp.json:
{
"mcpServers": {
"codebase-memory-mcp": {
"command": "/path/to/codebase-memory-mcp",
"args": []
}
}
}
Restart your agent. Verify with /mcp — you should see codebase-memory-mcp with 14 tools.
</details>
codebase-memory-mcp config list # show all settings
codebase-memory-mcp config set auto_index true # auto-index on session start
codebase-memory-mcp config set auto_index_limit 50000 # max files for auto-index
codebase-memory-mcp config reset auto_index # reset to default
| Variable | Default | Description |
|---|---|---|
CBM_CACHE_DIR | ~/.cache/codebase-memory-mcp | Override the database storage directory. All project indexes and config are stored here. |
CBM_DIAGNOSTICS | false | Set to 1 or true to enable periodic diagnostics output to /tmp/cbm-diagnostics-<pid>.json. |
CBM_DOWNLOAD_URL | *(GitHub releases)* | Override the download URL for updates. Used for testing or self-hosted deployments. |
```bash
Every MCP tool can be invoked from the command line:
codebase-memory-mcp cli index_repository '{"repo_path": "/path/to/repo"}'
codebase-memory-mcp cli search_graph '{"name_pattern": ".*Handler.*", "label": "Function"}'
codebase-memory-mcp cli trace_call_path '{"function_name": "Search", "direction": "both"}'
codebase-memory-mcp cli query_graph '{"query": "MATCH (f:Function) RETURN f.name LIMIT 5"}'
codebase-memory-mcp cli list_projects
codebase-memory-mcp cli --raw search_graph '{"label": "Function"}' | jq '.results[].name'
@myorg/pkg, github.com/foo/bar, use my_crate::foo resolved via manifest scanning (package.json, go.mod, Cargo.toml, pyproject.toml, composer.json, pubspec.yaml, pom.xml, build.gradle, mix.exs, *.gemspec)Map additional file extensions to supported languages via JSON config files. Useful for framework-specific extensions like .blade.php (Laravel) or .mjs (ES modules).
Per-project (in your repo root):
// .codebase-memory.json
{"extra_extensions": {".blade.php": "php", ".mjs": "javascript"}}
Global (applies to all projects):
// ~/.config/codebase-memory-mcp/config.json (or $XDG_CONFIG_HOME/...)
{"extra_extensions": {".twig": "html", ".phtml": "php"}}
Project config overrides global for conflicting extensions. Unknown language values are silently skipped. Missing config files are ignored.
| Problem | Fix |
|---|---|
/mcp doesn't show the server | Check .mcp.json path is absolute. Restart agent. Test: echo '{}' \| /path/to/binary should output JSON. |
index_repository fails | Pass absolute path: index_repository(repo_path="/absolute/path") |
trace_call_path returns 0 results | Use search_graph(name_pattern=".*PartialName.*") first to find the exact name. |
| Queries return wrong project results | Add project="name" parameter. Use list_projects to see names. |
| Binary not found after install | Add to PATH: export PATH="$HOME/.local/bin:$PATH" |
| UI not loading | Ensure you downloaded the ui variant and ran --ui=true. Check http://localhost:9749. |
codebase-memory-mcp 是一个专为 AI Agent 设计的增强型记忆工具,通过 MCP 协议为 Claude 等智能体提供深度代码库理解能力。它能够构建代码结构的知识图谱,让 AI 能够精准地检索、追踪和理解复杂的项目逻辑,从而显著提升 AI 在大型代码库中的开发协作效率。
该项目具备强大的代码语义分析能力,内置了 155 种 tree-sitter 语法解析器,支持多种编程语言的自动索引。它不仅能实现通用的包与模块解析(如 package.json, go.mod, Cargo.toml 等),还提供可视化图谱 UI,帮助开发者直观地查看代码调用链路与结构关系。
本项目支持多种平台的快速安装。macOS 与 Linux 用户可以通过 curl 命令执行一键安装脚本,并支持通过参数开启 graph visualization UI。Windows 用户可以使用 PowerShell 运行提供的 install.ps1 脚本。此外,您也可以通过手动编辑 `.mcp.json` 配置文件来完成 MCP 服务器的部署。
安装完成后,您可以直接在支持 MCP 的 Agent(如 Claude)中使用。对于高级用户,本项目提供了 CLI 模式,允许您直接在命令行中调用 index_repository、search_graph 或 trace_call_path 等工具,实现对代码库的自动化索引与路径追踪。
用户可以通过命令行工具进行灵活配置。使用 `codebase-memory-mcp config` 命令可以查看、设置或重置各项参数,例如控制自动索引功能的开关(auto_index)以及设置最大索引文件限制(auto_index_limit)。对于手动配置 MCP 的用户,请确保在 `.mcp.json` 中使用绝对路径指向二进制文件。
本项目提供强大的 CLI 接口,使每一个 MCP tool 都能在终端中独立运行。开发者可以通过命令行传递 JSON 参数来执行复杂的任务,例如使用 `cli index_repository` 进行仓库索引,或使用 `cli trace_call_path` 进行函数调用链路的深度追踪,非常适合集成到自动化工作流中。
项目采用先进的 Indexing pipeline,通过内置的 tree-sitter 语法解析器实现对代码的深度扫描。它具备智能的模块解析能力,能够通过扫描 package.json、go.mod、Cargo.toml 等清单文件,自动识别并解析不同语言的依赖关系。此外,支持通过自定义 JSON 配置文件扩展文件后缀映射,以适配框架特定的扩展名。
针对常见问题,若 `/mcp` 命令无法显示服务器,请检查 `.mcp.json` 中的路径是否为绝对路径并重启 Agent。在执行 `index_repository` 时,务必传入绝对路径以避免识别失败。如果 `trace_call_path` 出现异常,建议检查相关函数的解析完整性。
专业的MCP代码智能��务器实现,架构成熟,星标认可度高,持续维护,适合集成到AI编程工具链中。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
AI Skill Hub 点评:代码库内存MCP服务 的核心功能完整,质量优秀。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | codebase-memory-mcp |
| 原始描述 | 开源MCP工具:High-performance code intelligence MCP server. Indexes codebases into a persiste。⭐2.3k · C |
| Topics | 代码分析MCP服务AST解析代码智能高性能索引 |
| GitHub | https://github.com/DeusData/codebase-memory-mcp |
| License | MIT |
| 语言 | C |
收录时间:2026-05-14 · 更新时间:2026-05-16 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端