A local-first Retrieval-Augmented Generation engine and Model Context Protocol server. ragpilot indexes your repository once, then lets any LLM agent retrieve only the code that matters for a task — instead of stuffing whole files into the context window. Nothing is uploaded; the index lives on your machine.
# install & index the current repo cargo install ragpilot ragpilot index . # expose it to your agent over MCP ragpilot serve --mcp
When an LLM agent works on a codebase, the naive approach is to read whole files into the prompt. That burns tokens, blows past context limits on large repos, and buries the relevant lines in noise. ragpilot flips this: it builds a semantic + structural index of your code and serves precise, ranked snippets on demand — so the agent sees what's relevant and nothing else, while your source never leaves the machine.
Embedding-based retrieval over a local vector store finds code by meaning, not just keywords — so "where do we validate auth tokens" returns the right function even if the wording differs.
Speaks MCP natively, so Claude Code and other MCP-aware agents can call its search, navigation, and impact tools directly — no glue code, no custom adapters.
Parses code structurally to resolve symbols, build call graphs, and return whole definitions — giving agents precise navigation instead of fuzzy line ranges.
Before a change ships, ask ragpilot what it touches. It traces dependents and flags breaking signals so agents plan refactors instead of discovering damage after the fact.
A filesystem watcher and Git hooks re-index only what changed. The index stays current as you work, with no full re-embed on every edit.
Embeddings run with a local model and the index is stored on disk. Your proprietary code is never sent to a third-party API — safe for regulated and air-gapped environments.
ragpilot walks the repo, parses each file with Tree-sitter, and splits it into structural chunks (functions, classes, blocks) instead of arbitrary line windows — keeping semantic units intact.
Each chunk is embedded with a local model and written to a vector store, alongside a SQLite metadata index that tracks symbols, ranges, and file state for fast incremental updates.
The server exposes tools — search, symbol resolve, call graph, impact analyze, context bundle — that an agent invokes through the Model Context Protocol with a strict token budget.
A watcher marks files dirty on change and Git hooks trigger re-indexing, so the next query always reflects the latest code without a manual rebuild.
Clone it, index your repo, and point your agent at the MCP endpoint. It's MIT-licensed and runs entirely offline.
github.com/alikaya/ragpilot