codebase-memory-mcp gives Claude Code a queryable index of your repositories. Once a project is indexed, you can ask about call chains, dependencies, dead code, or overall architecture and have the assistant query that graph instead of crawling files with find and grep. Installation takes one command. The step that trips people up is the restart at the end.
Install (macOS and Linux)
curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash
For the build with the visual UI:
curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash -s -- --ui
The installer leaves three things behind:
- the binary at
~/.local/bin/codebase-memory-mcp - Claude configuration, written into
~/.claude.jsonautomatically - an index cache in
~/.cache/codebase-memory-mcp/
Check that it worked
Run all three:
which codebase-memory-mcp
codebase-memory-mcp --version
claude mcp list | grep codebase-memory-mcp
You're set if the path prints, the version is 0.6.x, and claude mcp list reports connected ✓.
Restart Claude Code now. The server is registered at startup, and an existing session won't see it.
Getting Claude to call it
Claude will call codebase-memory on its own when you ask things like:
- explore the codebase or explain the architecture
- list the functions or show me the structure
- who calls this function, or trace the call chain
- dependency analysis and impact of a change
- dead code and unused functions
- give me an architecture overview
If it doesn't trigger, be explicit. These phrasings are the most reliable:
Use codebase memory to index this project
Use codebase memory to analyze the call chain
Core CLI commands
Index the current directory:
codebase-memory-mcp cli index_repository '{"repo_path":"'$(pwd)'"}'
List indexed projects:
codebase-memory-mcp cli list_projects '{}'
Search for functions or classes by name pattern:
codebase-memory-mcp cli search_graph '{"name_pattern":".*Handler.*","label":"Function"}'
Trace a function's calls in both directions — the placeholder in quotes is the function name:
codebase-memory-mcp cli trace_path '{"function_name":"你的函数名","direction":"both"}'
Get an architecture view for a project — the quoted placeholder is the project name:
codebase-memory-mcp cli get_architecture '{"project":"项目名"}'
Indexing several Git repositories at once
Save this as cbm-index.sh:
#!/usr/bin/env bash
set -euo pipefail
for parent in "$@"; do
for repo in "$parent"/*/; do
repo="${repo%/}"
if [ -d "$repo/.git" ]; then
echo "索引:$repo"
codebase-memory-mcp cli index_repository "$(printf '{"repo_path":"%s"}' "$repo")"
fi
done
done
echo "已索引项目:"
codebase-memory-mcp cli list_projects '{}'
Make it executable, then point it at a directory that holds your repositories:
chmod +x cbm-index.sh
./cbm-index.sh ~/Workspaces
Removing indexes and data
List what's indexed:
codebase-memory-mcp cli list_projects '{}'
Delete a single project:
codebase-memory-mcp cli delete_project '{"project":"项目全名"}'
The quoted placeholder is the full project name as returned by list_projects.
Wipe the entire cache:
rm -rf ~/.cache/codebase-memory-mcp
Turn off automatic indexing:
codebase-memory-mcp config set auto_index false
Uninstall
codebase-memory-mcp uninstall
rm -f ~/.local/bin/codebase-memory-mcp
rm -rf ~/.cache/codebase-memory-mcp
Restart Claude Code afterward.
Quick fixes
Claude keeps falling back to find and grep. Restart Claude Code and say "Use codebase memory" explicitly.
command not found. Add the install directory to your PATH:
export PATH="$HOME/.local/bin:$PATH"
project not found. Re-index the current directory:
codebase-memory-mcp cli index_repository '{"repo_path":"'$(pwd)'"}'
Several projects were merged into one index. Index each Git repository separately. Pointing the tool at a parent directory that contains multiple repositories will combine them.
Visual UI
If you installed with --ui, open http://localhost:9749. The interface shows a 3D code knowledge graph, function call relationships, class dependencies, and module architecture.