Obsidian MCP Server

Obsidian MCP Server

Provides AI assistants with tools to manage Obsidian notes via hybrid semantic search (BM25, Voyage AI, Cohere), full CRUD, backlinks, and live indexing without restart.

Category
访问服务器

README

obsidian-mcp

MCP server for Obsidian vaults with hybrid semantic search.

Features

  • Hybrid search: BM25 + Voyage AI embeddings + Cohere reranking
  • Backlinks: Pre-computed wikilink graph
  • Similar notes: Discover hidden connections
  • Full CRUD: Create, read, update, delete, move notes
  • Live indexing: Index notes directly from Claude Code without restart

Installation

cd obsidian-mcp
uv sync

Configuration

  1. Copy .env.example to .env and add your API keys:
VOYAGE_API_KEY=your_key
COHERE_API_KEY=your_key  # optional
  1. Set your vault path in config/settings.yaml:
vault:
  path: "D:\\path\\to\\your\\vault"

Usage

Recommended Workflow (via MCP)

The recommended workflow is to use the MCP tools directly from Claude Code:

1. write   -> Create or modify a note (auto-indexes by default)
2. search  -> Note is instantly searchable

Notes are automatically indexed after write, so manual indexing is only needed for:

  • Notes created manually in Obsidian (use index tool)
  • Bulk imports (use index with full=True)

Interactive Menu

python obsidian-menu.py

CLI

# Full indexation
python obsidian-cli.py --vault "/path/to/vault" index --full

# Incremental indexation
python obsidian-cli.py --vault "/path/to/vault" index

# Status
python obsidian-cli.py --vault "/path/to/vault" status

# Search
python obsidian-cli.py --vault "/path/to/vault" search "query"

Note: CLI indexation requires a Claude Code restart for changes to be visible in MCP searches due to ChromaDB caching. Use the index MCP tool instead for live updates.

Claude Code Configuration

Option 1: HTTP/SSE Server (Recommended)

Run as a shared HTTP server to avoid duplicating processes across Claude sessions.

1. Start the HTTP server:

uv run python -m src.server_http
# Server runs on http://127.0.0.1:8322/mcp

2. Configure Claude Code (~/.claude.json):

{
  "mcpServers": {
    "obsidian": {
      "type": "sse",
      "url": "http://127.0.0.1:8322/mcp"
    }
  }
}

3. (Optional) Run as systemd service (Linux):

# Create ~/.config/systemd/user/obsidian-mcp.service
[Unit]
Description=Obsidian MCP HTTP Server
After=network.target

[Service]
Type=simple
WorkingDirectory=/path/to/obsidian-mcp
Environment="VOYAGE_API_KEY=your_key"
Environment="COHERE_API_KEY=your_key"
Environment="OBSIDIAN_VAULT=/path/to/vault"
ExecStart=/path/to/uv run python -m src.server_http
Restart=on-failure

[Install]
WantedBy=default.target

# Enable and start
systemctl --user daemon-reload
systemctl --user enable --now obsidian-mcp

Option 2: Stdio (per-session)

Add to ~/.claude.json:

{
  "mcpServers": {
    "obsidian": {
      "command": "uv",
      "args": ["--directory", "/path/to/obsidian-mcp", "run", "python", "-m", "src.server"],
      "env": {
        "VOYAGE_API_KEY": "your_key",
        "COHERE_API_KEY": "your_key",
        "OBSIDIAN_VAULT": "/path/to/vault"
      }
    }
  }
}

MCP Tools

Tool Description
search Hybrid semantic search (BM25 + embeddings + reranking)
read Read note with metadata and frontmatter
write Create or update note (auto-indexes by default)
delete Delete note
move Move or rename note
list List notes with folder/tag filters
backlinks Find notes linking to a note
similar Find semantically similar notes
index Index new/modified notes (live, no restart)
refresh Rebuild BM25 index from ChromaDB
reload Reset all caches and connections

Auto-Indexing (Write Tool)

By default, write automatically indexes the note after creating or modifying it:

# Auto-indexes after writing (default)
write(path="Notes/my_note.md", content="...")

# Disable auto-indexing if needed
write(path="Notes/my_note.md", content="...", auto_index=False)

This makes new notes instantly searchable without manual indexing.

Index Tool

The index tool indexes notes directly within the MCP server process, avoiding ChromaDB cache synchronization issues:

# Incremental indexation (default)
index()  # Only indexes new/modified notes

# Full reindexation
index(full=True)  # Reindexes all notes

Why use index instead of CLI?

ChromaDB maintains an HNSW index cache per process. When you index via CLI (separate process), the MCP server doesn't see the changes until restart. The index tool solves this by:

  1. Running indexation in the same process as the MCP server
  2. Resetting internal caches after indexation
  3. Making new notes immediately searchable

Project Structure

obsidian-mcp/
  src/
    server.py           # MCP server (11 tools)
    indexer.py          # Indexation engine
    retriever.py        # Hybrid search (BM25 + semantic + RRF)
    note_parser.py      # Obsidian markdown parser
    wikilink_graph.py   # Backlink graph
  config/
    settings.yaml       # Configuration
  chroma_db/            # Vector database (ChromaDB)
  obsidian-cli.py       # CLI interface
  obsidian-menu.py      # Interactive menu

Technical Details

Hybrid Search Pipeline

  1. BM25: Lexical search for exact term matching
  2. Semantic: Voyage AI embeddings (voyage-3) for meaning
  3. Fusion: Reciprocal Rank Fusion (RRF) combines results
  4. Reranking: Cohere reranker (rerank-v4.0-pro) for final ordering

Embedding Model

  • Model: voyage-3
  • Dimensions: 1024
  • Provider: Voyage AI

Database

  • ChromaDB with persistent storage
  • SQLite backend with WAL mode
  • HNSW index for fast similarity search

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

官方
精选