Skip to main content
Glama
obsidian-mcp

obsidian-mcp

by shaynemeyer

obsidian-mcp

A FastMCP server for multiple Obsidian vaults. It talks to the Obsidian Local REST API plugin when Obsidian is running, and falls back to direct filesystem access when it isn't — so your notes stay reachable whether or not the app is open.

Every tool takes an optional vault argument, and obsidian_switch_vault sets the default for unqualified calls.

Why both backends

REST (Obsidian running)

Filesystem (always)

Search

Obsidian's own index and ranking

substring scan, all terms must match

Tags

resolved by Obsidian, with counts

parsed from frontmatter + inline #tags

Backlinks

✅ from the link graph

❌ not available

Active note / open in UI / commands

✅

❌

Works with Obsidian closed

❌

✅

Works on a headless box or over SSH

❌

✅

The router probes REST health once and caches the result for OBSIDIAN_HEALTH_TTL seconds, so a closed Obsidian doesn't cost a failed connection on every call. If REST drops mid-call it retries on the filesystem automatically. Errors that mean "what you asked for doesn't exist" (missing note, bad path) are not retried — falling back would just fail again, slower.

Every response reports which backend served it, so a caller can tell whether it's seeing Obsidian's view or the raw files.

Related MCP server: Obsidian MCP Server

Setup

git clone <your-repo> obsidian-mcp && cd obsidian-mcp
uv venv && uv pip install -e ".[dev]"     # or: pip install -e ".[dev]"
pytest

Requires Python 3.11+. Works with MCP Python SDK 1.x (FastMCP) and 2.x (MCPServer) — _sdk.py papers over the rename.

Configuring vaults

Define vaults using whichever of these fits; the first one present wins.

A TOML file (best for 3+ vaults) — OBSIDIAN_VAULTS_FILE=~/.config/obsidian-mcp/vaults.toml:

default = "personal"

[vaults.personal]
path = "/Users/you/Vaults/Personal"
description = "Homelab, hobbies"
daily_folder = "Journal"

[vaults.work]
path = "/Users/you/Vaults/Work"
description = "Employer notes"
rest_base_url = "https://127.0.0.1:27125"   # note: NOT the default port
api_key = "this-vault's-own-key"

Inline JSON — OBSIDIAN_VAULTS='{"default":"work","vaults":{...}}'. Accepts port/protocol/host shorthand instead of rest_base_url, and camelCase keys, so configs from other Obsidian MCP servers mostly paste straight in.

Per-vault env vars — OBSIDIAN_VAULT_WORK_PATH, OBSIDIAN_VAULT_WORK_API_KEY, OBSIDIAN_VAULT_WORK_REST_BASE_URL, etc. The segment between OBSIDIAN_VAULT_ and the field name is the vault name.

Legacy single-vault vars — OBSIDIAN_VAULT_PATH / OBSIDIAN_REST_BASE_URL / OBSIDIAN_API_KEY still work and define one vault named default.

⚠️ One port per vault

Every vault's Local REST API plugin defaults to port 27124, and only one process can bind a port. If you run two vaults at once, open each vault's Settings → Local REST API → Advanced and give it a unique port (27124, 27125, 27126…), then toggle the plugin off and on.

Each vault also generates its own API key, so a mismatched port usually shows up as a 401 rather than silently reading the wrong vault. To check positively:

obsidian_backend_status(verify=true)

That cross-checks each vault's REST root listing against its configured path and warns if they disagree.

Per-vault settings

path, rest_base_url, api_key, verify_ssl, ca_cert, daily_folder, daily_format, description

Global settings

Variable

Default

Notes

OBSIDIAN_DEFAULT_VAULT

first defined

Overrides default in the config file.

OBSIDIAN_PREFER_REST

true

Set false to always use the filesystem.

OBSIDIAN_READ_ONLY

false

Disables every mutating tool, across all vaults.

OBSIDIAN_MAX_FILE_BYTES

2000000

Refuse to read anything larger.

OBSIDIAN_HEALTH_TTL

20

Seconds to cache each vault's REST health probe.

OBSIDIAN_REQUEST_TIMEOUT

15

Per-request timeout in seconds.

To trust the plugin's cert rather than disabling verification, per vault:

curl -k https://127.0.0.1:27125/obsidian-local-rest-api.crt -o ~/.config/obsidian-mcp/work.crt
# then in vaults.toml:  ca_cert = "~/.config/obsidian-mcp/work.crt"  and  verify_ssl = true

Register it

Claude Code:

claude mcp add obsidian -- \
  uv --directory /path/to/obsidian-mcp run obsidian-mcp

Then set the env vars in .mcp.json or your shell profile.

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "obsidian": {
      "command": "uv",
      "args": ["--directory", "/path/to/obsidian-mcp", "run", "obsidian-mcp"],
      "env": {
        "OBSIDIAN_VAULTS_FILE": "/Users/you/.config/obsidian-mcp/vaults.toml"
      }
    }
  }
}

Tools

Vaults — obsidian_list_vaults, obsidian_switch_vault

Reads — obsidian_list_notes, obsidian_read_note, obsidian_search_notes, obsidian_list_tags, obsidian_get_active_note*, obsidian_backend_status

Writes — obsidian_write_note, obsidian_append_to_note, obsidian_patch_note, obsidian_append_to_daily_note, obsidian_move_note, obsidian_delete_note

App control — obsidian_open_note, obsidian_list_commands, obsidian_run_command*

* requires Obsidian to be running. These deliberately do not fall back — they return a message telling you to start Obsidian, rather than silently doing something different from what you asked.

All 17 tools accept an optional vault. Targeting works two ways, on purpose:

  • Per-call — obsidian_search_notes(vault="work", query="..."). Explicit and stateless; the right choice when a task spans vaults.

  • Session default — obsidian_switch_vault(vault="work") changes where unqualified calls go, so a long stretch of work in one vault doesn't repeat the argument.

A per-call vault always overrides the session default. Switching affects this server session only — it doesn't touch any vault's contents or change which vault Obsidian has open.

obsidian_backend_status is the one to call first when something fails with a connectivity error; with no vault named it probes all of them and reports which backends are live.

Safety choices

  • Deletes are recoverable by default. obsidian_delete_note moves the note to the vault's .trash, restorable from inside Obsidian. permanent=true is opt-in. Because the plugin's DELETE is unconditional, trashing is routed through the filesystem backend even when REST is live.

  • Absolute paths and .. traversal are rejected, not silently rewritten. Resolved paths are checked against the vault root.

  • obsidian_write_note won't clobber an existing note without overwrite=true.

  • OBSIDIAN_READ_ONLY=true disables every mutating tool in one switch — useful for a research-only session.

Known limitations

  • Moving a note does not rewrite wikilinks. Only Obsidian does that, and only for moves made inside the app. Search for the old name afterwards if it matters.

  • Frontmatter patches reformat the YAML block. Values round-trip through PyYAML, so tags: [a, b] comes back as a block list. Content is preserved; formatting isn't.

  • Filesystem search has no fuzzy matching or ranking beyond a title-match boost. When Obsidian is running you get its real index instead.

  • The filesystem backend doesn't see unsaved editor buffers. A note being actively edited may be stale on disk by a few seconds.

  • Cross-vault operations aren't atomic. obsidian_move_note works within one vault only; moving between vaults means read, write, delete as separate calls.

  • obsidian_get_active_note is per-vault, and only answers for a vault whose Obsidian window is open with the plugin bound to that vault's configured port.

Worth knowing before you build on this

As of v3+, the Local REST API plugin ships its own built-in MCP server at https://127.0.0.1:27124/mcp/ (streamable HTTP, bearer auth). If all you want is Obsidian access while Obsidian is running, point your client at that and skip this project entirely.

This server earns its place when you want the things that one can't do: working with the vault while Obsidian is closed, running on a headless machine, read-only enforcement, trash-by-default deletes, or custom workflow tools shaped around your own vault conventions.

Development

pytest                    # 40 tests, no Obsidian required
ruff check obsidian_mcp tests
npx @modelcontextprotocol/inspector uv --directory . run obsidian-mcp

The test suite fakes the REST backend, so fallback and multi-vault routing are covered without a running Obsidian.

Available Tools

17 tools
obsidian_append_to_daily_noteA

Append to the daily note for today or a given date, creating it if needed.

The daily note path is built from OBSIDIAN_DAILY_FOLDER and OBSIDIAN_DAILY_FORMAT, so it works whether or not Obsidian is running.

Args: params (DailyNoteInput): - content (str): Markdown to append - day (Optional[str]): ISO date 'YYYY-MM-DD'; defaults to today - heading (Optional[str]): Append under an existing heading instead of at the end of the note

Returns: str: JSON of the shape {"status": "ok", "action": "appended"|"patched", "path": str, "backend": "rest"|"filesystem", "note": str} On failure: "Error: "

Inputs: params (required). Returns: result

obsidian_append_to_noteA

Add markdown to the end of a note, creating the note if it does not exist.

Safe by design: nothing already in the note is modified. Repeated calls append repeatedly.

Args: params (AppendNoteInput): - path (str): Vault-relative path - content (str): Markdown to append

Returns: str: JSON of the shape {"status": "ok", "action": "appended", "path": str, "backend": "rest"|"filesystem"} On failure: "Error: "

Inputs: params (required). Returns: result

obsidian_backend_statusA
Read-onlyIdempotent

Report, per vault, which backend is live and which capabilities are usable.

Call this first when a tool fails with a connectivity error, or when you need to know whether backlinks, the active note, and commands work right now. With no vault named it probes every configured vault.

Set verify=true to cross-check that each vault's REST port is really serving the vault at its configured path. Worth doing after adding a vault or changing ports, since every vault's plugin defaults to port 27124 and they collide.

Args: params (StatusInput): - vault (Optional[str]): One vault to check; omit to check all - verify (bool): Also cross-check REST endpoint against vault path - response_format (str): unused; JSON is always returned

Returns: str: JSON of the shape {"current_vault": str, "read_only": bool, "vaults": [{"vault": str, "rest_configured": bool, "rest_reachable": bool, "rest_base_url": str|null, "filesystem_configured": bool, "vault_path": str|null, "active_backend": "rest"|"filesystem", "obsidian_only_features_available": bool, "is_current": bool, "identity": {...}}]} On failure: "Error: "

Inputs: params. Returns: result

obsidian_delete_noteA
DestructiveIdempotent

Delete a note, by default into the vault's .trash folder.

A default delete is recoverable: the note moves to '.trash' inside the vault and can be restored from Obsidian. Pass permanent=true only when the note should be unrecoverable.

Args: params (DeleteNoteInput): - path (str): Vault-relative path to delete - permanent (bool): True deletes outright and cannot be undone

Returns: str: JSON of the shape {"status": "ok", "action": "trashed"|"deleted", "path": str, "backend": "rest"|"filesystem", "note": str} where path is the .trash location for a recoverable delete. On failure: "Error: "

Inputs: params (required). Returns: result

obsidian_get_active_noteA
Read-onlyIdempotent

Read whichever note is currently open in the Obsidian window.

Requires Obsidian to be running with the Local REST API plugin — there is no filesystem equivalent of "the active note".

Args: params (EmptyInput): - response_format (str): 'markdown' or 'json'

Returns: str: Same shape as obsidian_read_note. On failure: "Error: Cannot read the active note: "

Inputs: params. Returns: result

obsidian_list_commandsA
Read-onlyIdempotent

List every command in Obsidian's command palette, with IDs for running them.

Requires Obsidian to be running with the Local REST API plugin.

Returns: str: JSON of the shape {"count": int, "commands": [{"id": str, "name": str}]} On failure: "Error: "

Args: params (VaultOnlyInput): - vault (Optional[str]): Which vault's Obsidian window to query

Inputs: params. Returns: result

obsidian_list_notesA
Read-onlyIdempotent

List notes and folders in the vault, optionally scoped to one folder.

Use this to discover the vault's structure before reading or writing. For finding a note by its contents, obsidian_search_notes is faster.

Args: params (ListNotesInput): - folder (str): Vault-relative folder, empty for the root - recursive (bool): Walk nested folders too - response_format (str): 'markdown' or 'json'

Returns: str: Markdown list, or JSON of the shape {"folder": str, "count": int, "backend": "rest"|"filesystem", "entries": [{"path": str, "is_folder": bool, "size_bytes": int, "modified_at": str}]} On failure: "Error: "

Inputs: params (required). Returns: result

obsidian_list_tagsA
Read-onlyIdempotent

List every tag in the vault with how many notes use it.

Useful for orienting in an unfamiliar vault, or checking which tag spelling is already in use before adding a new one.

Args: params (EmptyInput): - response_format (str): 'markdown' or 'json'

Returns: str: Markdown table, or JSON of the shape {"count": int, "backend": "rest"|"filesystem", "tags": {"": int}} Tag names have no leading '#'. Counts may be 0 when the REST backend reports tags without usage data. On failure: "Error: "

Inputs: params. Returns: result

obsidian_list_vaultsA
Read-onlyIdempotent

List every configured vault, showing which one unqualified calls will hit.

Reads configuration only — it does not contact Obsidian, so it is cheap and safe to call first when you are unsure which vaults exist. For live reachability, use obsidian_backend_status.

Returns: str: JSON of the shape {"current_vault": str, "count": int, "vaults": [{"name": str, "description": str|null, "path": str|null, "rest_base_url": str|null, "backends": ["rest"|"filesystem"], "is_current": bool, "is_default": bool}]} On failure: "Error: "

Inputs: no named parameters. Returns: result

obsidian_move_noteA
Destructive

Move or rename a note, creating destination folders as needed.

Wikilinks elsewhere in the vault are NOT rewritten — Obsidian only updates links when the move happens inside the app. Search for links to the old name afterwards if that matters.

Args: params (MoveNoteInput): - source (str): Current vault-relative path - destination (str): New vault-relative path - overwrite (bool): Replace the destination if it exists

Returns: str: JSON of the shape {"status": "ok", "action": "moved", "path": str, "backend": "rest"|"filesystem", "note": str} On failure: "Error: "

Inputs: params (required). Returns: result

obsidian_open_noteA
Idempotent

Bring a note up in the Obsidian window.

Changes what the user sees but not the vault's contents. Requires Obsidian to be running with the Local REST API plugin.

Args: params (OpenNoteInput): - path (str): Vault-relative path to open

Returns: str: JSON {"status": "ok", "action": "opened", "path": str, "backend": "rest"} On failure: "Error: "

Inputs: params (required). Returns: result

obsidian_patch_noteA
Destructive

Insert content at a specific heading, block reference, or frontmatter key.

This is the surgical option: it edits one section and leaves the rest of the note byte-for-byte unchanged. Read the note first to confirm the target exists — a missing heading or block ID is an error, not a silent no-op.

Args: params (PatchNoteInput): - path (str): Vault-relative path to an existing note - target_type (str): 'heading', 'block', or 'frontmatter' - target (str): Heading text ('::' separates nesting levels), block ID without '^', or frontmatter key - content (str): Markdown to insert, or the frontmatter value - operation (str): 'append', 'prepend', or 'replace'

Returns: str: JSON of the shape {"status": "ok", "action": "patched", "path": str, "backend": "rest"|"filesystem"} On failure: "Error: ", including when the target heading or block ID does not exist.

Examples: - Add today's entry under a Log heading -> target_type='heading', target='Log', operation='append' - Set a status field -> target_type='frontmatter', target='status', content='active', operation='replace'

Inputs: params (required). Returns: result

obsidian_read_noteA
Read-onlyIdempotent

Read a note's content plus its tags, frontmatter, and links.

Backlinks are only populated when Obsidian is running, since they come from Obsidian's own link index.

Args: params (ReadNoteInput): - path (str): Vault-relative path, '.md' optional - include_content (bool): False for metadata only - response_format (str): 'markdown' or 'json'

Returns: str: Markdown rendering, or JSON of the shape {"path": str, "content": str, "frontmatter": object, "tags": [str], "links": [str], "backlinks": [str], "size_bytes": int, "modified_at": str, "source": "rest"|"filesystem"} On failure: "Error: "

Inputs: params (required). Returns: result

obsidian_run_commandA
Destructive

Run a command from Obsidian's command palette by ID.

Effects depend entirely on the command — some only change the view, others modify notes or invoke other plugins. Check obsidian_list_commands for valid IDs and prefer a specific tool when one exists.

Args: params (RunCommandInput): - command_id (str): ID from obsidian_list_commands

Returns: str: JSON {"status": "ok", "action": "executed", "command_id": str, "backend": "rest"} On failure: "Error: "

Inputs: params (required). Returns: result

obsidian_search_notesA
Read-onlyIdempotent

Full-text search across the vault, returning matching notes with context.

When Obsidian is running this uses its native search index and results are ranked the way they would be in the app. Otherwise it falls back to scanning files directly, which matches all terms as substrings.

Args: params (SearchNotesInput): - query (str): Search text; all terms must be present to match - context_length (int): Characters of context per match, 10-1000 - limit (int): Maximum notes returned, 1-100 - response_format (str): 'markdown' or 'json'

Returns: str: Markdown results, or JSON of the shape {"query": str, "count": int, "backend": "rest"|"filesystem", "results": [{"path": str, "score": float, "context": [str]}]} On no matches: a message suggesting broader terms. On failure: "Error: "

Inputs: params (required). Returns: result

obsidian_switch_vaultA
Idempotent

Change which vault subsequent unqualified tool calls target.

Changes this server session only — nothing in any vault is modified, and Obsidian's own open vault is unaffected. Prefer passing vault directly on a tool call for one-off access; switch when a long stretch of work lives in one vault. A vault argument on an individual call always overrides this.

Args: params (SwitchVaultInput): - vault (str): Name of the vault to make current

Returns: str: JSON of the shape {"status": "ok", "current_vault": str, "previous_vault": str, "path": str|null, "rest_base_url": str|null, "backends": ["rest"|"filesystem"]} On failure: "Error: Unknown vault ''. Configured vaults: ..."

Inputs: params (required). Returns: result

obsidian_write_noteA
DestructiveIdempotent

Create a note, or fully replace an existing one.

This overwrites the entire file. To add to a note without losing what is already there, use obsidian_append_to_note or obsidian_patch_note instead. Parent folders are created as needed.

Args: params (WriteNoteInput): - path (str): Vault-relative path - content (str): Complete markdown content - overwrite (bool): Required to replace an existing note

Returns: str: JSON of the shape {"status": "ok", "action": "created"|"replaced", "path": str, "backend": "rest"|"filesystem"} On failure: "Error: "

Inputs: params (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 17 tools

    Disambiguation5/5

    Every tool targets a distinct resource and action: reading (read_note, get_active_note), discovery (list_notes, search_notes, list_tags), writing (write_note, append_to_note, patch_note), and vault administration (list_vaults, switch_vault, backend_status). Overlapping write tools are clearly differentiated by insertion point and cross-reference each other.

    Naming Consistency4/5

    The overwhelming majority follow the obsidian_verb_noun pattern (list_notes, read_note, write_note, delete_note, run_command). Only obsidian_backend_status deviates by using a noun-noun name instead of a verb such as get_status or get_backend_status.

    Tool Count4/5

    17 tools is slightly above the ideal 3-15 range, but each tool earns its place covering vaults, notes, search, commands, and status. The granularity between append, patch, and append_to_daily_note is justified by real workflow differences.

    Completeness4/5

    Note CRUD is fully covered (create via write, read, update via write/append/patch, move, delete), plus discovery, search, tag listing, vault management, and Obsidian command execution. Minor gaps exist—such as no restore-from-trash tool and no explicit folder creation—but agents can work around them.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      D
      maintenance
      Enables natural language interaction with Obsidian vaults, supporting intelligent search, note CRUD operations, backlink analysis, and advanced knowledge management tools like narrative path generation and note cluster detection.
      17
      8
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables LLM clients to read, create, edit, delete, move, and search notes in local Obsidian vaults via direct filesystem access, including tag management and support for multiple vaults.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with Obsidian vaults by creating, reading, editing, deleting, searching, and organizing notes, tags, and folders across multiple vaults.
      16
      MIT