obsidian-notes-rag

obsidian-notes-rag

Enables semantic search and retrieval over an Obsidian vault using local or API-based embeddings, allowing AI assistants to find notes by meaning, get related content, and pull context during conversations.

Category
访问服务器

README

License: MIT PyPI

obsidian-notes-rag

MCP server and CLI for semantic search over your Obsidian vault. Generates embeddings with OpenAI, Ollama, or LM Studio. Stores vectors locally in sqlite-vec (~200KB, no telemetry, no network calls).

What it does

Search your notes by meaning, not just keywords:

obsidian-rag search "project architecture decisions" -n 5
obsidian-rag similar "Projects/Platform Hub.md"
obsidian-rag context "Daily Notes/2026-02-14.md"

As an MCP server, it gives any compatible AI assistant the same capabilities — searching your notes, finding related content, and pulling context during conversations.

Requirements

  • Python 3.11+
  • uv (for running and installing)
  • One of: OPENAI_API_KEY, Ollama, or LM Studio for embeddings

Setup

1. Run the setup wizard

uvx obsidian-notes-rag setup

This creates a config at ~/.config/obsidian-notes-rag/config.toml with your vault path, embedding provider, and API key.

2. Build the index

uvx obsidian-notes-rag index

Parses your markdown files, chunks them by heading structure (using Chonkie RecursiveChunker), generates embeddings, and stores everything in a local SQLite database.

3. Connect to an MCP client

Works with any MCP-compatible client. Examples:

Claude Code:

claude mcp add -s user obsidian-notes-rag -- uvx obsidian-notes-rag serve

Claude Desktop, Cursor, Windsurf, etc. (JSON config):

Add to your client's MCP config file (e.g. ~/Library/Application Support/Claude/claude_desktop_config.json for Claude Desktop on macOS):

{
  "mcpServers": {
    "obsidian-notes-rag": {
      "command": "uvx",
      "args": ["obsidian-notes-rag", "serve"]
    }
  }
}

4. Install the CLI (optional)

If you want obsidian-rag available as a standalone command:

uv tool install obsidian-notes-rag

This installs both obsidian-rag and obsidian-notes-rag to ~/.local/bin/.

Using the CLI with AI coding assistants

Instead of running the MCP server, you can have your AI assistant call the CLI directly via shell commands. This avoids loading MCP tool definitions into the context window, freeing up tokens for your actual work.

To do this, create a rule or skill that tells your assistant when and how to use the CLI:

  • Claude Code: Create a skill with CLI usage instructions
  • Cursor: Add a rule to .cursor/rules/
  • Windsurf: Add a rule to .windsurfrules

The rule should describe when to use each command (search, similar, context) and any project-specific conventions. This gives the assistant enough context to run the right CLI commands without the overhead of an MCP connection.

CLI Reference

# Search
obsidian-rag search "query"                  # semantic search
obsidian-rag search "standup" --type daily   # filter by note type
obsidian-rag search "design" -n 10           # more results

# Explore
obsidian-rag similar "Path/To/Note.md"       # find related notes
obsidian-rag context "Path/To/Note.md"       # show note + related context

# Index
obsidian-rag index                            # re-index vault
obsidian-rag index --clear                    # rebuild from scratch
obsidian-rag index --path-filter "Daily Notes/"  # index subset

# Info
obsidian-rag stats                            # show index size

# Services
obsidian-rag serve                            # start MCP server
obsidian-rag watch                            # watch for changes, auto-reindex
obsidian-rag install-service                  # macOS launchd auto-start
obsidian-rag uninstall-service                # remove service
obsidian-rag service-status                   # check service status

MCP Tools

Once connected, your AI assistant has access to:

Tool What it does
search_notes Find notes matching a query
get_similar Find notes similar to a given note
get_note_context Get a note with related context
get_stats Show index statistics
reindex Rebuild the index

Keeping the Index Fresh

Manual: obsidian-rag index

Auto-reindex on file changes: obsidian-rag watch (run in a terminal or background)

macOS background service: obsidian-rag install-service (starts on login, appears in System Settings > Login Items)

Using Ollama (local, no API key)

ollama pull nomic-embed-text
obsidian-rag --provider ollama index

Using LM Studio (local, no API key)

Load an embedding model in LM Studio, then:

obsidian-rag --provider lmstudio index

Configuration

The setup wizard writes to ~/.config/obsidian-notes-rag/config.toml. You can also override with environment variables:

Variable Description
OPENAI_API_KEY OpenAI API key
OBSIDIAN_RAG_PROVIDER openai (default), ollama, or lmstudio
OBSIDIAN_RAG_VAULT Path to Obsidian vault
OBSIDIAN_RAG_DATA Index storage path (default: platform-specific)
OBSIDIAN_RAG_OLLAMA_URL Ollama URL (default: http://localhost:11434)
OBSIDIAN_RAG_LMSTUDIO_URL LM Studio URL (default: http://localhost:1234)
OBSIDIAN_RAG_MODEL Override embedding model

How it works

  1. Parses markdown files, strips YAML frontmatter
  2. Chunks content using Chonkie's RecursiveChunker (splits by headings > paragraphs > lines > sentences, max 1500 tokens per chunk)
  3. Generates embeddings via your chosen provider
  4. Stores metadata in SQLite, vectors in sqlite-vec (KNN search via vec0 virtual tables)
  5. MCP server and CLI both query the same local database

Upgrading

If you installed the CLI with uv tool install, upgrade with:

uv tool upgrade obsidian-notes-rag

If you use uvx to run commands or the MCP server, it automatically uses the latest version.

Upgrading to v1.0.0

v1.0.0 replaces ChromaDB with sqlite-vec. After upgrading, rebuild your index:

obsidian-rag index --clear

The old ChromaDB data at ~/.local/share/obsidian-notes-rag/ (or your configured path) can be deleted.

Contributing

See CONTRIBUTING.md for development setup.

Support

Buy Me A Coffee

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选