obsidian-rag-mcp
MCP server that integrates with LM Studio to provide a search_notes tool, allowing the chat model to retrieve and answer from a local Obsidian vault.
README
rag-obsidian-lmstudio
Fully local RAG over an Obsidian (or any markdown) vault, powered by LM Studio. Nothing leaves your machine.
Two ways to use it:
obsidian-rag— a terminal REPL: ask questions, get answers grounded in your notes with source citations.obsidian-rag-mcp— an MCP server for the LM Studio GUI: the chat model gets asearch_notestool and answers from your vault, inside the app.
Indexing is incremental: only new or edited files are re-embedded on each run.
Prerequisites
- LM Studio with the local server running
(Developer tab → Start Server, default
http://localhost:1234). - Two models loaded:
- a chat model (e.g. any Gemma / Llama / Qwen instruct model)
- an embedding model (e.g.
nomic-embed-text-v1.5)
- Python ≥ 3.11 and
uv(orpipx).
Install
uv tool install git+https://github.com/shirokoweb/rag-obsidian-lmstudio
# or: pipx install git+https://github.com/shirokoweb/rag-obsidian-lmstudio
Use the terminal REPL
obsidian-rag --docs-dir ~/path/to/your/vault
Chat: google/gemma-4-e4b
Embed: text-embedding-nomic-embed-text-v1.5
Indexed 317 chunks from /Users/you/vault
Ask a question (blank line or Ctrl-D to quit).
? What is the CIA triad?
The CIA triad is a model that helps organizations consider risk ...
sources: Module 2/25. Explore the CIA triad.md, ...
top score: 0.830
Use inside LM Studio (MCP)
Add the server to LM Studio's mcp.json (Program tab → Install →
Edit mcp.json):
{
"mcpServers": {
"obsidian-rag": {
"command": "obsidian-rag-mcp",
"env": {
"RAG_DOCS_DIR": "/Users/you/path/to/your/vault"
}
}
}
}
Then ask the chat model anything about your notes — it calls search_notes
and answers grounded, with source filenames.
If LM Studio can't find the command, use the absolute path (
which obsidian-rag-mcp) in thecommandfield.
Configuration
CLI flags take precedence over environment variables.
| Flag | Env var | Default | Purpose |
|---|---|---|---|
--docs-dir |
RAG_DOCS_DIR |
(required) | Vault / notes directory |
--base-url |
RAG_BASE_URL |
http://localhost:1234/v1 |
LM Studio server URL |
--chat-model |
RAG_CHAT_MODEL |
auto-detect | Chat model id |
--embed-model |
RAG_EMBED_MODEL |
auto-detect | Embedding model id |
--top-k |
RAG_TOP_K |
4 |
Retrieved chunks per question (1–20) |
Auto-detection picks the first loaded model whose id contains embed as the
embedder and the first other model for chat. With several chat models loaded,
set RAG_CHAT_MODEL explicitly.
The embedding cache lives in your OS user-cache directory (e.g.
~/Library/Caches/rag-obsidian-lmstudio on macOS) — never inside your vault.
Deleting it is always safe; it will be rebuilt.
Troubleshooting
| Symptom | Fix |
|---|---|
Cannot reach LM Studio |
Start the server: LM Studio → Developer tab → Start Server |
Need both a chat and an embedding model loaded |
Load an embedding model and a chat model in LM Studio |
request timed out ... responding slowly |
The chat model is too large/slow — set RAG_CHAT_MODEL to a smaller one |
No documents directory configured |
Pass --docs-dir or set RAG_DOCS_DIR |
| Stale answers after editing notes | Nothing to do — the index refreshes on every run/query |
Privacy & security notes
- All traffic goes to your configured LM Studio URL (localhost by default); there are no other network calls, no telemetry.
- The cache uses plain JSON + NumPy
.npz— no pickle, nothing executable. - The tool only ever reads your vault; it never writes into it.
Development
git clone https://github.com/shirokoweb/rag-obsidian-lmstudio
cd rag-obsidian-lmstudio
uv sync --all-extras
uv run pytest # tests
uv run ruff check . && uv run ruff format --check .
uv run mypy src # typecheck
See SPEC.md for design decisions. MIT license.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。