local-rag
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
local-rag
A private, local document search for Claude or any MCP client. Ask a plain question and get back the passages that answer it, each with its file, date, page and a relevance score. If nothing fits, it says "not in these documents" instead of guessing.
Indexing, embeddings, and search run on your Mac. Ollama creates embeddings locally, LanceDB stores the index on disk, and one read-only MCP tool returns matching passages. If you use a hosted model to draft answers, your MCP client may send the question and retrieved excerpts to the model provider.
Why local?
The search tool builds and queries the index on your own machine without uploading the source files. The client handles answer generation separately. Use the included sample documents to try it, and check your client's data handling before connecting sensitive documents.
Read-only. The search tool can't write, delete, or read anything outside the index.
Cites everything. Every passage comes back with its file, date, page and score.
Says when it doesn't know. A relevance floor turns weak matches into "not in these documents."
Keeps things out on purpose. An exclude guard refuses
.envfiles, keys, credentials, spreadsheets and any folder you rule out. It tests itself before every build, and if the test fails, nothing is built.Hides old and internal docs. Files labeled
supersededorinternalstay out of results unless you ask for them.
Related MCP server: loci-mcp
How it works
your documents (read-only, never changed)
| pick allowed files, pull out text, drop sensitive sentences
v
passages (~400 tokens, 60 overlap) + labels (file, date, page, status, audience)
| Ollama turns each passage into a vector
v
LanceDB folder (one table per collection, plus a keyword index)
|
question --> hybrid search (meaning + exact words) --> relevance floor
| nothing passes? "not in these documents"
v
passages with file, date, page, score --> MCP client --> model drafts a cited answer
(a hosted model may receive these excerpts)Stack
Part | Used | Job |
Embeddings | Ollama + | Turns text into vectors on your machine |
Vector database | LanceDB | A folder on disk. No server. Backup is a copy. |
Python | uv + Python 3.12 | A sealed-off environment for this project |
File readers | PyMuPDF, python-docx, BeautifulSoup | PDF (page by page), Word, HTML. Markdown and text read as-is. |
Search tool | Python | One read-only tool for Claude |
Requirements
macOS. Built and tested on an Apple Silicon Mac mini. It should run anywhere Ollama and Python 3.12 do, but only macOS is tested.
Homebrew
About 1 GB free for the embedding model, plus room for your index
An MCP client, like Claude Code or Claude Desktop
Install
git clone https://github.com/armyrunner9916/local-rag.git
cd local-rag
brew install ollama uv
ollama serve # leave running in its own terminal
ollama pull qwen3-embedding:0.6b
uv venv --python 3.12
uv pip install -r requirements.txt
cp config.example.json config.jsonTry it on the sample documents
examples/sample-docs/ holds a few made-up company documents, and examples/sample-questions.json holds test questions for them.
.venv/bin/python -I ingest.py --collection sample
.venv/bin/python -I eval.py --collection sampleYou'll see which file came back first for each question, plus hit@1, hit@3 and MRR scores. Off-topic questions should come back "not in these documents."
Use your own documents
Decide what's in and what's out first. Write it down. It matters more than any setting.
Edit
config.json: add a collection, point it at your folders, and list what to exclude.Build it:
.venv/bin/python -I ingest.py --collection <name>Write 15 to 20 real questions with known answers, plus a few off-topic ones, and run
eval.py.Fix what the tests catch. Label old files
superseded, private onesinternal, and tune the relevance floor if you need to.
config.json is gitignored, so your paths and lists never get committed.
Connect it to Claude
Claude Code:
claude mcp add --scope user local-rag -- \
"$(pwd)/.venv/bin/python" -I "$(pwd)/mcp/server.py"Claude Desktop: add the same command and arguments to claude_desktop_config.json under mcpServers.
The tool:
search_docs(query, collection="sample", top_k=5,
include_internal=false, include_superseded=false)It returns passages with file, date, page and score, and a match of strong or weak. If Ollama isn't running, the server starts it.
Keep it fresh
refresh.py rebuilds every collection, reruns the tests and compares the scores with a saved baseline. If a build fails, the last good table stays in place. Run it by hand, or schedule it with launchd or cron.
What it doesn't do yet
No OCR, so scanned PDFs come in empty.
Spreadsheets are refused on purpose.
Every build is a full rebuild. Fine for a few thousand passages, slow for tens of thousands.
One user, one machine.
More from Armyrunner Studios
Built by Armyrunner Studios. I set this up for businesses that want their own private document search. Stop by if you want one.
License
MIT. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Query your own PDFs and documents from any MCP client. Every answer cites the page it came from.
Ask your own documents and get answers that cite the source passage. Workspace knowledge bases over MCP for Cursor, Claude and any MCP client.
Agentic search over your Dewey document collections from any MCP-compatible client.
Private, multimodal knowledge store for agents: hybrid search with cited, provenance-backed results.
Related MCP Servers
- AlicenseAqualityAmaintenanceEnables local semantic search over documents and code for Claude Code and Claude Desktop, running entirely offline with local embeddings and vector storage.147MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI agents and MCP-compatible hosts to search, ask, and retrieve section-level citations from scattered local notes, docs, PDFs, Word files, web pages, org files, and chat logs using hybrid vector and BM25 retrieval.-
- FlicenseNot gradedqualityAmaintenanceEnables AI agents and MCP hosts to query a local, machine-resident index of scattered notes, project docs, PDFs, Office files, and chat exports using hybrid vector + BM25 retrieval with section-level citations. Exposes tools, resources, and prompts so hosts like Claude Desktop, Cursor, and Cline can search, ask, and explore linked knowledge through natural language.-
- FlicenseNot gradedqualityAmaintenanceEnables AI agents and MCP hosts to search and query a local hybrid vector/BM25 index of scattered notes, docs, PDFs, Office files, web pages, org files, and chat exports. It returns section-level citations so agents can ground answers in the user's own files.-