vault-mcp

vault-mcp

An MCP server for personal markdown notes that enables hybrid search (keyword + semantic) with Reciprocal Rank Fusion, allowing users to save, search, update, and retrieve notes by meaning rather than exact wording.

Category
访问服务器

README

vault-mcp

An MCP server for my personal markdown notes vault. Claude (or any MCP client) can save notes and pull them back later by meaning, not just exact wording — "what did I decide about the routing taxonomy" can find a note that never uses those words.

Search is hybrid: keyword (SQLite FTS5 / BM25) plus semantic (local embeddings), combined with Reciprocal Rank Fusion. Pure vector search misses exact-term queries — function names, error strings, jargon. Pure keyword search misses paraphrases ("why did I skip a client-server database" should find a note about picking SQLite over Postgres, even with zero shared words). RRF combines the two using rank position rather than raw score, since BM25 and cosine similarity live on different scales and blending them directly needs fragile manual tuning.

I didn't want to just assume hybrid was better, so there's a small hand-labeled eval set (eval/eval_set.json, 29 queries over 25 seeded notes) measuring recall@3 and MRR for keyword-only, vector-only, and hybrid:

Mode Recall@3 MRR
Keyword only 0.948 0.879
Vector only 0.931 0.885
Hybrid 1.000 0.937

A few queries in the set are deliberately adversarial — pure paraphrases with no shared vocabulary, and exact-jargon queries mixed in with near-duplicate "confusable" notes. An earlier, easier version of this eval set scored 1.0 recall across all three modes, which told me the eval was useless, not that the methods were equivalent. Run it yourself:

python scripts/seed_demo.py --db /tmp/demo_vault.db
python eval/run_eval.py --db /tmp/demo_vault.db --k 3

How it's put together

Everything lives in one SQLite file — notes, the FTS5 keyword index, and embeddings stored as raw float blobs (cosine similarity computed in Python/numpy, no vector DB needed). One portable file, works fully offline, no API costs.

  • storage.py — SQLite + FTS5 keyword index
  • embeddings.py — local sentence-transformers model (all-MiniLM-L6-v2)
  • search.py — fuses keyword + vector results with RRF
  • server.py — the MCP tool definitions Claude actually calls

Tools exposed

Tool Description
add_note Save a note (title, content, tags) — embedded and indexed immediately
search_notes Hybrid search, returns structured results with match provenance
get_note Fetch full content of a note by ID
update_note Edit an existing note's title/content/tags and re-embed it
list_notes Browse notes, optionally filtered by tag or recency
recall_context Search + format results as ready-to-inject conversation context
delete_note Remove a note

Quickstart

git clone <this-repo>
cd vault-mcp
pip install -e .
python scripts/seed_demo.py   # optional: populate with example notes

Add to your Claude Desktop config (claude_desktop_config.json):

{
  "mcpServers": {
    "vault-mcp": {
      "command": "python",
      "args": ["-m", "vault_mcp.server"],
      "env": { "VAULT_MCP_DB": "/path/to/your/vault.db" }
    }
  }
}

A few decisions worth explaining

RRF over blending scores. BM25 and cosine similarity aren't on comparable scales, so averaging them directly means fragile manual tuning. RRF sidesteps that by using rank position instead. See search.py.

SQLite over Postgres or a vector DB. This is a single-user local tool, not a multi-tenant service. FTS5 already gives BM25-quality keyword search for free, with zero extra infrastructure.

Local embeddings over an API. all-MiniLM-L6-v2 runs fully offline — no per-query cost, no key to manage. It's good enough for note-length text. Swapping in a hosted embedding API later would be a one-line change in embeddings.py if I ever need higher quality.

Testing

pip install -e ".[dev]"
pytest tests/ -v

CI (.github/workflows/ci.yml) runs the test suite across Python 3.10–3.12 and re-runs the retrieval eval on every push, so a change that quietly regresses search quality gets caught too, not just one that breaks a unit test.

What's next

  • Sync from Notion/Obsidian as a note source instead of only add_note
  • Grow the eval set as the vault grows — 29 queries is a start, not a ceiling
  • This project's routing-vs-fusion problem is a small piece of something bigger I'm working on: routing natural language queries across heterogeneous backends (SQL, graph, generated code). More on that once PolyQuery is public.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选