经 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 native executable with a small verified runtime-asset set for macOS, Linux, and Windows — download, run install, done.
High-quality parsing through tree-sitter AST analysis across all 162 languages, enhanced with Hybrid LSP semantic type resolution for Python, TypeScript / JavaScript / JSX / TSX, PHP, C#, Go, C, C++, Java, Kotlin, Rust, and Perl — producing a persistent knowledge graph of functions, classes, call chains, HTTP routes, and cross-service links. 15 MCP tools. No language runtime, hosted service, or API key. Plug and play across 45 supported automatic/conditional client surfaces.
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. For each release product, three behaviourally identical executable candidates (unstripped, debug-stripped, stripped) are submitted to VirusTotal before testing; the selected candidate is then packaged with its SHA-256 unchanged. Release notes link every measured candidate result. Publication permits only the narrowly documented single-Microsoft !ml tolerance in SECURITY.md. 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 — 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 owned agent config entries, skills, hooks, instructions, and the installed binary. Existing graph indexes are listed and deleted only after confirmation.
The install script placed beside the binary is reported, not deleted — uninstall prints its path and the rm command for it. It is left alone on purpose: it may be your own copy, a symlink into a checkout, or managed by a package manager, and an uninstaller should not delete a file it cannot prove it owns.
<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 --with-ui # the shipped composition (graph UI embedded) scripts/build.sh # without the UI (development only)
Every platform ships **one self-contained executable**: the graph UI and the agent integration templates are linked into the binary, so an extracted archive is immediately complete.
Run the test suite (6,768 tests across 120 suites):
bash scripts/test.sh # full: clean sanitizer build + all suites + guards scripts/test.sh --suites <name> # one suite, incremental, seconds build/c/test-runner --list-suites # what is available
`scripts/test.sh` is the same entry the CI gates run, so a local pass means the same thing a CI pass does. The canonical local artifact-flow check builds both stripped/unstripped candidates, defaults to the stripped candidate for this explicitly unscanned local run, packages those exact bytes, extracts the archive, and smokes it:
bash scripts/ci/smoke-artifact.sh <linux|darwin|windows> <amd64|arm64> ```
scripts/package-release.sh is intentionally a lower-level immutable boundary: it accepts only an already-final --selected-binary plus its --expected-sha256; it never builds, strips, signs, or relinks the executable.
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
Windows (PowerShell): ```powershell
notepad install.ps1
<details> <summary>If you prefer not to use the install command</summary>
Add to ~/.claude.json (user scope) 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 15 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 set auto_watch false # don't register background git watcher (default: true)
codebase-memory-mcp config set watcher_enabled false # stop the watcher thread entirely (default: true)
codebase-memory-mcp config reset auto_index # reset to default
| Variable | Default | Description |
|---|---|---|
CBM_ALLOWED_ROOT | *(unset)* | Confine index_repository to paths within this directory. When set, a repo_path that resolves (after symlink / .. resolution) outside this root is refused, and the same check now applies to the graph UI's POST /api/index route rather than only to the MCP tool. Unset imposes no *containment* restriction — but see the always-on limits below, which apply whether or not this is set. Useful when the server may be driven by an untrusted caller, e.g. agentic or multi-tenant deployments. |
CBM_CACHE_DIR | ~/.cache/codebase-memory-mcp | Override the database storage directory. All project indexes and config are stored here. One account can use only one canonical cache root at a time; close active CBM sessions/commands before switching it. |
CBM_DIAGNOSTICS | false | Set to 1 or true to enable the shared daemon's periodic snapshot.json and retained trajectory.ndjson below a fresh owner-private directory in the system temp directory. Exact paths are logged by diagnostics.start. |
CBM_DOWNLOAD_URL | *(GitHub releases)* | Override the download URL for updates. Used for testing or self-hosted deployments. |
CBM_LOG_LEVEL | role-aware | Set the minimum log level. Thin MCP/CLI/hook frontends default to warn; the detached daemon and its supervised index workers default to `in
Every MCP tool can be invoked as a local, one-shot command. CLI tools neither start nor connect to the coordination daemon and leave no standing process behind. They hold a crash-safe exact-build admission lease only for the command lifetime. index_repository is the only exception internally: it starts a temporary, exact-build supervised worker for the index, then stops that worker before the CLI command exits; the worker holds its own lease until exit.
Commands that mutate graph data use shared OS-backed, per-project locks. This serializes conflicting work from CLI and MCP sessions on the same project while allowing unrelated projects to proceed independently.
When stderr is an interactive terminal, the CLI automatically shows lifecycle and indexing progress. Pass --progress to force the same feedback when stderr is redirected or the command is run non-interactively. Pass --quiet to disable automatic terminal progress and ordinary diagnostics while retaining errors; it cannot be combined with --progress or outer cli --verbose. Routine informational logs are quiet by default; pass outer cli --verbose to include them. Progress and logs use stderr while stdout remains reserved for the command result. Read tools return a compact tree by default; pass a tool's --format json for machine-readable payload JSON, or outer --json for the full MCP envelope.
Large compact-tree tables may start with a response-local <section>_refs directory and an explicit <section>_ref_rule. A cell such as @0+handler.go reconstructs to ref 0's prefix plus handler.go. References are local to that sibling <section> table and expansion is non-recursive: entries inside <section>_refs are always literal prefixes. This is limited to declared path and qualified-name columns and activates only when the exact rendered table is at least 15% and 64 bytes smaller and a conservative model-neutral token-shape proxy also improves by at least 1%. Search and trace likewise render direct and prefix-grouped tree shapes and keep the smaller complete representation, so singleton or scattered answers do not pay directory overhead. Keys are declared once per table but never cryptically abbreviated, and --format json keeps stable literal strings for machine consumers. Both gates are deterministic; exact token counts still depend on the caller's tokenizer.
Lean responses truncate semantically, never by cutting arbitrary bytes from code or identifiers. Ranked graph rows are retained ahead of raw grep rows and diagnostic summaries; omitted rows/sections report totals, has_more, and a strictly advancing continuation offset or cursor. If even the first whole row cannot fit, CBM asks for a higher budget and emits no self-looping cursor. max_output_tokens is model-neutral sizing guidance: CBM enforces a deterministic ceiling of four UTF-8 bytes per requested token, so it is not a tokenizer-exact count. Detail flags such as diagnostics, source_mode, and detail opt into heavier fields. search_code pages ranked rows with result_limit/result_offset (limit remains a compatibility alias), raw rows with raw_limit/raw_offset, and directory summaries with directory_limit/directory_offset. Raw lines default to a UTF-8-safe match-centered preview; each row reports content_start_byte, returned/total byte counts, match byte bounds when known, and a content continuation offset. Pass raw_content_offset to page the original line without moving the raw-row cursor. match_limit and source_max_lines bound per-result details, with exact omission metadata. detect_changes pages changed files, impacted symbols, and module summaries independently; prefer its snapshot-bound *_cursor continuations, which reject changed commits, worktree bytes, graph generation, or semantic arguments instead of silently skipping or duplicating rows.
Every response is standard UTF-8. Identifiers, paths, and raw search previews preserve POSIX byte-string identities: a preserved value containing malformed UTF-8 is emitted reversibly as @bytes:<lowercase hex of every original byte>. A valid preserved value that literally begins with the reserved @bytes: or @utf8: prefix is emitted as @utf8:<original value>, so decoding is unambiguous: strip one @utf8: prefix for literal UTF-8, or hex-decode one @bytes: prefix for original bytes. Ordinary valid UTF-8 is unchanged and pays no output-token overhead. To keep code readable, source bodies replace malformed UTF-8 with U+FFFD; use the pageable raw search preview when byte-exact source inspection is required.
Use cli <tool> --help to see the flags generated from that tool's input schema:
```bash codebase-memory-mcp cli index_repository --repo-path /path/to/repo codebase-memory-mcp cli list_projects
@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)These are intentionally not counted as automatic installs: Qodo MCP is added through its UI and may be governed by enterprise allowlists; Warp MCP is managed through Warp Drive/UI or per invocation (only the shared skill is automatic); JetBrains AI Assistant / ACP is IDE-managed; GitHub Copilot coding agent, Jules, and CodeRabbit are cloud/repository-managed; Replit exposes a remote/service integration rather than a stable local user-global client; BLACKBOX AI does not document a stable arbitrary user-global MCP/instruction/agent schema; Plandex has no stable global registry safe to mutate; and SWE-agent uses explicit YAML and is no longer a suitable automatic global target.
codebase-memory-mcp runs 100% locally and collects no telemetry — your code, queries, environment, and usage never leave your machine. That privacy guarantee also means that when you hit something we can't reproduce on our side (a slow memory climb over hours, a performance regression, a leak that only appears after days of real use), we have no data at all unless you choose to send it. Here is how to capture it yourself.
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 类型,复制安装指令后粘贴到对应客户端