Skip to main content
Glama
obsidian-mcp-server

obsidian-mcp-server

by mpesavento

obsidian-mcp-server

MCP server providing read/write access to an Obsidian vault. Supports both local (stdio) and remote (HTTP) transports with OAuth 2.1 and bearer token authentication.

Tools

CRUD Operations

Tool

Description

vault_read

Read a note's content + parsed YAML frontmatter

vault_write

Create or overwrite a note (auto-manages timestamps and attribution in frontmatter; keeps an existing note's frontmatter if you pass none)

vault_append

Append content to a note with separator (ideal for log entries)

vault_delete

Soft-delete to .trash/

vault_move

Move or rename a note, rewriting links to it in other notes (details)

Search & Discovery

Tool

Description

vault_search

Full-text search (ripgrep with Node.js fallback)

vault_list

List files/folders in a directory

vault_recent

Recently modified notes

vault_frontmatter

Read or atomically update frontmatter fields

vault_info

Vault stats and folder structure

Semantic Search (QMD)

Tool

Description

vault_semantic_search

BM25 keyword search — fast, local, always available

vault_vector_search

Embedding-based similarity search (requires qmd embed)

vault_hybrid_search

BM25 + query expansion + LLM reranking

vault_search_status

Check QMD index status and embedding availability

vault_search_update

Update the QMD index after vault changes

Note: Semantic search tools require QMD to be installed (npm i -g @tobilu/qmd) and the vault indexed (qmd collection add /path/to/vault --name exobrain). See docs/deployment.md for setup.

vault_move keeps the vault's links valid. Unless you pass update_links: false, it rewrites links in other notes that point at the moved note:

  • wikilinks and embeds: [[note]], [[folder/note]], [[../note]], ![[note]], with #heading, #^block, |alias and the escaped pipe used in tables (\|) preserved

  • markdown links to notes: [text](folder/note.md#heading)

  • links inside code blocks and inline code are left alone

A bare [[name]] keeps working after a folder-only move and is renamed when the file name changes. Where a bare name would become ambiguous it is rewritten as a vault-root path.

Edits are made on the raw text, so the frontmatter of rewritten notes is not re-serialized (bare dates stay bare) and their modified / last_modified_by are not touched.

Not rewritten, but reported in the result:

  • notes matching LINK_REWRITE_SKIP (default: 10-identity/**, 60-daily/**, **/decisions.md, 00-meta/agent-comms/**) are listed under protected_skipped

  • links whose bare name is shared by several notes are listed under ambiguous

vault_move never overwrites an existing note (ALREADY_EXISTS), and dry_run: true returns the plan without changing anything. Resolution is case-insensitive, like Obsidian's. Not handled: links to headings that were renamed, markdown links whose path contains spaces or <>, and links written in HTML.

Related MCP server: Nix

Quick Start

npm install
npm run build

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "obsidian-vault": {
      "command": "node",
      "args": ["/path/to/obsidian-mcp-server/dist/index.js"],
      "env": {
        "VAULT_PATH": "/path/to/your/vault"
      }
    }
  }
}

Claude Code

claude mcp add obsidian-vault \
  -e VAULT_PATH=/path/to/your/vault \
  -- node /path/to/obsidian-mcp-server/dist/index.js

Remote (HTTP mode)

# Create .env from template
cp .env.example .env
# Edit .env: set VAULT_PATH, AUTH_TOKEN, SERVER_URL

# Start in HTTP mode
node dist/index.js --transport http

Connect Claude Code remotely:

claude mcp add obsidian-vault \
  --transport http \
  https://your-server-url/ \
  --header "Authorization: Bearer YOUR_TOKEN"

Configuration

Variable

Required

Default

Description

VAULT_PATH

Yes

—

Absolute path to Obsidian vault root

AUTH_TOKEN

No

—

Static bearer token for Claude Code remote access

PORT

No

3100

HTTP server port

AGENT_NAME_DEFAULT

No

claude

Default agent name for frontmatter attribution

SERVER_URL

No

http://localhost:PORT

Public URL (for OAuth metadata endpoints)

LINK_REWRITE_SKIP

No

10-identity/**,60-daily/**,**/decisions.md,00-meta/agent-comms/**

Comma-separated globs (*, **) of notes vault_move must not edit when rewriting links; they are reported instead. Empty string protects nothing

Deployment

See docs/deployment.md for detailed instructions on:

  • Raspberry Pi + Tailscale Funnel

  • Google Cloud Run

  • Security considerations

Development

npm run dev          # Watch mode (recompile on changes)
npm test             # Run tests
npm run lint         # Type-check without emitting

Architecture

src/
├── index.ts              # Entry point (--transport stdio|http)
├── server.ts             # McpServer factory + tool registration
├── config.ts             # Environment config with Zod validation
├── vault.ts              # Filesystem ops, path validation, atomic writes, frontmatter
├── links.ts              # Link parsing, resolution and rewriting for vault_move (pure functions)
├── auth/
│   ├── provider.ts       # OAuth 2.1 server (TOTP consent gate, redirect allowlist)
│   └── bearer.ts         # Dual token verifier (OAuth + static bearer)
├── transport/
│   ├── stdio.ts          # Stdio transport (Claude Desktop / Code local)
│   └── http.ts           # Express + Streamable HTTP + OAuth routes
├── search/
│   ├── ripgrep.ts        # rg subprocess search
│   └── native.ts         # Node.js fallback (glob + regex)
└── tools/
    ├── crud.ts           # vault_read/write/append/delete/move
    ├── search.ts         # vault_search/list/recent
    └── metadata.ts       # vault_frontmatter/info

Security

The HTTP transport is meant to be reachable from the public internet, and it requires a TOTP consent gate to start. See SECURITY.md for the threat model, controls and rotation procedure.

License

MIT. See LICENSE.

Available Tools

14 tools
vault_appendAppend to NoteA

Append content to an existing note with a separator. Updates modified timestamp and last_modified_by in frontmatter. Ideal for log entries and incremental additions.

Inputs: path (required), content (required), separator, agent_name.

vault_deleteDelete NoteB

Soft-delete a note by moving it to .trash/. The file can be recovered from .trash/ if needed.

Inputs: path (required).

vault_frontmatterRead/Update FrontmatterA

Read or atomically update specific YAML frontmatter fields on a note without touching the body content. If 'updates' is omitted, returns the current frontmatter. If provided, merges the updates into existing frontmatter.

Inputs: path (required), updates.

vault_grepGrep VaultA

Full-text grep search across vault notes. Uses ripgrep if available, falls back to pure Node.js search. Case-insensitive. Use vault_search for semantic/keyword search instead.

Inputs: query (required), max_results, path_filter.

vault_infoVault InfoA

Get vault statistics: total file count, total size, and top-level directory structure.

Inputs: no named parameters.

vault_listList Vault ContentsB

List files and folders in a vault directory. Excludes .obsidian, .trash, and .git directories.

Inputs: path, depth, pattern, recursive.

vault_moveMove NoteA

Move or rename a note within the vault. Creates destination directories if needed and refuses to overwrite an existing note. By default, links to the note in other notes (wikilinks, embeds, markdown links; alias/#heading/^block kept) are rewritten, so nothing dangles. Notes in protected zones (LINK_REWRITE_SKIP, default: identity, daily notes, decisions.md, agent-comms) are never edited; they are listed in protected_skipped. Ambiguous links (several notes share the name) are listed, not guessed. Use dry_run to preview.

Inputs: to_path (required), from_path (required), dry_run, update_links.

vault_patchPatch NoteA

Replace a unique string in a note with another string. The old_str must appear exactly once in the file content (not frontmatter). Use for surgical edits: updating links, fixing sections, replacing status fields. Updates modified timestamp.

Inputs: path (required), new_str (required), old_str (required), agent_name.

vault_readRead NoteA

Read a note from the vault. Returns parsed YAML frontmatter and body content separately.

Inputs: path (required).

vault_recentRecent NotesA

Get the most recently modified notes in the vault, sorted by modification time (newest first).

Inputs: n, path_filter.

vault_search_statusSearch Index StatusA

Check the status of the vault search index (QMD). Shows whether the index exists, when it was last updated, and if embeddings are available for vector search.

Inputs: no named parameters.

vault_search_updateUpdate Search IndexA

Update the vault search index to reflect recent file changes. Run this after adding or modifying many files to ensure search results are current.

Inputs: no named parameters.

vault_writeWrite NoteA

Create or overwrite a note. Auto-manages created/modified timestamps and created_by/last_modified_by in frontmatter. If the file exists, preserves original created/created_by values, and keeps its existing frontmatter when you pass none. A non-empty frontmatter object REPLACES the existing fields (use vault_frontmatter to change individual fields).

Inputs: path (required), content (required), agent_name, create_dirs, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 14 tools

    Disambiguation4/5

    Each tool targets a distinct operation (read, write, patch, append, delete, move, frontmatter, search, list, info). The one real overlap is vault_grep vs vault_search, but the descriptions explicitly differentiate them (grep = exact full-text, search = vector/BM25), and vault_read vs vault_frontmatter differ by scope. Minor residual ambiguity but well handled.

    Naming Consistency5/5

    Every tool follows the vault_<noun/verb> snake_case pattern consistently (vault_read, vault_write, vault_search_status, vault_frontmatter). No mixed conventions or inconsistent casing.

    Tool Count5/5

    14 tools sits comfortably within a well-scoped range. Each tool earns its place—core CRUD, navigation, and search/indexing are all represented without redundancy.

    Completeness4/5

    Full note lifecycle is covered: create/overwrite, surgical edits, append, soft-delete, move/rename with link rewriting, and frontmatter management, plus multiple search modes and index maintenance. Minor gaps remain (no directory-level create/rename/delete, no tag or backlink-graph query), but agents can work around these.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers