obsidian-rag-mcp

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.

Category
Visit Server

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 a search_notes tool and answers from your vault, inside the app.

Indexing is incremental: only new or edited files are re-embedded on each run.

Prerequisites

  1. LM Studio with the local server running (Developer tab → Start Server, default http://localhost:1234).
  2. Two models loaded:
    • a chat model (e.g. any Gemma / Llama / Qwen instruct model)
    • an embedding model (e.g. nomic-embed-text-v1.5)
  3. Python ≥ 3.11 and uv (or pipx).

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 → InstallEdit 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 the command field.

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.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured