Skip to main content

document-rag-mcp

Tests Docs PyPI - Version PyPI - Python Version License

A high-performance Model Context Protocol (MCP) server for local document search and extraction. It recursively scans and watches configured directories for .txt, .md, and .pdf files, indexes their content, and exposes them as tools for LLMs.

📖 Full Documentation: https://janlo.github.io/document-rag-mcp/

Key Features

  • Hybrid Search (Semantic + BM25): Blends dense semantic vector search (ChromaDB) with sparse keyword search (SQLite FTS5) using Reciprocal Rank Fusion (RRF) for optimal retrieval.
  • Section-Grain Chunking: Text from all pages is unified and chunked as a single stream, then mapped back to its primary page and section via character offsets, preventing artificial boundaries at page borders.
  • TOC-Aware Extractor: Extracts PDF headings using the document's own Table of Contents (TOC), falling back to typography-aware layout detection if TOC is missing.
  • Incremental Indexing: Uses content hashing (SHA-256) at both the file and chunk levels. Files that have not changed are skipped completely, and modified files only re-embed chunks that actually changed.
  • Auto-Pruning: Automatically detects when files are deleted from the disk and prunes them from the index.
  • Multimodal OCR: Detects scanned or text-less PDF pages and routes them through an optional vision-capable LLM.
  • MCP Native: Exposes tools for hybrid search, collection statistics, metadata analysis, and full document text/binary content retrieval.

Quick Start

1. Installation

Ensure you have uv installed, then synchronize the environment:

git clone https://github.com/janlo/document-rag-mcp.git
cd document-rag-mcp
uv sync --group dev

2. Configuration

Copy the example configuration:

cp config.example.yaml config.yaml

And edit config.yaml to specify the folders you want to watch.

3. CLI Commands

  • Ingest: uv run document-rag-mcp ingest
  • Search: uv run document-rag-mcp search "your query"
  • Start MCP Server: uv run document-rag-mcp serve

Release files for document-rag-mcp 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for document-rag-mcp 0.2.1
File Size Uploaded
document_rag_mcp-0.2.1.tar.gz 277.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for document-rag-mcp 0.2.1
File Interpreter ABI Platform
document_rag_mcp-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 305.6 kB

Release files / document_rag_mcp-0.2.1.tar.gz

Download URL document_rag_mcp-0.2.1.tar.gz
Size 277.3 kB
Tags Source
SHA-256 checksum
How to use checksums
20da60f1ac71aceaa2f456ec9a2be112c2d5e305cd04498ec054a09504f19ad2
BLAKE2b-256 checksum
How to use checksums
e65dfe440dee3bfaf216e5f0c0b6bca70b8835df8359a734d318984149bef1ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

Release files / document_rag_mcp-0.2.1-py3-none-any.whl

Download URL document_rag_mcp-0.2.1-py3-none-any.whl
Size 28.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
588a8c6348e3da69b41edc013c555f506f05eae1bc67ef2804cb025fccc4532a
BLAKE2b-256 checksum
How to use checksums
80000857473cc0171ea4d04f3e1e1f4f1e4f925ac9bd9055d544d11ca3c944bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page