Skip to main content

Documentation 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 doesn’t read your code like a file browser — it builds a persistent knowledge graph where every function, class, route, and package is a node and every relationship between them is a typed edge. When your agent asks “who calls ProcessOrder?” or “which services call this HTTP route?”, it gets a sub-millisecond graph traversal rather than a full-text grep. This graph is stored in a SQLite database, survives restarts, and can be queried with a Cypher-like syntax or surfaced through the 14 dedicated MCP tools.

Node Labels

Every entity in your codebase maps to a node with one of thirteen labels. The label determines what properties the node carries and which edge types can connect to it.
LabelRepresents
ProjectThe root node for an indexed repository. All other nodes for that repo descend from it.
PackageA language-level package or module group — github.com/foo/bar, @myorg/pkg, a Python package directory.
FolderA filesystem directory within the project. Used to reconstruct the tree structure.
FileA single source file. Carries language, path, and temporal metadata (change count, last modified).
ModuleA logical compilation or import unit — a Python module, a Go package file, a Kustomize overlay.
ClassA class, struct, or record definition.
FunctionA standalone function or free function.
MethodA method belonging to a class or interface.
InterfaceAn interface, abstract class, protocol, or trait definition.
EnumAn enumeration type.
TypeA type alias, typedef, generic type parameter, or named type.
RouteA REST, gRPC, GraphQL, or tRPC endpoint. Routes are first-class entities — they connect HTTP call sites to handler functions across services.
ResourceA Kubernetes resource kind (Deployment, Service, ConfigMap, etc.) or other infrastructure resource indexed from manifests.
The Route node is automatically created when the pipeline detects HTTP call sites or framework route declarations (Express, FastAPI, Gin, etc.). You can query all routes in a project with MATCH (r:Route) RETURN r.name, r.method, r.url_path.

Edge Types

Edges encode the relationships between nodes. Every edge has a type, a direction (from → to), and an optional properties bag (confidence score, argument expressions, URL path, etc.).

Structural edges

These edges form the containment hierarchy of your project.
EdgeFrom → ToMeaning
CONTAINS_PACKAGEProject → PackageThe project contains this package.
CONTAINS_FOLDERProject / Folder → FolderFolder nesting.
CONTAINS_FILEProject / Folder → FileA file lives in a folder.
DEFINESFile / Module → Class / Function / Interface / Enum / TypeThe file declares this symbol.
DEFINES_METHODClass / Interface → MethodThe class owns this method.
MEMBER_OFType / Enum → ClassA field, enum variant, or nested type belongs to a class.

Semantic edges

These edges capture language-level relationships between symbols.
EdgeFrom → ToMeaning
CALLSFunction / Method → Function / MethodA direct function or method call. Confidence-scored; Hybrid LSP refines these.
IMPORTSFile / Module → File / Module / PackageAn import or use declaration.
IMPLEMENTSClass → InterfaceA class implements an interface or satisfies a Go interface implicitly.
INHERITSClass → ClassClass inheritance (extends, : Base, etc.).
USES_TYPEFunction / Method → Class / Type / InterfaceA symbol references a type (parameter, return type, field).
USAGEFunction / Method → Function / Method / ClassA usage reference that is not a direct call (e.g. passing a function as a value).

Call and data-flow edges

EdgeFrom → ToMeaning
HTTP_CALLSFunction / Method → RouteAn HTTP client call targeting a Route node. Confidence-scored with method + path matching.
ASYNC_CALLSFunction / Method → RouteAn async or message-queue dispatch (Kafka topic publish, SQS send, etc.).
EMITSFunction / Method → RouteEmits a Socket.IO, EventEmitter, or pub-sub event.
LISTENS_ONFunction / Method → RouteSubscribes to a channel, topic, or event.
DATA_FLOWSFunction → FunctionData flows from one function into another, with argument-to-parameter mapping and field access chains.
HANDLESRoute → Function / MethodA Route node is handled by this function.

Infrastructure and config edges

EdgeFrom → ToMeaning
CONFIGURESFile → Function / Class / ModuleA configuration file (.env, pyproject.toml, application.yaml) influences a symbol.
WRITESFunction / Method → File / ResourceA function writes to a file or infrastructure resource.
TESTSFunction / Method → Function / Method / ClassA test function exercises the target symbol.

Similarity and semantic-relatedness edges

EdgeMeaning
SIMILAR_TOMinHash + LSH near-clone detection across files, Jaccard-scored. Added in FULL and MODERATE index modes.
SEMANTICALLY_RELATEDVocabulary-mismatch detection via algorithmic embeddings — same language, score ≥ 0.80. Pairs functions that do related things under different names.

File co-change edge

EdgeMeaning
FILE_CHANGES_WITHTwo files that frequently change together in git commits. Score reflects coupling strength and recency. Useful for blast-radius and risk analysis.

Cross-repo edges

When multiple repositories are indexed into the same store, the cross-repo pass creates CROSS_* variants that link nodes across project boundaries:
EdgeMeaning
CROSS_HTTP_CALLSAn HTTP call site in one service calls a route in another indexed service.
CROSS_ASYNC_CALLSAsync/message dispatch from one project into a handler in another.
CROSS_CHANNELA pub-sub channel (EMITS / LISTENS_ON) that crosses service boundaries.
CROSS_GRPC_CALLSA gRPC stub call resolved to a protobuf route in another project.
CROSS_GRAPHQL_CALLSA GraphQL operation resolved to a resolver in another project.
CROSS_TRPC_CALLSA tRPC procedure call resolved across project boundaries.
CROSS_* edges are bidirectional — both the calling service and the receiving service get the edge. Use trace_path with mode: "cross_service" to traverse them automatically.

Qualified Names

Every node in the graph has a qualified name (QN) that uniquely identifies it. Qualified names follow the pattern:
<project>.<path_parts>.<symbol_name>
For a function process_order in src/orders/handler.py of a project named my-api:
my-api.src.orders.handler.process_order
Path separators (/) become dots. File extensions are stripped. Python __init__ and JavaScript index stems are dropped so that src/orders/__init__.py maps to my-api.src.orders — consistent with how imports work in each language.

Discovering qualified names

The easiest way to find exact QNs is with search_graph:
codebase-memory-mcp cli search_graph '{"name_pattern": ".*process_order.*"}'
Or in an agent:
search_graph(name_pattern=".*ProcessOrder.*", label="Function")
The returned qualified_name field is what get_code_snippet and trace_path expect. Never guess a QN — always discover it first.

Example Queries

The query_graph tool accepts a read-only openCypher subset. Here are patterns that demonstrate the kinds of structural questions the graph can answer.

Call chain traversal

Find everything that ProcessOrder calls, up to 3 hops deep:
MATCH (f:Function)-[:CALLS*1..3]->(g)
WHERE f.name = 'ProcessOrder'
RETURN g.name, g.qualified_name, labels(g)
Or use the dedicated tool, which handles import-aware traversal automatically:
codebase-memory-mcp cli trace_path '{"function_name": "ProcessOrder", "direction": "outbound", "depth": 3}'

Dead code detection

Find functions with no callers that are also not entry points:
MATCH (f:Function)
WHERE NOT EXISTS { (f)<-[:CALLS]-() }
  AND NOT f.name IN ['main', 'handler', 'run']
RETURN f.name, f.file_path
ORDER BY f.name
LIMIT 50
Find all outbound HTTP calls and the routes they target in other services:
MATCH (caller)-[:HTTP_CALLS|CROSS_HTTP_CALLS]->(route:Route)
RETURN caller.name, caller.project, route.url_path, route.method, route.project
ORDER BY route.url_path

Inheritance hierarchy traversal

Find all classes that directly or transitively inherit from BaseHandler:
MATCH (child:Class)-[:INHERITS*1..5]->(parent:Class)
WHERE parent.name = 'BaseHandler'
RETURN child.name, child.qualified_name
ORDER BY child.name

Interface implementors

Find every class that implements IUserRepository:
MATCH (c:Class)-[:IMPLEMENTS]->(i:Interface)
WHERE i.name = 'IUserRepository'
RETURN c.name, c.file_path

Persistence

The knowledge graph is stored in SQLite databases at ~/.cache/codebase-memory-mcp/. The store uses WAL (Write-Ahead Logging) mode and is ACID-safe — an interrupted index never corrupts an existing graph. A plausibility gate (CBM_DUMP_VERIFY_MIN_RATIO) checks that the persisted node count is within a configured fraction of the in-memory count before reporting success; if the ratio falls below the threshold, index_repository returns status: "degraded" rather than silently accepting a partial write. To override the storage location:
export CBM_CACHE_DIR=~/my-projects/cbm-data
To reset all indexes:
rm -rf ~/.cache/codebase-memory-mcp/

Team Sharing

You can commit a compressed snapshot of the knowledge graph so teammates skip the initial reindex. When you index a project, Codebase Memory MCP can write .codebase-memory/graph.db.zst — a zstd-compressed SQLite dump — alongside your source. When a teammate clones the repo and runs the tool for the first time, the artifact is decompressed and incremental indexing fills in only the diff. See the Team Shared Graph guide for export options, the two-tier compression strategy (best vs. fast), merge conflict avoidance via .gitattributes, and how to opt out entirely.

Build docs developers (and LLMs) love