A production-grade Python library for RAG on local codebases with multi-provider AI support and MCP (Model Context Protocol) server integration
Project description
DeepRepo Core
A production-grade Python library for RAG on local codebases — code knowledge graph, hierarchical wiki engine, smart query routing, and branch isolation.
See the main README.md for complete documentation.
Quick Install
pip install deeprepo
# With MCP server support
pip install deeprepo[mcp]
Quick Start (CLI)
# Ingest current directory (Ollama, free and local)
deeprepo ingest .
# Browse the auto-generated wiki with in-page chat
deeprepo serve # → http://localhost:8080
# Ask questions directly
deeprepo query "how does authentication work?"
deeprepo query "what breaks if I change router.py?"
Quick Start (Python API)
from deeprepo import DeepRepoClient
# Initialize (defaults to Ollama if running, else OpenAI)
client = DeepRepoClient(provider_name="ollama")
# Ingest your code (incremental — unchanged files are skipped)
result = client.ingest("/path/to/your/code")
print(f"Indexed {result['files_scanned']} files, {result['wiki_generated']} wiki pages")
# Query with smart routing
response = client.query("How does authentication work?")
print(response['answer'])
print(f"Intent: {response['intent']}, Strategy: {response['strategy']}")
print(f"Sources: {response['sources']}") # list of file paths
# Browse the wiki
print(f"Wiki at: {client.get_wiki_dir()}")
CLI Commands
| Command | Description |
|---|---|
deeprepo init |
Detect provider setup, print the ingest command |
deeprepo ingest [PATH] |
Build graph + wiki + embeddings |
deeprepo wiki [PATH] |
Regenerate wiki pages only |
deeprepo serve |
Launch wiki viewer + chat at port 8080 |
deeprepo query "…" |
Ask a question, get an AI answer |
deeprepo status |
Show branch isolation & cache freshness |
What's Inside
| Module | Purpose |
|---|---|
client.py |
Main facade — branch isolation, freshness, provider wiring |
graph.py |
SQLite store: graph nodes/edges, embeddings, wiki index, state |
graph_builder.py |
Tree-sitter AST parser → code knowledge graph |
wiki.py |
Hierarchical wiki engine — bottom-up LLM synthesis |
router.py |
Intent classifier + 6 context strategy selectors |
ingestion.py |
File scanner, chunker, language detection |
ui.py |
Wiki viewer (HTTP + mermaid renderer + chat) |
mcp/server.py |
7 focused MCP tools for AI assistants |
MCP Tools (7 tools)
Connect to Cursor / Claude Desktop as an MCP server:
deeprepo-mcp # starts the MCP server on stdio
| Tool | Purpose |
|---|---|
ingest_codebase |
Index a repo directory |
find_symbol |
Locate a class/function (~50 tokens) |
get_file_structure |
File API without reading source (~150 tokens) |
explain_file |
Plain-English file explanation (~300 tokens) |
find_change_impact |
Blast-radius analysis (~300 tokens) |
ask_codebase |
Open-ended question about the code |
get_project_overview |
Whole-repo narrative overview |
Design Diagrams
- High-Level Design — Process flow diagram
- Class Interaction Design — Class relationships
Open with excalidraw.com or the VS Code Excalidraw extension.
License
MIT License — see LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deeprepo-1.1.0.tar.gz.
File metadata
- Download URL: deeprepo-1.1.0.tar.gz
- Upload date:
- Size: 78.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fe9b8e096610f531868101ee774ef76b53a2c4ed47f58e962e6f73570324893
|
|
| MD5 |
c9c058fbb0f2d7cd0b6391f1df1cb965
|
|
| BLAKE2b-256 |
6ef4e531442f967dfc94dfd01450774e03319e3adf790925b7ff47032468dc29
|
File details
Details for the file deeprepo-1.1.0-py3-none-any.whl.
File metadata
- Download URL: deeprepo-1.1.0-py3-none-any.whl
- Upload date:
- Size: 84.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb96697ea48ab37278326dc380e5c41bec12e729f9ffa954c770682013684db1
|
|
| MD5 |
68897b0fd9d9d6a9090fad827b6631db
|
|
| BLAKE2b-256 |
15f3d54b9f76fda14ab0d5a57ebea6280afe6c2611de1c93d5366d70af9f7b79
|