Obsidian MCP Server
The Obsidian MCP Server enables AI models to interact with Obsidian vaults via secure API communication, providing:
File Operations: List, retrieve, append, and update files in the vault, including hierarchical directory structures.
Search Capabilities: Perform full-text searches with context, execute complex JsonLogic queries, and filter files based on content or metadata.
Property Management: Retrieve and update YAML frontmatter properties, manage tags, titles, and custom fields.
Advanced Tools: Use JsonLogic for complex filtering, manage timestamps, and intelligently merge or replace properties.
Integration: Works with Obsidian's Local REST API plugin and provides a standardized interface via the Model Context Protocol.
Security: Offers API key authentication, rate limiting, and SSL options for secure operations.
Enables AI models to interact with Obsidian vaults through a standardized interface, providing file operations, search capabilities, and property management for knowledge bases in Obsidian
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Obsidian MCP Serversearch for notes about machine learning projects"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Overview
Obsidian vault notes over the Local REST API plugin. Read, search, and write notes, edit single headings, blocks, and frontmatter fields in place, and manage tags, with folder-scoped read/write permissions built in. Runs as a stdio process or a local Streamable HTTP server.
Tools
Tool | Description |
| Read a note as raw content, full structured form, document map, or a single section |
| List notes and folders under a vault path, recursively, with extension and name filters |
| List vault tags with usage counts, most-used first |
| Search by text, JSONLogic, or BM25-ranked Omnisearch when that plugin is reachable |
| Create a note, replace one section, or overwrite a whole file with |
| Append to a note (creating it if missing) or to one heading, block, or frontmatter field |
| Append, prepend, or replace against one heading, block reference, or frontmatter field |
| Literal or regex search-replace inside one note, body-only by default |
| Get, set, or delete one frontmatter key |
| Add, remove, or list a note's tags in frontmatter, inline, or both |
| Permanently delete a note, optionally after the user confirms ( |
| Open a file in the Obsidian app, optionally in a new pane |
| List command-palette commands (opt-in via |
| Run a command-palette command by ID (opt-in via |
Resources
Resource | Description |
| A note's content, frontmatter, tags, and file metadata |
| Every vault tag with its usage count, as an uncapped snapshot |
| Plugin reachability, auth status, versions, and registered API extensions |
Note and tag data are also reachable through tools (obsidian_get_note, obsidian_list_tags); obsidian://status has no tool equivalent.
Related MCP server: obsidian-headless-mcp
Capability reference
obsidian_get_note tool
targetis a vaultpath, theactivefile, or aperiodicnote (dailythroughyearly, optionaldate);formatiscontent,full,document-map, orsection, andfulltakesincludeLinks: truefor vault-internal outgoing linksresult.formatdiscriminates the payload; asectionread that matches several headings returns the first and lists every full path incandidatesA
pathwith no exact match but one case-insensitive match in its folder reads that file:result.pathis the real name,requestedPaththe one sent, and anoticenames both
obsidian_list_notes tool
Walks from
path(default vault root) todepth1–20 (default 2), filtered byextensionandnameRegex(≤256 chars); a folder that failsnameRegexis not walkedReturns
entries[](file/directory),totals, andappliedFilters; the walk stops at 1,000 entries withexcluded.reason: "entry_cap", and a folder the depth limit stopped carriestruncated: trueWith
OBSIDIAN_READ_PATHSset, a listing holds only readable entries and the folders leading to the scope; those folders are walked and accepted aspath
obsidian_list_tags tool
nameRegex(≤256 chars) andminCountnarrow the set, then tags are ranked by count and capped atlimit(default 200, max 10000); hierarchical parents count (work/tasksadds towork)When the cap withholds tags, the response carries
truncated,shown, andcapWith
OBSIDIAN_READ_PATHSset, only tags from readable notes are listed, andcountis the number of readable notes carrying the tag or a tag nested under it
obsidian_search_notes tool
mode: "text"requires every whitespace-split token ofqueryas a case-insensitive substring of the filename or body (quotes are literal), shaped bycontextLength(default 100),pathPrefix, andmaxMatchesPerHit(default 10);mode: "jsonlogic"evaluates alogictree overpath,content,frontmatter.<key>,tags, andstat, withglob/regexptaking[PATTERN, VALUE]result.modediscriminates the payload; every mode reportstotalCountand pages vianextCursor, and a text hit clipped tomaxMatchesPerHitcarriestruncatedandtotalMatchesmode: "omnisearch"(BM25 ranking, quoted phrases,-exclusion,path:/ext:filters) is offered only when the Omnisearch plugin answered at startup; its 50-hit upstream cap setstruncated: true
obsidian_write_note tool
targetandcontent, with optionalsectionandcontentType(markdown/json); a whole-file write to an existing note fails withfile_existsunlessoverwrite: trueWith
section, replaces only that heading, block, or frontmatter field and keeps the heading line; output reportscreated,sectionTargeted, and the resolvedsectionTarget
obsidian_append_to_note tool
Without
section, appends to the file or creates it (created: true); withsection, appends to that heading, block, or frontmatter field of an existing note, andcreateTargetIfMissing: truecreates the sectionA section append whose content is already at the target fails with
content_preexists; block targets add no separator, so startcontentwith a newline if you want one
obsidian_patch_note tool
operation: "append" | "prepend" | "replace"against onesectionof an existing note;patchOptionstakescreateTargetIfMissing,applyIfContentPreexists, andtrimTargetWhitespace(plugin v4.x only)Echoes the resolved
sectionandoperation; a repeat of content already at the target fails withcontent_preexistsunlessapplyIfContentPreexists: true
obsidian_replace_in_note tool
replacements[]run in order, each over the previous one's output; each takesuseRegex(≤1024 chars),caseSensitive(defaulttrue),wholeWord,flexibleWhitespace(literal mode only), andreplaceAll(defaulttrue)Returns
totalReplacementsandperReplacement[]withbodyCount/frontmatterCountscope: "body"(default) leaves frontmatter byte-identical;"frontmatter"and"both"re-parse the YAML afterward and write nothing if it breaks (frontmatter_invalid)
obsidian_manage_frontmatter tool
operation: "get" | "set" | "delete"on onekey;setrequires a JSON-typedvaluegetreturnsexistsandvalue(nullwhen absent);setanddeletereturn the fullfrontmatterafter the change, and adeleteagainst unparseable YAML fails withfrontmatter_invalidwithout writing
obsidian_manage_tags tool
operation: "add" | "remove" | "list"withtags;location: "frontmatter"(default, thetags:array),"inline"(body#tag;addappends at end of file), or"both"add/removereportapplied,skipped, and the resultingtags;listreturnsfrontmatter,inline, andallInline detection follows Obsidian's tag grammar: code, wikilinks, images, link destinations, HTML, and math are skipped, and
%% … %%comments are read
obsidian_delete_note tool
Takes a
target(path, active file, or periodic note) and checks it against the write scope first; a folder path fails withpath_is_directory. There is no API-level undo, only Obsidian's local trashThe path must match exactly, letter case included, even on a case-insensitive filesystem. A different-case or extension-less spelling fails
note_missingbefore anything is deleted, naming the near matches insuggestionsBy default the note is deleted on the first call, with no confirmation;
OBSIDIAN_WRITE_PATHSandOBSIDIAN_READ_ONLYbound what it can reachWith
OBSIDIAN_DELETE_ELICITATION=true, the first call answers with a confirmation request naming the path and byte size, and the note is deleted only after the user accepts. Declining fails withcancelled, and a client without elicitation support cannot deleteIn that mode an answer counts only against the single-use consent record stored when the prompt was shown, bound to the caller, the path, and the note's content then. A pre-supplied or replayed answer, or one given after the note changed, gets a fresh prompt instead
Consent records live in the server's storage provider (
STORAGE_PROVIDER_TYPE, defaultin-memory, process-local). That works for stdio or a single HTTP instance; several instances behind one endpoint need a shared provider (filesystem,supabase, orcloudflare-d1, nevercloudflare-kv)
obsidian_open_in_ui tool
path,failIfMissing(defaulttrue), andnewLeaf(open in a split pane); withfailIfMissing: falsea missing file is created, which needs write accesscreatedIfMissingreports which branch ranA case-mismatched
pathwith one case-insensitive match opens that file instead of creating another, reporting the path sent asrequestedPathwith anotice
obsidian_list_commands tool
Optional
nameRegex(≤256 chars) matched against each command's display nameReturns
commands[]ofidandname, whereidfeedsobsidian_execute_commandListed only when
OBSIDIAN_ENABLE_COMMANDS=trueandOBSIDIAN_READ_ONLYis off
obsidian_execute_command tool
commandIdfromobsidian_list_commands; returnsexecuted: true, or fails withcommand_unknownfor an unregistered IDRuns with the authority of a keyboard shortcut, so some commands are destructive (delete file, close vault); gated like
obsidian_list_commands
obsidian://vault/{+path} resource
{+path}captures everything after/vault/, slashes included; literal and percent-encoded paths resolve to the same noteReturns
path,content,frontmatter,tags, andstat, the same shape asobsidian_get_notewithformat: "full"; failures arepath_forbidden,note_missing, orpath_is_directory
obsidian://tags resource
Every tag with its
count, uncapped and unsorted, hierarchical parents includedWith
OBSIDIAN_READ_PATHSset, only tags from readable notes, counted the same way asobsidian_list_tagsNo ranking or filters;
obsidian_list_tagsgives the count-ranked, capped view
obsidian://status resource
status,service,authenticated,versions,manifest, andapiExtensions[]; still answers with a wrong API key, reportingauthenticated: falseOn plugin v5.0.2 and later, check
apiExtensionsforlocal-rest-api-periodic-notesbefore usingperiodictargets
Features
Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
Obsidian-specific:
Typed client for the Obsidian Local REST API plugin; section writes speak markdown-patch 2.0 to plugin v5.0 and later and 1.x to v4.x, chosen from the reported plugin version
Heading targets take a full
Parent::Childpath or a bare leaf name; writes reject an ambiguous one withambiguous_sectionand itscandidates, unless exactly one match is a top-level heading. On plugin v5.0 and later, content added to a heading is set off by a blank line (a list item continues an adjacent list), and a heading inside it must sit below the section's level (heading_outside_section)Folder-scoped read/write permissions, a read-only switch, and an opt-in command-palette pair (see Path policy); server-level
instructionsoninitializereport the active policyobsidian_get_noteandobsidian_open_in_uiretry a case-mismatched path against the real filename, disclosed asrequestedPathplus anotice, and addDid you meansuggestions to a miss; writes and deletes match the exact pathRegex inputs are capped (
nameRegexat 256 chars,useRegexat 1024) and rejected withregex_unsafewhen they nest quantifiersBacklinks have no dedicated tool;
obsidian_search_notesinjsonlogicmode finds them with{"regexp": ["\\[\\[Target Note(\\\\?\\||#|\\]\\])", {"var": "content"}]}, which also matches the table-safe[[Target Note\|Alias]]
Agent-friendly output:
Recovery-guided errors: every declared failure carries a
reason, a JSON-RPC code, and arecovery.hintwritten for that caseSize deltas: every mutating tool returns
previousSizeInBytes/currentSizeInBytes, so a caller can spot an accidental clobber without a follow-up readAmbiguity surfaced as data: shared heading names return
candidates, and tag operations reportappliedvs.skippedDiscriminated output contracts:
formatonobsidian_get_note,modeonobsidian_search_notes,operationonobsidian_manage_frontmatterandobsidian_manage_tags
Getting started
Add the following to your MCP client configuration file. The Obsidian Local REST API plugin must be installed and enabled in your vault; see Prerequisites.
{
"mcpServers": {
"obsidian-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["obsidian-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"OBSIDIAN_API_KEY": "your-local-rest-api-key"
}
}
}
}Or with npx (no Bun required):
{
"mcpServers": {
"obsidian-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "obsidian-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"OBSIDIAN_API_KEY": "your-local-rest-api-key"
}
}
}
}Or with Docker:
{
"mcpServers": {
"obsidian-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"-e", "MCP_LOG_LEVEL=info",
"-e", "OBSIDIAN_API_KEY=your-local-rest-api-key",
"ghcr.io/cyanheads/obsidian-mcp-server:latest"
]
}
}
}Inside a container, the default OBSIDIAN_BASE_URL (http://127.0.0.1:27123) is the container's own loopback. Add -e OBSIDIAN_BASE_URL=http://host.docker.internal:27123 (Docker Desktop) or run with --network host (Linux) to reach the plugin on your host.
For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http OBSIDIAN_API_KEY=... bun run start:http
# Server listens at http://127.0.0.1:3010/mcp by defaultPrerequisites
Bun v1.4.0 or higher (or Node.js v24+).
The Obsidian Local REST API plugin, v4.0.0 or later, enabled in your vault. Generate an API key under Settings → Community Plugins → Local REST API and set it as
OBSIDIAN_API_KEY.The server defaults to
http://127.0.0.1:27123, so enable "Non-encrypted (HTTP) Server" in the plugin settings, or setOBSIDIAN_BASE_URL=https://127.0.0.1:27124for the always-on HTTPS port (its self-signed cert is accepted whileOBSIDIAN_VERIFY_SSL=false, the default).Periodic-note targets work natively on plugin v5.0.1 and earlier. From v5.0.2 they need the periodic-notes API extension; without it they fail with
periodic_unsupported.On plugin v4.x, heading section writes to a note with CRLF (Windows) line endings land mid-line: the plugin's markdown-patch 1.x engine misplaces them, and the server can't correct it. Plugin v5.0 and later handle CRLF notes.
Plugin v6.0 drops markdown-patch 1.x, which two table-row writes (
contentType: "json") still use: rows under a heading, and rows through a block ID on its own line below the table. On v6.0, target the table by an ID on its last row.With
OBSIDIAN_DELETE_ELICITATION=true, an MCP client that supports elicitation and renders its form, to useobsidian_delete_note. Every other tool, and the default delete, works without it.
Installation
Clone the repository:
git clone https://github.com/cyanheads/obsidian-mcp-server.gitNavigate into the directory:
cd obsidian-mcp-serverInstall dependencies:
bun installConfigure environment:
cp .env.example .env # edit .env and set OBSIDIAN_API_KEY
Configuration
Variable | Description | Default |
| Required. Bearer token for the Local REST API plugin. | — |
| Local REST API base URL; |
|
| Verify the plugin's TLS certificate. Off by default for its self-signed cert; the relaxation applies only to an |
|
| Per-request timeout in milliseconds. |
|
| Enable |
|
| Comma-separated folder allowlist for reads. See Path policy. | unset (full vault) |
| Comma-separated folder allowlist for writes. See Path policy. | unset (full vault) |
| Deny every write and disable the command-palette pair. |
|
| Ask the user to confirm each |
|
| Omnisearch HTTP server URL. Unset derives from the | derived |
| Transport: |
|
| HTTP server port. |
|
| HTTP session mode: |
|
| Authentication: |
|
| Log level (RFC 5424). |
|
| Directory for log files (Node.js only). |
|
| Enable OpenTelemetry. |
|
See .env.example for the full list of optional overrides.
Path policy
Three optional env vars limit which vault paths the tools can touch. Unset, reads and writes cover the full vault.
Goal | Config |
Read everywhere, write only in |
|
Read only |
|
No writes anywhere |
|
Matching is by prefix, recursive, and case-insensitive; trailing slashes are normalized. Write paths are also readable.
OBSIDIAN_READ_ONLY=trueremoves every write tool and the command-palette pair fromtools/list, includingobsidian_manage_frontmatterandobsidian_manage_tags(so theirget/listgo too).obsidian_open_in_uistill opens existing files but won't create one.A denial fails with
path_forbidden, echoing the active scope indata.activeScopeand the recovery hint. Search hits outside the read scope are dropped silently, andobsidian_list_noteslists only readable entries plus the folders leading to the scope, so a nested scope can be browsed to from the root.Tag listings (
obsidian_list_tags,obsidian://tags) underOBSIDIAN_READ_PATHScover readable notes only, counting notes rather than occurrences. Write paths and read-only alone leave them vault-wide.The startup log prints the active scope.
Running the server
Local development
Build and run the production version:
# One-time build bun run rebuild # Run the built server bun run start:stdio # or bun run start:httpRun checks and tests:
bun run devcheck # Lint, format, typecheck, security, changelog sync bun run test # Vitest test suite bun run lint:mcp # Validate MCP definitions against spec
Docker
docker build -t obsidian-mcp-server .
docker run --rm -e OBSIDIAN_API_KEY=your-key -p 3010:3010 obsidian-mcp-serverThe image defaults to HTTP transport on 0.0.0.0, stateful sessions, and logs in /var/log/obsidian-mcp-server. Point OBSIDIAN_BASE_URL at http://host.docker.internal:27123 (Docker Desktop) or use --network host (Linux) to reach the plugin. OpenTelemetry peer dependencies are installed by default; build with --build-arg OTEL_ENABLED=false to omit them.
If the port is reachable from other machines, set MCP_AUTH_MODE=jwt (with MCP_AUTH_SECRET_KEY) or oauth. With the default none, every caller acts on your vault with your OBSIDIAN_API_KEY.
Project structure
Directory | Purpose |
|
|
| Server-specific environment variable parsing ( |
| Local REST API client, path policy, markdown-patch format handling, frontmatter/section/tag parsing, domain types. |
| Tool definitions ( |
| Resource definitions ( |
| Prompt definitions (none registered). |
| Vitest tests for tools, resources, services, and config. |
| Local REST API OpenAPI spec and the generated |
| Per-version release notes; |
Development guide
See CLAUDE.md for development guidelines and architectural rules. The short version:
Handlers throw, framework catches — no
try/catchin tool logicUse
ctx.logfor request-scoped logging; route every Local REST API call throughgetObsidianService()Register new tools and resources via the barrels in
src/mcp-server/*/definitions/index.tsWrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
Contributing
Bugs, feature requests, and documentation gaps belong in an issue; see CONTRIBUTING.md for what makes one actionable and CODE_OF_CONDUCT.md for how we work together. Security reports go through SECURITY.md, never a public issue.
Run checks and tests before submitting:
bun run devcheck
bun run testLicense
Apache-2.0 — see LICENSE for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
Search and reason over your Obsidian-style Markdown vault, right from ChatGPT.
Securely search and manage workspace context files for AI agents and teams.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Obsidian vaults through vector search, vault indexing, and file monitoring. It provides a standardized interface for searching and managing markdown-based personal knowledge management data within the Model Context Protocol.6,363 npm1MIT
- FlicenseNot gradedqualityCmaintenanceMCP server that provides tools and resources for AI models to interact with an Obsidian vault, enabling file operations, search, and management via the Model Context Protocol.2-
- FlicenseNot gradedqualityAmaintenanceEnables semantic search and note management for Obsidian vaults via the Model Context Protocol, allowing LLMs to search, read, and index notes, PDFs, and web pages locally.-
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to read, search, create, and modify Obsidian notes via the Model Context Protocol, supporting tasks like daily notes, backlinks, and project management.-