Codebase Memory MCP exposes 14 MCP tools over JSON-RPC 2.0 that let AI coding agents explore, query, and reason about any codebase without reading source files line-by-line. Tools are invoked automatically by your agent (Claude Code, Codex CLI, Zed, and others), or directly from the command line withDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/DeusData/codebase-memory-mcp/llms.txt
Use this file to discover all available pages before exploring further.
codebase-memory-mcp cli <tool_name> '<json_args>'. Every tool accepts a project parameter that scopes results to a single indexed repo; use list_projects to discover available project names.
Indexing Tools
index_repository
Index a repository into the persistent knowledge graph. The auto-sync watcher keeps the graph fresh after the initial index by detecting file changes in the background.
Absolute path to the repository to index. Relative paths are not supported — always pass a fully-qualified path.
Indexing depth. One of
full (default) | moderate | fast | cross-repo-intelligence. All modes run type-aware Hybrid LSP call/usage resolution. full adds similarity and semantic edges. fast skips similarity/semantic for faster re-indexing. cross-repo-intelligence skips extraction and only matches Routes/Channels across projects to create CROSS_HTTP_CALLS / CROSS_ASYNC_CALLS / CROSS_CHANNEL edges.Override the auto-derived project name. Non-ASCII bytes are encoded and unsafe path characters are normalized.
For
cross-repo-intelligence mode: list of project names to link against. Pass ["*"] to target all indexed projects.When
true, writes a compressed snapshot to .codebase-memory/graph.db.zst so teammates can bootstrap from the artifact instead of re-indexing from scratch. Defaults to false.list_projects
List all indexed projects with their node and edge counts, languages detected, and last-indexed timestamp. Takes no parameters. Run this to discover exact project names before passing them to other tools.
delete_project
Remove a project and all its graph data from the store. This erases the SQLite database file for the project — the operation is irreversible.
The project name to delete. Use
list_projects to find the exact name.index_status
Check the current indexing status of a project — whether it is indexed, degraded, empty, or not found. Useful for confirming that a background re-index has completed.
Project name to check. Use
list_projects to find available names.Querying Tools
search_graph
Structured search across the knowledge graph by label, name pattern, file scope, or degree. Supports three independent search modes that can be combined in a single call:
query— BM25 ranked full-text search with camelCase/snake_case splitting and structural label boosting (Functions/Methods +10, Routes +8, Classes/Interfaces +5).name_pattern— Regex match against symbol names (SQLLIKEpre-filtering for speed).semantic_query— Vector cosine search using bundled Nomic embeddings; bridges vocabulary gaps (findspublishwhen you searchsend). Requiresfullormoderateindex mode.
limit / offset. The response always includes total (full match count before the limit) and has_more (true when more pages are available).
Project name to search within.
Natural-language or keyword full-text search. When provided,
name_pattern is ignored.Regex pattern matched against symbol names (e.g.
.*Handler.*).Filter by node label:
Function, Method, Class, Interface, Route, Enum, Type, File, Module, Package, Folder, Resource.Glob pattern scoping results to matching file paths (e.g.
*.go, src/api/**).Minimum total edge degree (in + out). Useful for finding well-connected hotspots.
Maximum total edge degree. Useful for dead-code detection alongside
NOT EXISTS Cypher.Array of keyword strings for vector search (e.g.
["send", "pubsub", "publish"]). Must be an array, not a single string. Results appear in the semantic_results field.Maximum results per call. Default 200.
Regex pattern matched against the fully-qualified symbol name (e.g.
myapp\.src\.handlers\..*). Useful for scoping to a specific package or path within the graph.Edge type to use when fetching connected nodes (used with
include_connected). Must be uppercase letters and underscores, e.g. CALLS, IMPORTS.Skip the first N matching nodes. Combine with
limit to paginate: increment offset by limit and re-call while has_more is true.Exclude entry-point nodes (e.g.
main functions) from results.Include connected node metadata in results.
trace_path
BFS traversal through the call graph: who calls a function (inbound), what it calls (outbound), or both. Depth 1–5. Also available as trace_call_path (alias).
Supports three trace modes:
calls(default) — followsCALLSedgesdata_flow— followsCALLS+DATA_FLOWSedges with argument expressions at each hopcross_service— followsHTTP_CALLS+ASYNC_CALLS+DATA_FLOWSthrough Route nodes, plusCROSS_*edges to hop across services
Name (or qualified name) of the function to trace. Use
search_graph first if unsure of the exact name.Project to trace within.
inbound (callers), outbound (callees), or both. Default: both.BFS depth, 1–5. Default: 3.
Trace mode:
calls, data_flow, or cross_service. Default: calls.For
data_flow mode only: scope the trace to a specific parameter name, following only paths where that parameter is passed.Array of edge type strings to follow during traversal (e.g.
["CALLS", "ASYNC_CALLS"]). Overrides the default edge set for the selected mode.Add risk classification (
CRITICAL / HIGH / MEDIUM / LOW) based on hop distance. Default: false.Include test files in results. When
false (default), test files are filtered out.detect_changes
Map uncommitted git changes to affected symbols with blast-radius analysis and risk classification. Identifies which functions, classes, and routes are touched by the current diff and ranks them by impact.
Project to analyze.
Optional directory prefix to narrow analysis scope.
BFS depth for blast-radius propagation. Default: 2.
Git branch to diff against. Default:
main.Git ref or tag to compare from (e.g.
HEAD~5, v0.5.0). Diffs <ref>...HEAD. Use this to scope analysis to changes since a specific commit or release.query_graph
Execute a read-only openCypher query against the knowledge graph for complex multi-hop patterns, aggregations, and cross-service analysis. The full supported subset is documented in Cypher Queries.
Every Function and Method node carries queryable complexity properties: cyclomatic, cognitive, loop_count, loop_depth, transitive_loop_depth, linear_scan_in_loop, alloc_in_loop, recursion_in_loop, unguarded_recursion, param_count, max_access_depth.
A read-only openCypher query string.
Project to query against.
Optional row limit. Default: unlimited up to a 100k row ceiling. No offset support — use
search_graph for paginated browsing.get_graph_schema
Return the schema of the knowledge graph for a project: node labels with property definitions, edge types with relationship patterns, and total node/edge counts. Always run this first when starting to explore a new project.
Project to inspect.
get_code_snippet
Read the source code for a function, class, or symbol by its qualified name. This is a read tool, not a search tool — it requires an exact qualified_name. Use search_graph first to discover the qualified name, then pass it here.
Full qualified name from
search_graph (e.g. myapp.src.handlers.ProcessOrder), or a short function name that returns suggestions when ambiguous.Project the symbol belongs to.
Include neighboring nodes (callers/callees) alongside the snippet. Default:
false.get_architecture
Return a high-level architecture overview of the project: detected languages, packages, entry points, HTTP routes, hotspots (most-called functions), community clusters (Leiden algorithm over the call graph), dependency boundaries, and ADR summary — all in a single call.
The clusters field surfaces the de-facto architectural modules, which often cut across folder layout. Each cluster includes a label, member count, cohesion score, representative top nodes, and the packages and edge types that bind it.
Project to summarize.
Optional directory prefix to scope architecture analysis to a sub-tree (e.g.
apps/api).Optional array of aspect names to include (e.g.
["clusters", "routes", "hotspots"]). Pass ["all"] for everything.search_code
Graph-augmented grep — finds text patterns in indexed source files, then enriches results with graph context (callers, callees, related nodes). Faster than raw grep because it searches only files known to the index.
Text or regex pattern to search for (grep syntax).
Project to search within.
Glob for
grep --include to restrict file types (e.g. *.go, *.ts).Regex to restrict results to specific file paths.
Output format:
compact (default), full, or files (just file paths).Enable extended regex mode for the pattern (like
grep -E). Default: false (fixed-string match).Lines of context around each match (like
grep -C). Only used in compact mode.Max enriched results per call. Default: 10.
manage_adr
CRUD interface for Architecture Decision Records (ADRs). ADRs persist structured architectural notes across agent sessions so context is never lost.
Project the ADR belongs to.
Operation:
get (read current ADR), update (create or overwrite), sections (list markdown headers from the ADR).Markdown content for
update mode.Array of section header strings to include or filter on.
ingest_traces
Ingest runtime traces to validate and enrich HTTP_CALLS edges in the graph. Allows correlating static analysis with observed runtime behavior — edges that appear in traces are promoted to higher confidence.
Array of trace objects. Each object should describe an observed HTTP call with source, destination, and method fields.
Project to ingest traces into.
CLI Quick Reference
Every tool can be called from the command line. Use--raw to pipe output to jq: