# Use Cases for DeusData codebase-memory-mcp: 13 Ways to Query Your Repository Like a Database

> Explore your codebase like a database with DeusData codebase-memory-mcp. Discover 13 use cases like call-graph tracing and semantic search running locally with this zero-dependency tool.

- Repository: [Martin Vogel/codebase-memory-mcp](https://github.com/DeusData/codebase-memory-mcp)
- Tags: use-cases
- Published: 2026-07-19

---

**DeusData codebase-memory-mcp enables AI agents and developers to explore complex codebases through a persistent knowledge graph, supporting use cases from call-graph tracing and impact analysis to semantic search and dead-code detection—all running locally as a zero-dependency static binary.**

This open-source engine transforms any repository into a queryable graph database using tree-sitter parsing and a Hybrid LSP resolver. Because it operates as a stand-alone MCP (Model Context Protocol) server, agents like Claude Code, Codex CLI, and Gemini CLI can retrieve structural code intelligence without external APIs or sending source code to third-party services.

## Core Architecture and Capabilities

The binary packages **158 vendored tree-sitter grammars** and a **Hybrid LSP layer** for 11 languages (Python, TypeScript/JavaScript/JSX/TSX, PHP, C#, Go, C, C++, Java, Kotlin, Rust) into a single static executable. According to the source in [`src/main.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/main.c), the tool exposes fourteen MCP tools implemented in [`src/mcp/mcp.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/mcp/mcp.c), ranging from `index_repository` to `query_graph`.

At its heart, the engine builds an in-memory SQLite graph database that persists as a compressed `.codebase-memory/graph.db.zst` file. The pipeline in [`src/pipeline/pipeline.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/pipeline/pipeline.c) orchestrates multi-pass indexing: parsing files, resolving imports via the Hybrid LSP, constructing nodes and edges, and enriching the graph with git metadata, route detection, and semantic embeddings.

## Detailed Use Cases

### Full-Repository Indexing and Knowledge Graph Construction

The foundational use case involves parsing every file in a repository to build a navigable graph. The `index_repository` tool triggers the pipeline in [`src/pipeline/pipeline.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/pipeline/pipeline.c), which processes source files through specialized passes (`pass_*`) and stores entities like `Function`, `Class`, `Variable`, and `Route` nodes with `CALLS`, `IMPORTS`, and `CONTAINS` edges.

Run this to index a project:

```bash
codebase-memory-mcp index_repository '{"repo_path":"/path/to/project"}'

```

This creates a compressed database in `~/.cache/codebase-memory-mcp/` and enables all subsequent query use cases.

### Structural Search with Regex and Label Filtering

Once indexed, use `search_graph` (implemented in [`src/mcp/mcp.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/mcp/mcp.c)) to locate symbols by type, name patterns, or file scope. This supports pagination and degree-based filtering for precise targeting.

Find HTTP route handlers matching a pattern:

```bash
codebase-memory-mcp search_graph '{"label":"Route","name_pattern":"^/api/.*"}'

```

### Call-Graph Tracing and Dependency Analysis

Understanding execution flow requires traversing `CALLS` edges. The `trace_path` tool performs breadth-first traversal from any function, supporting `inbound`, `outbound`, or `both` directions up to configurable depths.

Trace a function's complete call chain:

```bash
codebase-memory-mcp trace_path '{"function_name":"ProcessOrder","direction":"both","max_depth":5}'

```

### Impact Analysis via Git Integration

When reviewing pull requests or commits, map changed files to affected symbols. The `detect_changes` tool leverages [`src/pipeline/pass_gitdiff.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/pipeline/pass_gitdiff.c) to compare `git diff` output against the graph, classifying risk and identifying "hot" nodes that require careful review.

Analyze impact between commits:

```bash
codebase-memory-mcp detect_changes '{"git_ref":"HEAD~1"}'

```

### Advanced Graph Queries with OpenCypher

For complex analytical questions, the `query_graph` tool exposes a read-only OpenCypher implementation in [`src/cypher/cypher.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/cypher/cypher.c). This allows pattern matching, aggregation, and arbitrary graph traversals without hard-coding specific tool logic.

Find functions that call a specific service:

```bash
codebase-memory-mcp query_graph '{"query":"MATCH (f:Function)-[:CALLS]->(g) WHERE g.name CONTAINS \"Database\" RETURN f.name, f.file_path"}'

```

### Semantic Code Search with Local Embeddings

Unlike tools requiring OpenAI or Claude API calls for semantic search, [`src/semantic/semantic.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/semantic/semantic.c) implements vector search using bundled Nomic embeddings. The `semantic_query` tool finds conceptually similar code based on natural language descriptions.

Search for pagination logic without knowing exact function names:

```bash
codebase-memory-mcp semantic_query '{"query":"paginate items from database"}'

```

### Cross-Service and API Relationship Mapping

Modern microservices communicate via HTTP, gRPC, GraphQL, and tRPC. The pipeline's [`pass_route_nodes.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/pass_route_nodes.c) detects these boundaries and creates `HTTP_CALLS` and `ASYNC_CALLS` edges, enabling service mesh visualization and API dependency tracking.

Query all service entry points:

```bash
codebase-memory-mcp search_graph '{"label":"Route"}'

```

Then use `trace_path` on results to map client call-sites.

### Dead-Code Detection and Cleanup

Identify unused symbols by querying for nodes with zero incoming `CALLS` edges, excluding known entry points. The `search_graph` tool accepts `degree_min` and `degree_max` parameters for this analysis.

Find potentially dead functions:

```bash
codebase-memory-mcp search_graph '{"label":"Function","degree_min":0}'

```

### Architecture Documentation and ADRs

Maintain living documentation within the graph itself using the `manage_adr` tool. This CRUD interface for Architecture Decision Records creates persistent nodes linked to relevant code entities, ensuring documentation stays synchronized with implementation.

List existing ADRs:

```bash
codebase-memory-mcp manage_adr '{"action":"list"}'

```

### Real-Time Visualization and Exploration

For ad-hoc exploration and presentations, [`src/ui/httpd.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/ui/httpd.c) launches a lightweight HTTP server serving a WebGL-based 3D interface. The [`src/ui/layout3d.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/ui/layout3d.c) module handles force-directed graph layouts in the browser.

Launch the visualization UI:

```bash
codebase-memory-mcp --ui=true --port=9749

```

Then navigate to `http://localhost:9749` to explore the graph interactively.

### Incremental Maintenance and Auto-Indexing

Keep the knowledge graph synchronized with [`src/watcher/watcher.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/watcher/watcher.c), which implements a git-aware file watcher. When `auto_index` is enabled, the watcher detects changes and triggers incremental re-indexing of only modified files.

Enable automatic background indexing:

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

```

### Multi-Repository Federation

For organizations with multiple services, [`src/store/store.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/store/store.c) supports storing separate project graphs in the same cache directory. Cross-repo references generate `CROSS_*` edges, enabling queries that span service boundaries while maintaining project isolation using the `project` parameter.

## Practical Implementation Examples

Install the binary with the official installer script:

```bash
curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash

```

Inspect the graph schema before crafting queries:

```bash
codebase-memory-mcp get_graph_schema '{}'

```

Install MCP configuration for your preferred agent:

```bash
codebase-memory-mcp install

```

## Why Local Execution Matters

Because **DeusData codebase-memory-mcp** is pure C with zero dependencies, it eliminates network latency and token costs associated with brute-force repository analysis. Structural queries consume thousands of tokens versus hundreds of thousands when agents grep every file. The engine runs offline, ensuring proprietary code never leaves your machine—a critical requirement for financial and healthcare industries.

## Summary

- **DeusData codebase-memory-mcp** transforms repositories into queryable knowledge graphs using local tree-sitter parsing and Hybrid LSP resolution.
- Key use cases include **structural search**, **call-graph tracing**, **impact analysis via git diff**, **OpenCypher graph queries**, and **semantic code search** using bundled embeddings.
- The engine supports **dead-code detection**, **cross-service API mapping**, **ADR management**, and **3D visualization** through tools implemented in [`src/mcp/mcp.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/mcp/mcp.c) and [`src/ui/httpd.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/ui/httpd.c).
- **Incremental indexing** via [`src/watcher/watcher.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/watcher/watcher.c) maintains freshness without full re-scans, while **multi-repo federation** enables enterprise-scale code intelligence.
- All capabilities run as a **static binary** requiring no Docker, API keys, or external services, making it agent-agnostic and secure for sensitive codebases.

## Frequently Asked Questions

### What makes DeusData codebase-memory-mcp different from other code intelligence tools?

Unlike cloud-based solutions or language-specific IDEs, this tool operates as a **zero-dependency static binary** that persists code relationships in a local SQLite graph database. It combines tree-sitter parsing with a Hybrid LSP for 11 languages while supporting open-ended Cypher queries, all without requiring network access or API keys. According to the source in [`src/store/store.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/store/store.c), the graph persists across sessions, enabling incremental updates rather than repeated full-repository analysis.

### Which programming languages does the Hybrid LSP support?

The Hybrid LSP resolver supports **11 languages**: Python, TypeScript, JavaScript, JSX, TSX, PHP, C#, Go, C, C++, Java, Kotlin, and Rust. These are implemented alongside **158 vendored tree-sitter grammars** that handle the initial AST parsing before the LSP layer resolves imports and type relationships.

### How does the semantic search work without external API calls?

The semantic search implementation in [`src/semantic/semantic.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/semantic/semantic.c) uses **bundled Nomic embeddings** that run entirely locally. When you invoke `semantic_query`, the engine converts your natural language query into a vector and performs similarity search against pre-computed embeddings stored in the graph, requiring no connection to OpenAI, Claude, or other external embedding services.

### Can I use this with any AI agent or IDE?

Yes. Because the tool exposes capabilities via the **Model Context Protocol (MCP)**, any agent supporting MCP—including Claude Code, Codex CLI, Gemini CLI, Zed, VS Code, and OpenCode—can invoke the tools. The `install` command auto-detects installed agents and configures JSON-RPC communication, while the underlying binary can also be used directly from the command line for CI/CD pipelines or manual exploration.