ProjectsBPContext
02 / Systems / RAG

BPContext

A Rust context engine that makes large codebases searchable through hybrid retrieval, persistent indexing, and an MCP server for AI tools.

Category
Systems / RAG
Stack
Rust · MCP · SQLite · Sentence Transformers · BM25
Year
2026

Overview

bpcontext addresses a practical problem in agentic development: an AI tool often needs a small answer from a large codebase, but reading every file consumes the context window before implementation begins. The tool captures and indexes source files, command output, and fetched pages so an agent can retrieve only the relevant chunks.

It is both a command-line tool and an MCP server. The persistent knowledge store survives across sessions, while the session index is useful for one-off exploration. Together they provide a searchable memory layer between an agent and the raw project surface.

Methodology

The ingestion pipeline walks directories with gitignore-aware filtering, splits content into meaningful chunks, and stores the full source in SQLite. SHA-256 hashes make re-indexing incremental rather than rebuilding unchanged files. FTS5-backed BM25, trigram, fuzzy, and local embedding retrieval provide complementary views of relevance.

Search results are combined with reciprocal rank fusion, allowing lexical matches and semantic matches to reinforce one another without requiring a remote model or API key. The MCP layer exposes indexing, search, execution, fetch-and-index, and context-budget operations so the same retrieval policy can be used inside coding tools.

What it does

  • Gitignore-aware indexing of source directories and command output
  • Persistent knowledge store with SHA-256 incremental sync
  • Hybrid BM25, trigram, fuzzy, and vector retrieval
  • Reciprocal-rank fusion across lexical and semantic results
  • MCP server for search, indexing, execution, and context tools
  • Context-budget tracking with count-only pre-flight checks
  • URL fetch-and-index support with keyword-only fallback