codebase-memory-mcp-intelligence

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

codebase-memory-mcp Intelligence

codebase-memory-mcp 代码智能

Skill by ara.so — MCP Skills collection.
ara.so 提供的 Skill——MCP Skills 集合。

Overview

概述

codebase-memory-mcp is a high-performance code intelligence MCP server that indexes codebases into persistent knowledge graphs. It parses 155 languages using tree-sitter ASTs, resolves call graphs, detects HTTP routes, and enables sub-millisecond structural queries. The Linux kernel (28M LOC) indexes in 3 minutes; average repos in milliseconds.
Key capabilities:
  • Graph-based code intelligence: Functions, classes, calls, imports, inheritance as queryable nodes/edges
  • Structural search: Find symbols by pattern, trace call chains, detect dead code
  • Architecture analysis: Community detection, hotspots, layering, cross-service HTTP linking
  • Semantic search: Vector search with bundled embeddings (no API key required)
  • 155 languages: Tree-sitter grammars compiled into a single static binary
  • 14 MCP tools: All accessible via natural language in any compatible agent
codebase-memory-mcp 是一个高性能代码智能 MCP 服务器,可将代码库索引为持久化知识图谱。它使用 tree-sitter AST 解析 155 种语言,解析调用图、检测 HTTP 路由,并支持亚毫秒级结构化查询。Linux 内核(2800 万行代码)可在 3 分钟内完成索引;普通仓库仅需数毫秒。
主要功能:
  • 基于图谱的代码智能:将函数、类、调用、导入和继承关系表示为可查询的节点/边
  • 结构化搜索:按模式查找符号、追踪调用链、检测死代码
  • 架构分析:社区检测、热点分析、分层分析、跨服务 HTTP 关联
  • 语义搜索:使用内置 embeddings 进行向量搜索(无需 API key)
  • 155 种语言:将 Tree-sitter grammars 编译为单一静态二进制文件
  • 14 个 MCP 工具:任何兼容的 agent 均可通过自然语言使用全部工具

Installation

安装

Quick Install (macOS/Linux)

快速安装(macOS/Linux)

bash
undefined
bash
undefined

Standard version

Standard version

With graph visualization UI

With graph visualization UI

Windows (PowerShell)

Windows(PowerShell)

powershell
Invoke-WebRequest -Uri https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.ps1 -OutFile install.ps1
.\install.ps1
powershell
Invoke-WebRequest -Uri https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.ps1 -OutFile install.ps1
.\install.ps1

Manual Installation

手动安装

Download from releases:
bash
undefined
从 releases 下载:
bash
undefined

Extract and run installer

Extract and run installer

tar xzf codebase-memory-mcp-*.tar.gz ./install.sh

The installer auto-detects Claude Code, Cursor, Codex CLI, Gemini CLI, Zed, OpenCode, Aider, VS Code, and other agents, configuring MCP entries automatically.
tar xzf codebase-memory-mcp-*.tar.gz ./install.sh

安装程序会自动检测 Claude Code、Cursor、Codex CLI、Gemini CLI、Zed、OpenCode、Aider、VS Code 和其他 agent,并自动配置 MCP 条目。

Verify Installation

验证安装

bash
codebase-memory-mcp --version
Restart your coding agent after installation.
bash
codebase-memory-mcp --version
安装后,请重启你的 coding agent。

Core Usage Patterns

核心使用模式

Indexing a Codebase

索引代码库

Via agent (recommended):
User: Index this project
The MCP server will call
index_repository
with the current working directory.
Via CLI:
bash
codebase-memory-mcp index /path/to/repo
Enable auto-indexing:
bash
codebase-memory-mcp config set auto_index true
codebase-memory-mcp config set auto_index_limit 50000
Auto-index runs on MCP session start for new projects and registers existing projects with the background file watcher.
通过 agent(推荐):
User: Index this project
MCP 服务器将使用当前工作目录调用
index_repository
。
通过 CLI:
bash
codebase-memory-mcp index /path/to/repo
启用自动索引:
bash
codebase-memory-mcp config set auto_index true
codebase-memory-mcp config set auto_index_limit 50000
自动索引会在 MCP 会话启动时为新项目运行,并将现有项目注册到后台文件监视器。

Architecture Overview

架构概览

Get a complete architectural summary in one call:
User: Show me the architecture of this codebase
This invokes
get_architecture
which returns:
  • Languages and package structure
  • Entry points (main functions, HTTP handlers)
  • HTTP/gRPC/GraphQL routes
  • Hotspot functions (high in/out degree)
  • Module boundaries via Louvain clustering
  • Layering analysis (presentation/business/data)
Example response structure:
json
{
  "languages": ["TypeScript", "Python", "Go"],
  "packages": ["src/api", "src/services", "src/models"],
  "entry_points": [
    {"name": "main", "file": "src/index.ts", "type": "Function"}
  ],
  "routes": [
    {"path": "/api/users", "method": "GET", "handler": "getUsers", "file": "src/api/users.ts"}
  ],
  "hotspots": [
    {"name": "processRequest", "in_degree": 15, "out_degree": 8, "file": "src/services/request.ts"}
  ],
  "boundaries": [
    {"module": "Community_0", "members": ["src/api/*"], "internal_edges": 45, "external_edges": 12}
  ]
}
通过一次调用获取完整的架构摘要:
User: Show me the architecture of this codebase
这将调用
get_architecture
,并返回:
  • 语言和包结构
  • 入口点(main 函数、HTTP 处理器)
  • HTTP/gRPC/GraphQL 路由
  • 热点函数(高入度/出度)
  • 通过 Louvain 聚类识别模块边界
  • 分层分析(展示层/业务层/数据层)
示例响应结构:
json
{
  "languages": ["TypeScript", "Python", "Go"],
  "packages": ["src/api", "src/services", "src/models"],
  "entry_points": [
    {"name": "main", "file": "src/index.ts", "type": "Function"}
  ],
  "routes": [
    {"path": "/api/users", "method": "GET", "handler": "getUsers", "file": "src/api/users.ts"}
  ],
  "hotspots": [
    {"name": "processRequest", "in_degree": 15, "out_degree": 8, "file": "src/services/request.ts"}
  ],
  "boundaries": [
    {"module": "Community_0", "members": ["src/api/*"], "internal_edges": 45, "external_edges": 12}
  ]
}

Searching the Graph

搜索图谱

Find symbols by name pattern:
User: Find all functions with "Handler" in the name
Uses
search_graph
:
json
{
  "name_pattern": ".*Handler.*",
  "labels": ["Function"]
}
Find high-degree nodes:
User: Show me the most called functions
json
{
  "labels": ["Function"],
  "min_in_degree": 5,
  "limit": 20
}
Scope to specific files:
User: Find all classes in the auth module
json
{
  "labels": ["Class"],
  "file_pattern": ".*/auth/.*"
}
按名称模式查找符号:
User: Find all functions with "Handler" in the name
使用
search_graph
:
json
{
  "name_pattern": ".*Handler.*",
  "labels": ["Function"]
}
查找高连接度节点:
User: Show me the most called functions
json
{
  "labels": ["Function"],
  "min_in_degree": 5,
  "limit": 20
}
限定到特定文件:
User: Find all classes in the auth module
json
{
  "labels": ["Class"],
  "file_pattern": ".*/auth/.*"
}

Call Tracing

调用追踪

Find all callers:
User: What calls the authenticate function?
Uses
get_callers
:
json
{
  "symbol_name": "authenticate",
  "max_depth": 3
}
Trace call chain:
User: Trace the execution path from main to database functions
Uses
trace_symbol
:
json
{
  "symbol_name": "main",
  "direction": "outgoing",
  "max_depth": 5,
  "edge_types": ["CALLS"]
}
查找所有调用方:
User: What calls the authenticate function?
使用
get_callers
:
json
{
  "symbol_name": "authenticate",
  "max_depth": 3
}
追踪调用链:
User: Trace the execution path from main to database functions
使用
trace_symbol
:
json
{
  "symbol_name": "main",
  "direction": "outgoing",
  "max_depth": 5,
  "edge_types": ["CALLS"]
}

Semantic Search

语义搜索

Find related code by concept:
User: Find authentication-related functions
Uses
semantic_query
:
json
{
  "query": "authentication jwt token validation",
  "limit": 10
}
Semantic search uses bundled Nomic embeddings (no API key required) with 11-signal scoring:
  • TF-IDF relevance
  • AST structural similarity
  • API signature matching
  • Data flow patterns
  • MinHash near-clone detection
按概念查找相关代码:
User: Find authentication-related functions
使用
semantic_query
:
json
{
  "query": "authentication jwt token validation",
  "limit": 10
}
语义搜索使用内置的 Nomic embeddings(无需 API key),并采用 11 项信号评分:
  • TF-IDF 相关性
  • AST 结构相似度
  • API 签名匹配
  • 数据流模式
  • MinHash 近似克隆检测

Cypher-Like Queries

类 Cypher 查询

Advanced graph queries:
User: Run a Cypher query to find all functions that call database operations
Uses
cypher_query
:
cypher
MATCH (f:Function)-[:CALLS]->(db:Function)
WHERE db.name CONTAINS 'query' OR db.name CONTAINS 'exec'
RETURN f.name, f.file, COUNT(db) as db_calls
ORDER BY db_calls DESC
LIMIT 20
Find inheritance hierarchies:
cypher
MATCH (c:Class)-[:INHERITS*1..3]->(base:Class)
WHERE base.name = 'BaseModel'
RETURN c.name, c.file
HTTP route to implementation:
cypher
MATCH (r:Route)-[:HANDLED_BY]->(h:Function)-[:CALLS]->(s:Function)
WHERE r.path CONTAINS '/api/users'
RETURN r.path, h.name, COLLECT(s.name) as services
高级图查询:
User: Run a Cypher query to find all functions that call database operations
使用
cypher_query
:
cypher
MATCH (f:Function)-[:CALLS]->(db:Function)
WHERE db.name CONTAINS 'query' OR db.name CONTAINS 'exec'
RETURN f.name, f.file, COUNT(db) as db_calls
ORDER BY db_calls DESC
LIMIT 20
查找继承层次结构:
cypher
MATCH (c:Class)-[:INHERITS*1..3]->(base:Class)
WHERE base.name = 'BaseModel'
RETURN c.name, c.file
从 HTTP 路由到实现的映射:
cypher
MATCH (r:Route)-[:HANDLED_BY]->(h:Function)-[:CALLS]->(s:Function)
WHERE r.path CONTAINS '/api/users'
RETURN r.path, h.name, COLLECT(s.name) as services

Dead Code Detection

死代码检测

User: Find unused functions
Uses
find_dead_code
:
json
{
  "entry_points": ["main", "handler"],
  "min_depth": 2
}
Returns functions with zero incoming
CALLS
edges, excluding recognized entry points (main, init, handlers, tests).
User: Find unused functions
使用
find_dead_code
:
json
{
  "entry_points": ["main", "handler"],
  "min_depth": 2
}
返回没有任何传入
CALLS
边的函数,并排除已识别的入口点(main、init、handlers、tests)。

Change Impact Analysis

变更影响分析

Detect impact of uncommitted changes:
User: What's affected by my recent changes?
Uses
detect_changes
:
json
{
  "include_tests": true
}
Returns:
  • Changed symbols with confidence scores
  • Affected downstream symbols (via call graph)
  • Risk classification (CRITICAL/HIGH/MEDIUM/LOW)
  • Test coverage mapping
Example response:
json
{
  "changed_symbols": [
    {
      "name": "authenticate",
      "type": "Function",
      "file": "src/auth.ts",
      "confidence": 0.95,
      "change_type": "modified"
    }
  ],
  "affected_symbols": [
    {
      "name": "loginHandler",
      "type": "Function",
      "file": "src/handlers/login.ts",
      "distance": 1,
      "risk": "HIGH"
    }
  ]
}
检测未提交更改的影响:
User: What's affected by my recent changes?
使用
detect_changes
:
json
{
  "include_tests": true
}
返回:
  • 发生更改的符号及其置信度分数
  • 受影响的下游符号(通过调用图确定)
  • 风险分类(CRITICAL/HIGH/MEDIUM/LOW)
  • 测试覆盖映射
示例响应:
json
{
  "changed_symbols": [
    {
      "name": "authenticate",
      "type": "Function",
      "file": "src/auth.ts",
      "confidence": 0.95,
      "change_type": "modified"
    }
  ],
  "affected_symbols": [
    {
      "name": "loginHandler",
      "type": "Function",
      "file": "src/handlers/login.ts",
      "distance": 1,
      "risk": "HIGH"
    }
  ]
}

Architecture Decision Records (ADR)

架构决策记录(ADR)

Create ADR:
User: Document our decision to use Redis for session storage
Uses
manage_adr
:
json
{
  "action": "create",
  "title": "Use Redis for Session Storage",
  "status": "accepted",
  "context": "Need fast, distributed session management",
  "decision": "Adopt Redis with session TTL and clustering",
  "consequences": "Requires Redis infrastructure; enables horizontal scaling"
}
List ADRs:
User: Show all architecture decisions
json
{
  "action": "list"
}
Update ADR:
json
{
  "action": "update",
  "id": "ADR-001",
  "status": "superseded"
}
创建 ADR:
User: Document our decision to use Redis for session storage
使用
manage_adr
:
json
{
  "action": "create",
  "title": "Use Redis for Session Storage",
  "status": "accepted",
  "context": "Need fast, distributed session management",
  "decision": "Adopt Redis with session TTL and clustering",
  "consequences": "Requires Redis infrastructure; enables horizontal scaling"
}
列出 ADR:
User: Show all architecture decisions
json
{
  "action": "list"
}
更新 ADR:
json
{
  "action": "update",
  "id": "ADR-001",
  "status": "superseded"
}

Cross-Service Analysis

跨服务分析

Find HTTP call sites:
User: Show all external API calls
Uses
search_graph
with HTTP edge filters:
json
{
  "edge_types": ["HTTP_CALLS"],
  "labels": ["Function"]
}
Trace cross-service dependencies:
cypher
MATCH (f:Function)-[:HTTP_CALLS]->(r:Route)
RETURN f.name, f.file, r.path, r.method
查找 HTTP 调用点:
User: Show all external API calls
使用带有 HTTP 边筛选条件的
search_graph
:
json
{
  "edge_types": ["HTTP_CALLS"],
  "labels": ["Function"]
}
追踪跨服务依赖:
cypher
MATCH (f:Function)-[:HTTP_CALLS]->(r:Route)
RETURN f.name, f.file, r.path, r.method

Configuration

配置

View Current Config

查看当前配置

bash
codebase-memory-mcp config list
bash
codebase-memory-mcp config list

Key Settings

关键设置

bash
undefined
bash
undefined

Auto-index on session start

Auto-index on session start

codebase-memory-mcp config set auto_index true
codebase-memory-mcp config set auto_index true

File limit for auto-indexing

File limit for auto-indexing

codebase-memory-mcp config set auto_index_limit 50000
codebase-memory-mcp config set auto_index_limit 50000

Enable background file watcher

Enable background file watcher

codebase-memory-mcp config set watch true
codebase-memory-mcp config set watch true

Embedding model (default: nomic-embed-code)

Embedding model (default: nomic-embed-code)

codebase-memory-mcp config set embedding_model nomic-embed-code
codebase-memory-mcp config set embedding_model nomic-embed-code

Graph visualization port

Graph visualization port

codebase-memory-mcp config set ui_port 9749
undefined
codebase-memory-mcp config set ui_port 9749
undefined

Ignore Patterns

忽略规则

Create
.cbmignore
in your repo root (gitignore syntax):
node_modules/
*.test.ts
dist/
build/
*.min.js
vendor/
Default ignores:
node_modules
,
.git
,
dist
,
build
,
vendor
,
.venv
,
__pycache__
在仓库根目录创建
.cbmignore
(使用 gitignore 语法):
node_modules/
*.test.ts
dist/
build/
*.min.js
vendor/
默认忽略:
node_modules
、
.git
、
dist
、
build
、
vendor
、
.venv
、
__pycache__

Advanced Features

高级功能

Graph Visualization UI

图谱可视化 UI

Launch with UI enabled:
bash
codebase-memory-mcp --ui=true --port=9749
Open
http://localhost:9749
for 3D interactive graph exploration.
Features:
  • Force-directed layout with community coloring
  • Filter by label, file, package
  • Click nodes to see properties and edges
  • Multi-galaxy layout for cross-repo graphs
启用 UI 后启动:
bash
codebase-memory-mcp --ui=true --port=9749
打开
http://localhost:9749
,进行 3D 交互式图谱浏览。
功能包括:
  • 采用社区着色的力导向布局
  • 按节点标签、文件和包筛选
  • 点击节点查看属性和边
  • 面向跨仓库图谱的多星系布局

Team-Shared Graph Artifact

团队共享图谱产物

Commit compressed graph to avoid reindexing:
bash
undefined
提交压缩后的图谱,避免重复索引:
bash
undefined

After indexing, compress the graph

After indexing, compress the graph

codebase-memory-mcp export --output=.codebase-memory/graph.db.zst
codebase-memory-mcp export --output=.codebase-memory/graph.db.zst

Commit to repo

Commit to repo

git add .codebase-memory/graph.db.zst git commit -m "Add codebase graph snapshot"

Teammates run:
```bash
codebase-memory-mcp import --input=.codebase-memory/graph.db.zst
git add .codebase-memory/graph.db.zst git commit -m "Add codebase graph snapshot"

团队成员运行:
```bash
codebase-memory-mcp import --input=.codebase-memory/graph.db.zst

CLI Mode

CLI 模式

Use without MCP for scripting:
bash
undefined
无需 MCP 即可编写脚本:
bash
undefined

Search

Search

codebase-memory-mcp cli search_graph '{"name_pattern": ".*Service$", "labels": ["Class"]}'
codebase-memory-mcp cli search_graph '{"name_pattern": ".*Service$", "labels": ["Class"]}'

Cypher query

Cypher query

codebase-memory-mcp cli cypher_query 'MATCH (f:Function) WHERE f.name = "main" RETURN f'
codebase-memory-mcp cli cypher_query 'MATCH (f:Function) WHERE f.name = "main" RETURN f'

Get architecture

Get architecture

codebase-memory-mcp cli get_architecture '{}'
codebase-memory-mcp cli get_architecture '{}'

Semantic search

Semantic search

codebase-memory-mcp cli semantic_query '{"query": "database connection pooling", "limit": 5}'
undefined
codebase-memory-mcp cli semantic_query '{"query": "database connection pooling", "limit": 5}'
undefined

Language-Specific Features

各语言专属功能

Go:
  • Package resolution via
    go.mod
  • Interface implementation detection
  • Struct method resolution
TypeScript/JavaScript:
  • JSX component tracing
  • Type inference from JSDoc
  • Import alias resolution
  • Decorator detection
Python:
  • Class hierarchy via
    INHERITS
  • Decorator-based route detection (Flask, FastAPI)
  • Import resolution via
    pyproject.toml
    ,
    setup.py
C/C++:
  • Header/implementation linking
  • Preprocessor-aware parsing
  • Template instantiation tracking
Go:
  • 通过
    go.mod
    解析包
  • 检测接口实现
  • 解析结构体方法
TypeScript/JavaScript:
  • 追踪 JSX 组件
  • 基于 JSDoc 进行类型推断
  • 解析导入别名
  • 检测装饰器
Python:
  • 通过
    INHERITS
    获取类层次结构
  • 基于装饰器的路由检测(Flask、FastAPI)
  • 通过
    pyproject.toml
    、
    setup.py
    解析导入
C/C++:
  • 关联头文件与实现
  • 感知预处理器的解析
  • 跟踪模板实例化

Infrastructure-as-Code

基础设施即代码

Kubernetes manifests:
User: Show all Kubernetes resources
json
{
  "labels": ["Resource"],
  "properties": {"kind": "Deployment"}
}
Kustomize overlays:
cypher
MATCH (overlay:Module)-[:IMPORTS]->(base:Resource)
WHERE overlay.type = 'kustomize'
RETURN overlay.name, COLLECT(base.name) as resources
Dockerfile analysis:
User: Find all services using Node 18
json
{
  "labels": ["Dockerfile"],
  "code_pattern": "FROM node:18"
}
Kubernetes 清单:
User: Show all Kubernetes resources
json
{
  "labels": ["Resource"],
  "properties": {"kind": "Deployment"}
}
Kustomize 覆盖层:
cypher
MATCH (overlay:Module)-[:IMPORTS]->(base:Resource)
WHERE overlay.type = 'kustomize'
RETURN overlay.name, COLLECT(base.name) as resources
Dockerfile 分析:
User: Find all services using Node 18
json
{
  "labels": ["Dockerfile"],
  "code_pattern": "FROM node:18"
}

Troubleshooting

故障排除

Indexing Issues

索引问题

Large repos timing out:
bash
undefined
大型仓库索引超时:
bash
undefined

Increase memory limit (default: 8GB)

Increase memory limit (default: 8GB)

codebase-memory-mcp config set max_memory_gb 16
codebase-memory-mcp config set max_memory_gb 16

Skip large files

Skip large files

codebase-memory-mcp config set max_file_size_mb 5

**Missing symbols:**
- Check `.cbmignore` — ensure source files aren't excluded
- Verify language support: `codebase-memory-mcp --languages`
- Re-index: `codebase-memory-mcp index --force /path/to/repo`

**Slow queries:**
```bash
codebase-memory-mcp config set max_file_size_mb 5

**符号缺失:**
- 检查 `.cbmignore`,确保源文件未被排除
- 验证语言支持情况:`codebase-memory-mcp --languages`
- 重新索引:`codebase-memory-mcp index --force /path/to/repo`

**查询缓慢:**
```bash

Rebuild indexes

Rebuild indexes

codebase-memory-mcp cli vacuum
codebase-memory-mcp cli vacuum

Check database size

Check database size

ls -lh ~/.cache/codebase-memory-mcp/graph.db
undefined
ls -lh ~/.cache/codebase-memory-mcp/graph.db
undefined

MCP Connection Issues

MCP 连接问题

Agent can't find server:
  1. Verify installation:
    which codebase-memory-mcp
  2. Check agent config:
    codebase-memory-mcp config verify
  3. Restart agent completely
  4. Check logs:
    ~/.cache/codebase-memory-mcp/logs/
Tools not appearing:
bash
undefined
Agent 找不到服务器:
  1. 验证安装:
    which codebase-memory-mcp
  2. 检查 agent 配置:
    codebase-memory-mcp config verify
  3. 完整重启 agent
  4. 查看日志:
    ~/.cache/codebase-memory-mcp/logs/
工具未出现:
bash
undefined

Reinstall agent configs

Reinstall agent configs

codebase-memory-mcp install --force
codebase-memory-mcp install --force

Verify MCP registration

Verify MCP registration

codebase-memory-mcp config show-mcp-config
undefined
codebase-memory-mcp config show-mcp-config
undefined

Performance

性能

High memory usage during indexing:
  • Normal for large repos (Linux kernel uses ~6GB peak)
  • Memory released after indexing completes
  • Use
    --max-memory-gb
    flag to cap usage
Slow semantic search:
bash
undefined
索引期间内存占用过高:
  • 对于大型仓库属于正常现象(Linux 内核峰值约占用 6GB)
  • 索引完成后会释放内存
  • 使用
    --max-memory-gb
    参数限制用量
语义搜索缓慢:
bash
undefined

Rebuild embeddings index

Rebuild embeddings index

codebase-memory-mcp cli rebuild_embeddings
codebase-memory-mcp cli rebuild_embeddings

Reduce result limit

Reduce result limit

codebase-memory-mcp config set semantic_limit 10
undefined
codebase-memory-mcp config set semantic_limit 10
undefined

File Watcher

文件监视器

Changes not detected:
bash
undefined
未检测到更改:
bash
undefined

Check watcher status

Check watcher status

codebase-memory-mcp status
codebase-memory-mcp status

Restart watcher

Restart watcher

codebase-memory-mcp watch restart
codebase-memory-mcp watch restart

Increase file watch limit (Linux)

Increase file watch limit (Linux)

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf sudo sysctl -p
undefined
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf sudo sysctl -p
undefined

Common Workflows

常见工作流

Onboarding to New Codebase

熟悉新代码库

1. "Index this project"
2. "Show me the architecture"
3. "What are the entry points?"
4. "Find the main HTTP routes"
5. "Show me the most important functions" (hotspots)
1. "Index this project"
2. "Show me the architecture"
3. "What are the entry points?"
4. "Find the main HTTP routes"
5. "Show me the most important functions" (hotspots)

Refactoring

重构

1. "Find all callers of [function]"
2. "What's affected by my changes?" (after editing)
3. "Show me the call chain from [entry] to [target]"
4. "Find dead code"
1. "Find all callers of [function]"
2. "What's affected by my changes?" (after editing)
3. "Show me the call chain from [entry] to [target]"
4. "Find dead code"

Debugging

调试

1. "Trace execution from [function]"
2. "What calls this endpoint?" (for HTTP routes)
3. "Find similar functions to [name]"
4. "Show data flow through [function]"
1. "Trace execution from [function]"
2. "What calls this endpoint?" (for HTTP routes)
3. "Find similar functions to [name]"
4. "Show data flow through [function]"

Cross-Service Analysis

跨服务分析

1. "Find all external API calls"
2. "Show services that depend on [service]"
3. "Map HTTP routes to implementations"
4. "Find pub-sub channels across repos"
1. "Find all external API calls"
2. "Show services that depend on [service]"
3. "Map HTTP routes to implementations"
4. "Find pub-sub channels across repos"

MCP Tools Reference

MCP 工具参考

ToolPurpose
index_repository
Index codebase into knowledge graph
search_graph
Structural search by pattern, label, degree
search_code
Graph-augmented grep
semantic_query
Vector search with bundled embeddings
get_architecture
Full architectural summary
get_callers
Find all callers of a symbol
trace_symbol
Trace call chains (in/out)
cypher_query
Advanced graph queries
find_dead_code
Detect unused functions
detect_changes
Git diff impact analysis
manage_adr
Architecture Decision Records
get_context
Context for specific symbols
list_routes
All HTTP/gRPC/GraphQL routes
analyze_dependencies
Cross-service dependency graph
工具用途
index_repository
将代码库索引到知识图谱
search_graph
按模式、标签和度数进行结构化搜索
search_code
图谱增强的 grep
semantic_query
使用内置 embeddings 进行向量搜索
get_architecture
获取完整的架构摘要
get_callers
查找符号的所有调用方
trace_symbol
追踪调用链(入向/出向)
cypher_query
执行高级图查询
find_dead_code
检测未使用的函数
detect_changes
Git diff 影响分析
manage_adr
管理架构决策记录
get_context
获取特定符号的上下文
list_routes
列出所有 HTTP/gRPC/GraphQL 路由
analyze_dependencies
构建跨服务依赖图

Updates

更新

bash
undefined
bash
undefined

Check for updates

Check for updates

codebase-memory-mcp update
codebase-memory-mcp update

Auto-update check on startup (default: enabled)

Auto-update check on startup (default: enabled)

codebase-memory-mcp config set check_updates true

The server notifies on first tool call if a new release is available.
codebase-memory-mcp config set check_updates true

如果有新版本可用,服务器会在首次调用工具时发出通知。

Uninstall

卸载

bash
undefined
bash
undefined

Remove all agent configs and binary

Remove all agent configs and binary

codebase-memory-mcp uninstall
codebase-memory-mcp uninstall

Keep database (default)

Keep database (default)

Or remove database too:

Or remove database too:

rm -rf ~/.cache/codebase-memory-mcp/
undefined
rm -rf ~/.cache/codebase-memory-mcp/
undefined