Obsidian Semantic Search

io.github.DalecB由 GitHub 帳號 DalecB 發布v0.2.1更新於 Oct 24, 2026

Read-only semantic search MCP server for Obsidian vaults using local Ollama embeddings.

已驗證STDIO僅桌面檔案與儲存知識與記憶

概覽

AI 產生的概覽

唯讀的 MCP 伺服器,讓助理使用本機 Ollama 嵌入對本機 Obsidian 筆記庫進行語意搜尋與讀取。

可以做什麼
以混合語意、關鍵字或向量排序搜尋筆記,回傳檔案層級的比對結果,包含標題、片段與行號範圍,解鎖後可包含敏感資料夾。依筆記庫內相對路徑讀取整篇筆記或指定行範圍。建立或更新外部 SQLite 索引,可增量執行或針對指定檔案,並檢視索引中繼資料與目前的安全設定。
適用情境
適合需要讓助理在 Obsidian 筆記庫中找到並閱讀正確筆記、但不允許寫入、編輯、移動或刪除筆記的情境,也適合希望嵌入與索引都留在本機的使用者。適用於「哪篇筆記說明了這個決定」「我在哪裡寫過某個主題」這類檢索問題。
執行需求
透過 npx 以 stdio 在本機執行,需要 Node.js 24 或更新版本、已拉取嵌入模型的 Ollama 服務(預設 bge-m3)以及一個 MCP 用戶端。必須將環境變數 OBSIDIAN_VAULT_ROOT 設為筆記庫的絕對路徑;選用變數包括索引目錄、Ollama 位址、嵌入模型、排除資料夾與敏感資料夾。
安裝前請注意
它會讀取筆記庫並在本機建立包含片段與嵌入向量的 SQLite 索引,應將該索引視為筆記的衍生副本。敏感資料夾預設被封鎖,只有將 OBSIDIAN_SEMANTIC_ALLOW_SENSITIVE 設為 true 才能解鎖;OBSIDIAN_SEMANTIC_EXCLUDE 中的資料夾永不索引、搜尋或讀取。Ollama 位址可設定,若指向遠端位址會把筆記內容傳送到本機之外。專案仍為早期預覽,排序行為與工具結構可能變動。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Obsidian Semantic Search,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Obsidian Semantic Search MCP

Read-only semantic retrieval for agents that need to find the right Obsidian note without write access.

[npm] [MCP Registry] [License] [Node.js]

한국어 · Quick Start · Why This Exists · How It Works


Your Obsidian vault is useful only if your agent can find the right note.

Keyword search misses context. Full write-capable Obsidian MCP servers expose more power than a retrieval agent needs. Obsidian plugins are great inside Obsidian, but they are not always the right boundary for Codex, Claude Desktop, Cursor, or any other MCP client.

This project is the narrow version:

text
local Obsidian vault -> read-only scanner -> local SQLite index -> MCP search/read tools

No note writes. No cloud embeddings by default. No Obsidian plugin runtime. No sync service.

[Local, read-only pipeline: Obsidian vault to scanner to chunker to Ollama embeddings to SQLite index, queried by an MCP client via search_notes and read_note]

Status: 0.3.1 early preview. The server is usable today, but ranking behavior and tool schemas may change before 1.0.

What You Get

NeedWhat this server does
Find the note an agent should readHybrid semantic + keyword search over Markdown notes
Keep the vault safeExposes search/read/index/status only; no write, patch, move, rename, or delete tools
Stay local-firstUses Ollama embeddings and stores the index on your machine
Make results agent-friendlyReturns file-level matches with headings, snippets, and line ranges
Avoid plugin stateReads the vault directly from the filesystem; Obsidian does not need to be running

Example result shape:

json
{  "path": "02_Projects/RealtimeAPI/05_Interview_QA.md",  "title": "Interview Q&A",  "score": 0.7431,  "matched_sections": [    {      "heading": "Level 4 > Redis Lua atomicity",      "lines": [266, 305],      "reason": "semantic=1, keyword=0.5565, metadata=0.6"    }  ]}

Quick Start

Requirements:

  • Node.js >= 24
  • Ollama
  • An Obsidian vault
  • An MCP client such as Codex, Claude Desktop, Cursor, or another stdio MCP client

Install the embedding model:

bash
ollama pull bge-m3curl http://localhost:11434/api/tags

Print setup guidance:

bash
npx -y --package @dalecb/obsidian-semantic-mcp obsidian-semantic-mcp-setup

Codex Setup

Add this to ~/.codex/config.toml:

toml
[mcp_servers.obsidian_semantic]command = "npx"args = ["-y", "@dalecb/obsidian-semantic-mcp"]
[mcp_servers.obsidian_semantic.env]OBSIDIAN_VAULT_ROOT = "/path/to/your/Obsidian Vault"OBSIDIAN_SEMANTIC_MCP_HOME = "/Users/you/.obsidian-semantic-mcp"OLLAMA_BASE_URL = "http://localhost:11434"OBSIDIAN_EMBED_MODEL = "bge-m3"OBSIDIAN_SEMANTIC_AUTO_INDEX = "true"

Restart Codex, then run:

text
obsidian_semantic.index_statusobsidian_semantic.search_notes { "query": "Redis Lua atomicity", "limit": 5 }

Claude Code Setup

Add the server at user scope so the personal vault path stays out of project .mcp.json files:

bash
claude mcp add obsidian_semantic --scope user \  --env OBSIDIAN_VAULT_ROOT="/path/to/your/Obsidian Vault" \  --env OBSIDIAN_SEMANTIC_MCP_HOME="/Users/you/.obsidian-semantic-mcp" \  --env OLLAMA_BASE_URL="http://localhost:11434" \  --env OBSIDIAN_EMBED_MODEL="bge-m3" \  --env OBSIDIAN_SEMANTIC_AUTO_INDEX="true" \  -- npx -y @dalecb/obsidian-semantic-mcp
claude mcp get obsidian_semantic

Start a new Claude Code session and run /mcp to confirm the server is connected. On native Windows, use -- cmd /c npx -y @dalecb/obsidian-semantic-mcp after the environment flags.

See Anthropic's Claude Code MCP documentation for scope and command details.

Claude Desktop / JSON MCP Client Setup

In Claude Desktop, open Settings → Developer → Edit Config. This opens ~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows. Merge the following server into mcpServers:

json
{  "mcpServers": {    "obsidian_semantic": {      "command": "npx",      "args": ["-y", "@dalecb/obsidian-semantic-mcp"],      "env": {        "OBSIDIAN_VAULT_ROOT": "/path/to/your/Obsidian Vault",        "OBSIDIAN_SEMANTIC_MCP_HOME": "/Users/you/.obsidian-semantic-mcp",        "OLLAMA_BASE_URL": "http://localhost:11434",        "OBSIDIAN_EMBED_MODEL": "bge-m3",        "OBSIDIAN_SEMANTIC_AUTO_INDEX": "true"      }    }  }}

Fully quit and restart Claude Desktop. Cursor and other JSON-style stdio MCP clients can use the same mcpServers entry. On Windows, if npx is not found, use "command": "cmd" and prepend "/c", "npx" to args.

See the official local MCP server guide for Claude Desktop configuration and logs.

Why This Exists

This isn't aiming to be the most powerful Obsidian automation server. It aims to be the safest retrieval tool you can hand an agent.

Here's how it stacks up against the two tools it usually comes down to — a full-permission Obsidian MCP server (Local REST API based) and GBrain (a broader knowledge-compilation platform):

This projectFull-permission Obsidian MCPGBrain
Access modelRead-only: search / read / indexRead + write + edit + deleteRead + write; compiles notes into its own model
Touches your vaultNeverYesYes — restructures content
Obsidian must runNo — reads files directlyYes — needs the REST API pluginNo
Required local runtimeNode.js + OllamaObsidian + pluginStandalone platform
Embeddings & dataLocal Ollama by default; remote URL is configurableLocal API; embeddings vary by setupBuilt-in pipeline; optional sync
StorageOne SQLite file you can delete and rebuildPlugin-managedIts own store / migration
Best forA small read-only retrieval boundary for agentsFull vault automation and editingBuilding a compiled knowledge base across sources

That trade is on purpose: give up writing, editing, and running inside Obsidian, and you get fewer moving parts and a smaller blast radius in return.

Use this if your agent should answer:

  • "Which note explains this project decision?"
  • "Find the file where I wrote about idempotency payload mismatch."
  • "Show me the career notes related to this interview topic."
  • "Search my vault, but do not mutate it."

Do not use this if you want an Obsidian UI plugin, automatic note generation, or write-capable vault automation.

Tools

index_status

Returns index metadata and safety settings.

index_vault

Builds or updates the external SQLite index.

json
{ "mode": "incremental" }

Specific files:

json
{  "mode": "incremental",  "paths": ["02_Projects/My Note.md"]}

search_notes

Searches notes with hybrid semantic and keyword ranking.

json
{  "query": "live coding notes",  "limit": 8,  "mode": "hybrid"}

Modes:

  • hybrid: semantic vector + SQLite FTS5 + metadata boosts
  • semantic: vector-first search
  • keyword: FTS5 keyword search without embedding the query

read_note

Reads a note or line range by vault-relative path.

json
{  "path": "02_Projects/My Note.md",  "start_line": 10,  "end_line": 40}

How It Works

text
index_vault  -> scan Markdown files under OBSIDIAN_VAULT_ROOT  -> block denied paths and symlink escapes  -> split notes by Markdown headings  -> create one summary chunk per file  -> embed chunks with Ollama bge-m3  -> store notes, chunks, FTS rows, and vectors in SQLite
search_notes  -> incrementally index on first search or first search after a Markdown change  -> embed the query with Ollama  -> score vector similarity  -> score SQLite FTS5 keyword matches  -> apply title/path/heading metadata boosts  -> regroup chunk matches into file-level results

Default storage:

text
~/.obsidian-semantic-mcp/  data/semantic.sqlite

The vault remains the source of truth. The SQLite database is a derived index and can be deleted/rebuilt.

Safety Model

The server reads your vault and never writes to it. Three layers decide what an agent can see.

1. Always denied (system / tooling). Never indexed, no override:

  • .obsidian/, .smart-env/, .claude/, .codex-*/
  • any hidden folder (name starts with .)
  • node_modules, cache, logs

2. Sensitive — denied by default, unlockable. Stays blocked even when a tool call passes include_sensitive: true, unless the server is started with OBSIDIAN_SEMANTIC_ALLOW_SENSITIVE=true. Defaults to 08_PersonalInfo/. Override the list with OBSIDIAN_SEMANTIC_SENSITIVE_PATHS (comma- or newline-separated folders):

toml
OBSIDIAN_SEMANTIC_SENSITIVE_PATHS = "08_PersonalInfo, 09_Finance"

3. Your own excludes — always denied. Folders you never want indexed, searched, or read. No unlock flag:

toml
OBSIDIAN_SEMANTIC_EXCLUDE = "03_Journal, Private, Clients/Acme"

Which one do you want?

  • "Don't index this at all" → OBSIDIAN_SEMANTIC_EXCLUDE
  • "Keep it locked, but I can unlock it with a flag when I need to" → OBSIDIAN_SEMANTIC_SENSITIVE_PATHS + OBSIDIAN_SEMANTIC_ALLOW_SENSITIVE

Additional guards:

  • All paths are resolved through realpath.
  • Path traversal and URL-encoded traversal are blocked.
  • Symlinks that escape the vault root or point to a denied in-vault path are blocked.

search_notes and read_note enforce the current exclusion settings on every call. With automatic indexing enabled, the next search also removes excluded stale rows from the index. Confirm the active lists with index_status.

The local index stores snippets and embedding vectors. Treat it as a derived copy of your vault. See PRIVACY.md.

Indexing Strategy

The default is action-driven, not timer-based:

  1. The first search_notes after server start.
  2. The first search_notes after a Markdown create, update, delete, or rename event.
  3. The first search_notes after the embedding model or index format changes; this triggers a full rebuild.
  4. An explicit index_vault call.

The filesystem watcher only marks the index dirty. Indexing runs once, immediately before the next search, and concurrent searches share that work. If recursive watching is unavailable, the server falls back to an incremental scan before every search.

Disable automatic indexing with:

toml
OBSIDIAN_SEMANTIC_AUTO_INDEX = "false"

Then call index_vault { "mode": "incremental" } yourself. The legacy OBSIDIAN_SEMANTIC_STARTUP_INDEX=true remains supported, but is not the default because it does work even when no search follows.

Search Quality Evaluation

Create a JSON file containing queries and expected paths to compare keyword, semantic, and hybrid modes under the same conditions:

json
[  { "query": "strong consistency at 1000 TPS", "expected_paths": ["03_Knowledge/QnA/Strong-Consistency-at-1000TPS.md"] }]
bash
npm run evaluate -- ./queries.json 5

The command reports Recall@K and MRR. Avoid adding ranking complexity or embedding cost unless hybrid search measurably beats the keyword baseline.

Refresh the index with search_notes or index_vault before evaluating.

Development

bash
npm testnpm run pack:check

Before publishing:

bash
npm pack --dry-run

Confirm the package does not include data/, *.sqlite, or private vault files.

License

MIT

來源:README.md,提交 0e01b3a

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.2.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分