Skip to main content

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

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

deeprepo-1.1.3.tar.gz (78.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deeprepo-1.1.3-py3-none-any.whl (85.5 kB view details)

Uploaded Python 3

File details

Details for the file deeprepo-1.1.3.tar.gz.

File metadata

  • Download URL: deeprepo-1.1.3.tar.gz
  • Upload date:
  • Size: 78.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for deeprepo-1.1.3.tar.gz
Algorithm Hash digest
SHA256 ccb1f9839d4597f045b32dcc6bd881f5ca879daea8b919828290d0a687c9bb3f
MD5 75d274a8df015871602ca00845cadac1
BLAKE2b-256 4e4378fe2ebe9d5b3bdb17de09cfa04698ab4b9fe46a82b71fdaa6077120a904

See more details on using hashes here.

File details

Details for the file deeprepo-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: deeprepo-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 85.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for deeprepo-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8622de04b96f436cab48d18613506152d5f33658153a5d0c0395076972dec1fc
MD5 5fc8bcc89e2dd83df64f23d8babc1da4
BLAKE2b-256 a9db11ac92bd407d8ad5c072f30605e94c8476c7fccdf9059ff4f5ffdd481acd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page