BorgesHoard
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@BorgesHoardsearch my library for the passage where I wrote about Borges and labyrinths"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Borges's Hoard
Your personal library, indexed on your own PC. Point it at folders of documents (PDF, DOCX, Markdown, TXT, EPUB, HTML, CSV) and ask "where did I read/write about X": every answer comes with an exact citation — «Title», p. 12 or notes.md § Section — and the full passage to read. An assistant reaches the same index through MCP, so it can quote your documents instead of guessing.
Everything stays on the machine: SQLite for text and vectors, a small multilingual embedding model that runs on the CPU, no accounts, no network beyond the one-time model download.
Part of the Hoard family (see faustus-plugin.json).
What it does
Collections = folders you choose, with include/exclude globs, enable/disable, optional folder watching (reindex on change) and optional code files.
Extraction per format: PDF page by page (page numbers kept; scanned PDFs without a text layer are listed and flagged
needs_ocr, not OCR'd in v1), DOCX headings → sections (tables appended as rows), Markdown headings → sections with line numbers, TXT, EPUB chapter by chapter, HTML by h1–h3 (scripts/styles dropped), CSV first 200 rows.Chunking with overlap (~900 chars, 150 overlap) that never crosses a page/section boundary; every chunk remembers page, section title and line. A page/section shorter than ~200 characters (a "## Pendiente" stub, a title page) is merged into the following one (or the previous one at the end) keeping the larger part's metadata, and no chunk under 120 characters is emitted unless it is the whole document. Chunking rules carry an
index_versionper document: when the rules change, the next reindex re-chunks only the stale documents, the worker queues it at startup, and status/UI say "reindexación necesaria: N documentos" until done.Incremental indexing: size+mtime check, then SHA-256; only changed files are re-extracted; deleted files are purged. Runs in a background worker with a queue and live progress (files done/total, current file, per-file errors).
Hybrid search: SQLite FTS5 BM25 (diacritics-insensitive, stopwords dropped, terms of 3+ letters match as a prefix of their light Spanish stem, shorter terms whole-word only) ∪ dense cosine over float32 vectors in SQLite → Reciprocal Rank Fusion. Modes
hybrid | bm25 | dense. Queries under 3 characters are refused (400). One hit per page/section; further hits from the same section come back inalso(UI: "ver más"). Responses carrytook_ms. A reranker hook is left inSearch(reranker=...).Embeddings:
sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2(ONNX, quantized, 384 dims, ~240 MB on disk, ~50 languages, cross-lingual) throughfastembed, downloaded on first use intodata/models. Until it is ready search is keyword-only and the UI says so. SetBORGES_EMBED=noneto disable dense search entirely.UI (Spanish): Buscar (big search box, mode toggle, collection filter, results with citation + highlighted snippet, passage side panel with prev/next page and "similar passages"), Biblioteca (documents by collection, type, size, pages, indexed date, OCR badge; document view with outline and page text), Colecciones (add folder, globs, switches, reindex, progress, errors), Estado (model, counts, queue, disk).
Related MCP server: Libragen
Requirements
Windows 10/11 (also runs on Linux/macOS), Python 3.11+ (3.13 fine), Node 22 only to build the client.
CPU is enough. For an NVIDIA GPU you can install
fastembed-gpuand setBORGES_EMBED_PROVIDERS=CUDAExecutionProvider(optional extragpu).Python's
sqlite3must have FTS5 (the official Windows builds do). The app fails loudly at startup otherwise.
Install and run (Windows)
git clone <this repo> borges-hoard
cd borges-hoard
python -m venv venv
venv\Scripts\pip install -r requirements.txt
npm install
npm run build
venv\Scripts\python -m borgesOpen http://127.0.0.1:5184, go to Colecciones and add a folder. The first start downloads the embedding model (~240 MB); Estado shows its progress.
python scripts/launch.pystarts the app on a free port and opens the browser.python scripts/dev.pyruns uvicorn--reload+ the Vite dev server (proxying/api).python scripts/selftest.py <folder>indexes a folder into a temporary data dir, runs three queries and prints citations and timings (--fakeskips the model).
Configuration (environment)
Variable | Default | Meaning |
|
| Preferred port; |
|
| Database ( |
| Extra host names accepted behind a tunnel (see below). | |
|
| Where the embedding model is cached. |
|
|
|
|
| Any fastembed text model. |
| e.g. | |
|
|
|
|
|
|
Access from your phone (behind a tunnel)
The server binds 127.0.0.1 and only answers requests whose Host is localhost, 127.0.0.1 or [::1]. To reach it from your phone through a tunnel that fronts the app (a private mesh network, a reverse proxy), list the extra host names in BORGES_ALLOWED_HOSTS, comma-separated, exact names or *.suffix: BORGES_ALLOWED_HOSTS=my-pc.example,*.ts.net. Port and letter case are ignored, and the Origin of API calls must resolve to one of those hosts too (any scheme or port). Cross-site fetches are still refused; opening the app from another page (a link, a bookmarklet, the share sheet) is a normal navigation and works.
Once opened through the tunnel, the browser offers to install it (PWA).
API
All JSON; errors are { "error": "..." }.
GET /api/health→{ service: "borges-hoard", version, dataDirConfigured }GET /api/status→ model state, counts (documents, chunks, errors, needs_ocr), per-collection counts, worker queue and progress, diskGET/POST /api/collections,GET/PATCH/DELETE /api/collections/{id},POST /api/collections/{id}/reindex,GET /api/collections/{id}/progressGET /api/documents?collection&q&status&limit&cursor(cursor = last id),GET /api/documents/{id}(metadata + outline),GET /api/documents/{id}/text?page=|section=|unit=(text with prev/next)GET /api/search?q&collection&mode=hybrid|bm25|dense&limit→took_msand hits withcitation,snippet(with<mark>),chunk_id,document_id,page,section,line,score,also/more(collapsed hits from the same section);qmust have 3+ charactersGET /api/similar/{chunk_id},GET /api/chunks/{chunk_id}GET /api/agent/tools(catalog + instructions),POST /api/agent/call(Bearer token fromdata/mcp-token)
MCP tools
mcp_server.py is a stdio bridge: it fetches the tool list from the running app and proxies every call to POST /api/agent/call with the token from <DATA_DIR>/mcp-token. It never opens the database. Env: BORGES_URL, BORGES_TOKEN_FILE (or BORGES_TOKEN).
Tool | What it does |
| Hybrid search → hits with citation, snippet, chunk_id, document_id (q, collection?, mode?, limit). |
| Exact text of a page / section / the unit containing a chunk, with prev/next (document_id, page? | section? | chunk_id?, max_chars). |
| Metadata and outline of one document. |
| List documents (collection?, q?, cursor). |
| Collections with counts. |
| Model state, counts, queue. |
| Passages similar in meaning to a chunk. |
| Queue a non-destructive reindex of a collection (write). |
| Add a folder that must exist; idempotent by path (write). |
The instructions shipped with the tools tell the assistant to answer only from retrieved text, to read the full passage with library_read before quoting, to always cite, and to say so when nothing relevant is found.
Tests
venv\Scripts\python -m pytest -q # fake embedder, no network
venv\Scripts\python -m pytest -m model # downloads/loads the real model, checks a Spanish queryCovers extraction per format (fixtures generated with PyMuPDF, python-docx, ebooklib), chunking, incremental reindex, FTS + snippets, hybrid fusion, API via TestClient, agent auth, the folder watcher, and a subprocess end-to-end test that boots the app and talks to it through the MCP stdio bridge.
Limits (v1)
No OCR: scanned PDFs are listed with
needs_ocrand cannot be searched.DOCX tables are flattened to
cell | cellrows; images and footnotes are ignored.Dense search keeps all vectors in memory (384 floats per chunk: ~150 MB per 100k chunks) and rebuilds the matrix after indexing changes.
The reranker stage is a hook, not an implementation.
License
MIT — Luissalet.
This server cannot be deployed
Maintenance
Related MCP Connectors
Ingest, manage, and retrieve documents for RAG-powered AI applications
- AmberOAuthcom.ambermem
Long-term memory for AI assistants. Hybrid retrieval, query expansion, auto-topics.
Search your knowledge bases from any AI assistant using hybrid RAG.
Universal persistent memory and knowledge retrieval layer for AI agents and LLMs.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to search and query PDF documents through a local RAG system with vector embeddings. Provides semantic document search capabilities while keeping all data stored locally without external dependencies.-
- AlicenseNot gradedqualityCmaintenanceCreates and searches private, local RAG libraries from documentation to ground AI assistants in authoritative sources, reducing hallucinations by providing current, accurate context from your own docs instead of relying on outdated training data.21MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to perform semantic, hybrid, and filtered search on indexed local documentation with RAG capabilities.2MIT
- AlicenseNot gradedqualityAmaintenanceLocal-first memory and retrieval for private project knowledge. Enables indexing files, searching, and asking questions about project documents using local embeddings and LLM.6AGPL 3.0