AgentsApplications 🇷🇺 05.08.2026 14:02

MCP without the cloud

The article describes an alternative use of MCP (Model Context Protocol) to provide a model with access to a large local document archive. Instead of classic RAG, a structure of indexes (index.md and subindex.md) is proposed, which allows the model to retrieve only the necessary fragments, reducing context and tokens, and avoiding the cloud. The author presents his own implementation – the DocShelf tool, which converts PDFs to Markdown, splits them into sections, builds an index, stores it in Git, and connects via MCP, with an example of the whole pipeline.
The author argues that MCP is not only for agents, but can be used for other purposes, such as implementing retrieval from a large local document collection. Classic RAG was considered, but it requires significant infrastructure (embedding models, vector databases, scheduled reindexing) and does not provide transparency for auditing why the model chose a particular fragment. Instead, it is proposed to use an index file (llms.txt idea) that acts as a table of contents: the model first reads the index, then the subindex, and only then fetches the specific section of a document. The author created the DocShelf tool, an MCP server that converts PDF to Markdown, cleans it, splits it into sections, creates index.md and subindex.md, stores everything in Git, and connects it to the model. The pipeline is as follows: PDF to Markdown, then splitting into sections, then index building, then saving in Git, then via MCP server to LLM. The model consumes only a tiny fraction of the total archive: in the example with an 85 MB shelf, about 16.5 KB of context was used. The article also highlights common pitfalls: PDF parsing issues, Cyrillic corruption, poor Markdown structure, and gives a troubleshooting table. Two converters are available: pymupdf4llm (fast, no GPU) and marker-pdf (for complex cases, but heavy). DocShelf supports Git as a storage, versioning, and review, and can work in closed networks. The author concludes that this approach is a viable alternative to classic RAG in scenarios where audits are needed and the corpus is local.
Abbreviations
MCP = Model Context Protocol — протокол контекста модели
RAG = Retrieval-Augmented Generation — генерация с дополнением извлечением
PDF = Portable Document Format — портативный формат документов
GPU = Graphics Processing Unit — графический процессор
MD = Markdown — язык разметки
LLM = Large Language Model — большая языковая модель
OCR = Optical Character Recognition — оптическое распознавание символов
Source: Habr — хаб ИИ — original
Our earlier posts on this topic ↓
Fresh news