Source
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.
Source
Local, offline search over a folder of Markdown notes, for Claude Code / opencode / any MCP client.
This is a skeleton: a working tool plus an empty-but-structured example vault, meant to be copied
and pointed at your own notes. The notes in source/ are a plain folder of Markdown (it also opens as
an Obsidian vault, but Obsidian isn't needed). Source turns that folder
into a small search index. A coding agent can then ask "how do I verify a fix actually worked?" in
the middle of a task and get back the two or three note sections that answer it, with their source —
a few hundred tokens instead of reading every note.
Private: notes never leave the machine. No API keys, no cloud, no telemetry. The only network access is a one-time model download from Hugging Face during the first build.
Small: a few hundred lines of Python, two local models (~152 MB) and one SQLite file.
Incremental: editing one note and rebuilding only re-embeds that note.
Measured: ship a question set in
eval/questions.jsonandeval_retrieval.pytells you how often the right section comes back — so you can tune retrieval for your notes, not guess.
How it works (short version)
source/*.md
│ build_index.py (incremental: unchanged files keep their embeddings)
├─ 1. split each note at its headings → "chunks"
├─ 2. embed each chunk (bge-small) → 384 numbers that capture its meaning
└─ 3. store text + numbers + a keyword index in index/source.sqlite
question ─▶ search_notes()
├─ stage 1: meaning search (vectors) + exact-word search (BM25)
│ merged with Reciprocal Rank Fusion → ~20 candidates
├─ stage 2: a cross-encoder (MiniLM reranker) reads question + each candidate
│ together and re-scores them → best first
└─ one result per note section, top k=3 returned with path › headingHybrid search matters because the two halves catch different things: meaning search finds "roll back
a failed migration" when the note says "revert a broken deploy"; keyword search finds an exact
token like ERR_CONN_4021. You want both, then a reranker to order what's left.
Related MCP server: obsidian-brain
Install
Requires Python 3.11+ and about 200 MB of disk space. The first build needs internet access; everything after that runs offline.
git clone <your-remote>/source-rag.git ~/source-rag && cd ~/source-rag
make install # creates .venv and installs deps
make build # downloads models once (~152 MB), then indexes in seconds
make query Q="how do I verify a fix worked"Prefer to do it by hand, or want the source-build / source-query commands on your PATH?
python3 -m venv .venv
.venv/bin/pip install -e . # installs the package + the two console scripts
.venv/bin/source-build
.venv/bin/source-query "how do I verify a fix worked"If your platform blocks system-wide pip install (e.g. Debian/Kali PEP 668), always run things
through .venv/bin/….
Heads-up on very new Pythons:
fastembedpulls inonnxruntime, which can lag the newest CPython release by a few months. Ifpip installcan't resolveonnxruntime, use a Python in the 3.11–3.13 range. (The unit tests don't need either — see Development.)
Connect it to your agent
Claude Code (available in every project):
claude mcp add source -s user -- ~/source-rag/.venv/bin/python ~/source-rag/mcp_server.py
claude mcp list # should show source ✓ connectedopencode: add this to ~/.config/opencode/opencode.json, using absolute paths:
{
"mcp": {
"source": {
"type": "local",
"enabled": true,
"command": ["/home/you/source-rag/.venv/bin/python", "/home/you/source-rag/mcp_server.py"]
}
}
}Then start a new session and ask something like "check my notes for how to reproduce a flaky bug".
The agent calls search_notes by itself.
Usage
MCP tools (what the agent sees)
Tool | What it does |
| The best-matching note sections, each with |
| One whole note, when a section isn't enough |
| Every indexed note, plus when the index was built and with which models |
mode is hybrid (default), vector (meaning only) or keyword (exact words only).
path restricts to notes whose path contains that text (e.g. "journal"); tags restricts to
chunks whose frontmatter tags include all of the given tags.
Terminal
.venv/bin/python query.py "how do I verify a fix worked"
.venv/bin/python query.py -k 5 --mode keyword "ERR_CONN_4021"
.venv/bin/python query.py --path refs/ "reference entry shape"
.venv/bin/python query.py --tag reference "entry shape"
.venv/bin/python query.py --no-rerank "..." # skip stage 2 (a little faster)
.venv/bin/python query.py --listKeeping the index current
.venv/bin/python build_index.py # incremental: only re-embeds changed notes
.venv/bin/python build_index.py --full # rebuild everything from scratch
.venv/bin/python build_index.py --watch # stay running, rebuild on every saveThe MCP server loads the index on first use. Restart the agent session (or /mcp → reconnect in
Claude Code) to pick up a rebuilt index.
Tagging notes
Add YAML frontmatter tags to a note and they become a filter dimension (and they're stripped from the indexed text, so they never pollute search):
---
tags: [playbook, checklist]
---
# My noteThen query.py --tag playbook "…" or search_notes(..., tags=["playbook"]).
Development
The chunking, indexing and search logic is covered by unit tests that inject a fake embedder, so they run without the heavy ML dependencies or any model download — handy on a bleeding-edge Python too.
make install-dev # adds pytest
make test # == .venv/bin/python -m pytest.github/workflows/ci.yml runs the same tests on Python 3.11 and 3.12.
Quality
eval_retrieval.py runs the questions in eval/questions.json against the index and reports how
often the right section is ranked first (hit@1) and in the top 3 (hit@3). The skeleton ships a
handful of example questions across three kinds — paraphrase (deliberately avoids the note's
words), exact_term (identifiers, codes) and scenario (describes a situation) — so you can see
the shape. Replace them with questions about your own notes.
make eval # == .venv/bin/python eval_retrieval.py -v (-v lists every miss)Typically each stage helps: keyword-only and vector-only trail hybrid (RRF), and adding the reranker on top gives the best ordering for a few hundred ms per query. Run it on your own vault to get real numbers before trusting any single configuration.
Configuration
Setting | How | Default |
Notes folder |
|
|
File types |
|
|
Embedding model |
|
|
Reranker |
|
|
Index location |
|
|
The models are recorded in the index, and queries always use the ones the index was built with. Changing a model therefore means a full rebuild (the incremental cache invalidates automatically).
Skipped while indexing: .obsidian/, .git/, .venv/, site-packages/, node_modules/,
__pycache__/ and any other hidden folder.
Files
source/ the vault (source of truth) — see source/README.md for its structure
source_rag.py everything: chunking, embedding, SQLite index, hybrid search, rerank
build_index.py builds index/source.sqlite (incremental; --full, --watch)
query.py terminal search (--mode, --path, --tag, --list)
mcp_server.py MCP server (stdio) for Claude Code / opencode
eval_retrieval.py quality benchmark
eval/questions.json the benchmark's questions with expected answers
tests/ unit tests (run without the ML deps, via a fake embedder)
examples/ optional helpers (e.g. make_sample_pdf.py to try PDF indexing)
pyproject.toml packaging + console scripts + pytest config
Makefile common tasks (install, build, watch, query, test, eval, clean)
requirements*.txt runtime deps, and -dev adds pytest
.github/workflows/ CI (runs the unit tests)
index/ models/ built locally, git-ignored (the index holds your notes' full text)Troubleshooting
Symptom | Fix |
| Run |
| Your Python is likely too new for a fastembed wheel yet — use Python 3.11–3.13. |
Model errors on an offline machine | Searches load models from |
| You have MCP SDK 2.x. Reinstall with |
| You ran system |
Agent doesn't use the tool | Check |
Results look outdated | Rebuild the index and reconnect the MCP server. |
Limits
It only finds what's written down. Results are your notes, not ground truth — verify against the live system.
Images and screenshots in the vault aren't indexed. PDFs are, if you add
--ext .pdf.read_noterebuilds a note from its chunks, so split sections can repeat ~200 characters at the joins.English-tuned models by default. Notes in other languages are found by keyword, less well by meaning — swap the embedding model if that matters.
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
Linked markdown notes as memory for AI apps: search, read, save and link notes over MCP.
Serve a folder of Markdown notes as an MCP server: hybrid search, reading, and sourced answers.
Token-efficient MCP memory for Markdown vaults. Tiered search, GraphRAG, AI memories.
Search and reason over your Obsidian-style Markdown vault, right from ChatGPT.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceProvides hybrid search (BM25 + vector) and staleness reporting for local markdown notes, exposing search and indexing tools to AI assistants via MCP.8 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables AI clients to search and retrieve notes from a local Markdown vault using hybrid keyword/semantic search, and to save typed memories with append and guarded replacement operations.MIT
- AlicenseAqualityCmaintenanceEnables MCP clients to search a folder of markdown notes and read individual notes through two read-only tools, using hybrid dense-vector and BM25 retrieval.2MIT
- AlicenseNot gradedqualityCmaintenanceEnables MCP-compatible agents to search and retrieve linked context from a local Obsidian-compatible Markdown vault, with read-only tools by default and optional tools to capture, update, link, organize, and index notes.MIT