Local RAG

Local RAG

Privacy-first local MCP-based document search server enabling offline semantic search.

18
Stars
6
Forks
6
Releases

Overview

Built to run entirely on your machine, the MCP Local RAG server indexes local documents and exposes semantic search through MCP clients (Cursor, Codex, Claude Code, or any MCP client). It ingests PDFs, DOCX, TXT, and Markdown, extracting text, chunking into 512-character segments with 100-character overlap, embedding each chunk with a 384-dimensional model, and storing results in a local LanceDB vector store. Re-ingesting a file replaces the old version to avoid duplicates. The server provides five MCP tools: Document ingestion, Semantic search, File management, File deletion, and System status. Embeddings are generated with Transformers.js (no Python), using the all-MiniLM-L6-v2 model, with batching of 8 chunks for efficiency. Model downloads lazy on first use (~90MB) and caches in CACHE_DIR (default ./models), enabling offline operation after the initial fetch. First operation may incur 1–2 minutes delay while the model downloads. Security features include BASE_DIR path restriction (no access outside the root) and on-device processing with no network requests after startup.

Details

Owner
shinpr
Language
TypeScript
License
MIT License
Updated
2025-12-07

Features

Document ingestion

Ingest PDFs, DOCX, TXT, and Markdown; extract text, chunk, embed, and store in a local vector DB; replaces existing versions to avoid duplicates.

Semantic search

Query in natural language; embed the query and search the vector DB; return the top 5 matches with content, source file, and a relevance score.

File management

List ingested files, showing each file's path, how many chunks it produced, and ingestion time.

File deletion

Remove documents from the vector DB; permanently deletes chunks and embeddings; operation is idempotent.

System status

Report total documents, total chunks, memory usage, and uptime for monitoring and debugging.

Audience

DevelopersIntegrate MCP clients to enable private, offline document search for apps.
Privacy-conscious usersSearch sensitive documents locally without sending data to external services.
MCP usersIntegrate MCP-based workflows to ingest and query local documents efficiently.

Tags

MCPlocalprivacysemantic searchdocument ingestionvector databaseLanceDBTransformers.jsall-MiniLM-L6-v2LangChain.jsPDFDOCXTXTMarkdownofflinelazy model download