Obsidian Sync Mcp

io.github.es617由 GitHub 账号 es617 发布v0.5.2更新于 Oct 24, 2026

Give AI agents access to your Obsidian vault via local files or Self-hosted LiveSync.

概览

AI 生成的概览

让 AI 助手读取、搜索和编辑 Obsidian 仓库中的笔记,数据可来自本地文件或自建 LiveSync 的 CouchDB。

可以做什么
通过 HTTP 暴露一组 MCP 工具,操作单个 Obsidian 仓库:read_note、write_note、edit_note、delete_note、move_note、list_notes、list_folders、list_tags、search_notes 和 get_note_metadata。文件系统模式直接读取 markdown 文件;CouchDB 模式读取 Self-hosted LiveSync 数据库,支持分块处理和端到端加密。工具返回结果包含 Obsidian 深链接,服务器可本地运行或部署到常开主机。
适用场景
适合让 AI 助手回答关于笔记的问题或直接修改仓库内容,包括在服务器部署于常开主机时从手机或其他设备访问。文件系统模式最简单;已使用 Self-hosted LiveSync 同步的用户适合 CouchDB 模式。
运行要求
npm 包需要 Node.js 22 或更高版本,也可使用 Docker。文件系统模式需设置 VAULT_PATH;CouchDB 模式需设置 COUCHDB_URL、COUCHDB_USER、COUCHDB_PASSWORD、COUCHDB_DATABASE,可选 COUCHDB_PASSPHRASE;VAULT_NAME 用于深链接。可选 MCP_AUTH_TOKEN 启用 OAuth 认证,使用隧道时需设置 BASE_URL 以处理 OAuth 回调。CouchDB 数据库必须已存在。
安装前请注意
该服务器让代理对仓库拥有读写权限,笔记可能被修改或删除;请保留备份,并考虑启用 READ_ONLY 或 WRITE_FOLDERS。它涉及密钥 COUCHDB_PASSWORD、COUCHDB_PASSPHRASE 和 MCP_AUTH_TOKEN。认证是可选的,暴露到互联网前应设置 MCP_AUTH_TOKEN 并使用 HTTPS。调试日志会记录工具参数,包括笔记内容。MCP_INSTRUCTIONS_FILE 的内容会进入每个客户端的系统提示,应限制其写入权限。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Obsidian Sync Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Obsidian Sync MCP

[MCP] [License: MIT] [Node] [TypeScript]

Give any AI agent access to your Obsidian vault over MCP. Run it locally against your vault files, or pair it with Self-hosted LiveSync and deploy to the cloud so it works even when your machine is off.

Example: From your phone, ask your AI: "What's in my daily note for today?" — and get the full content back, with a link to open it in Obsidian.


How it works

The server connects to your vault in two ways:

  • Filesystem mode — reads .md files directly from your vault folder. No database needed.
  • CouchDB mode — reads from a CouchDB database, locally or in the cloud. Your vault syncs to CouchDB via Self-hosted LiveSync, the community Obsidian plugin (600k+ downloads). The MCP server reads from CouchDB directly using livesync-commonlib — the same library that powers the plugin — for proper chunk handling and E2E encryption support.

Both modes expose the same MCP tools over HTTP, so any MCP-compatible agent can connect: Claude, Copilot, custom agents, anything that speaks the Model Context Protocol.


Choose your setup

Need it always available?Have LiveSync?Go to
YesYesSetup A — add MCP alongside your existing CouchDB
YesNoSetup B — CouchDB + MCP + LiveSync from scratch
No—Setup C — filesystem or CouchDB, npx or Docker

A. Deploy MCP to the cloud

You already have LiveSync and CouchDB on an always-on server. You just need the MCP server deployed alongside it.

Using Fly.io setup script (macOS/Linux, or WSL on Windows):

bash
git clone https://github.com/es617/obsidian-sync-mcp.gitcd obsidian-sync-mcp./deploy/setup.sh    # choose option 2 (MCP only)

The script asks for your CouchDB connection details, vault name, and encryption passphrase.

Or run the Docker image on any always-on server:

bash
docker run -p 8787:8787 \  -v mcp-data:/data -e DATA_DIR=/data \  -e COUCHDB_URL=https://your-couchdb:5984 \  -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=yourpassword \  -e COUCHDB_DATABASE=obsidian -e VAULT_NAME=MyVault \  -e COUCHDB_PASSPHRASE=your-encryption-passphrase \  -e COUCHDB_OBFUSCATE_PROPERTIES=false \  -e MCP_AUTH_TOKEN=yourpassword \  -e BASE_URL=https://your-server-url \  ghcr.io/es617/obsidian-sync-mcp:latest

Set COUCHDB_PASSPHRASE if you use E2E encryption in LiveSync. Set COUCHDB_OBFUSCATE_PROPERTIES=true if "Obfuscate Properties" is also enabled in your LiveSync settings. For an existing vault the server detects the actual setting from the database at startup and corrects a mismatch with a warning; only for a brand-new empty database does the value need to match your LiveSync settings. If the vault was created with LiveSync 1.0.33+ and path obfuscation, also set COUCHDB_ID_DERIVATION_KEY to your LiveSync recovery code (sls-id-v1:..., from "Show current recovery code") so the server can resolve note paths. Set BASE_URL to your public URL (required for OAuth callbacks when agents connect over HTTPS).

Your MCP endpoint is https://your-app.fly.dev/mcp (Fly.io) or https://your-server:8787/mcp (Docker behind HTTPS).

See Cost for Fly.io pricing.

Requires flyctl for the Fly.io path:

bash
curl -L https://fly.io/install.sh | shexport PATH="$HOME/.fly/bin:$PATH"  # add to ~/.zshrc or ~/.bashrcfly auth login

B. Deploy everything to the cloud

Starting fresh — no LiveSync yet. Deploy CouchDB and MCP together, then set up LiveSync in Obsidian.

Using Fly.io setup script (macOS/Linux, or WSL on Windows):

bash
git clone https://github.com/es617/obsidian-sync-mcp.gitcd obsidian-sync-mcp./deploy/setup.sh    # choose option 1 (CouchDB + MCP)

The script generates credentials, creates the database, and deploys. Save the credentials it prints.

Or with Docker Compose on any always-on server:

bash
git clone https://github.com/es617/obsidian-sync-mcp.gitcd obsidian-sync-mcp
cat > .env <<EOFCOUCHDB_PASSWORD=changemeMCP_AUTH_TOKEN=changeme-tooVAULT_NAME=MyVaultEOF
docker compose up -d

After deployment:

  1. In Obsidian, install Self-hosted LiveSync and configure it with the credentials from the setup output
  2. Your MCP endpoint is https://your-app.fly.dev/mcp (Fly.io). With Docker Compose the MCP port is published on localhost:8787 only; to reach it from other machines, put an HTTPS tunnel or reverse proxy in front (see remote access) and set BASE_URL to its public URL
  3. The MCP_AUTH_TOKEN is the password you enter when an agent connects
Always-on server├── CouchDB + persistent storage└── MCP server      ↑                    ↑Obsidian + LiveSync    AI agents

Requires flyctl for the Fly.io path:

bash
curl -L https://fly.io/install.sh | shexport PATH="$HOME/.fly/bin:$PATH"  # add to ~/.zshrc or ~/.bashrcfly auth login

Cost (Fly.io)

Applies to both Setup A and Setup B.

ComponentCost
CouchDB + MCP VM (shared, 512MB)~$3-4/month (kept alive by LiveSync)
MCP-only VM (shared, 256MB)~$0-2/month (suspends when idle)
1GB persistent volume~$0.15/month

As of March 2026, Fly.io may waive charges under $5/month, which could make this effectively free with a shared IPv4. Either way, cheaper than Obsidian Sync ($4/month) and you own the data.


C. Run on your machine

Run the MCP server locally. Works with filesystem mode (reads vault files directly) or CouchDB mode (if you have LiveSync). Machine must stay on for agents to reach it.

Filesystem mode (simplest):

bash
VAULT_PATH=~/Documents/MyVault \VAULT_NAME=MyVault \npx obsidian-sync-mcp

CouchDB mode (if you have LiveSync):

bash
COUCHDB_URL=http://localhost:5984 \COUCHDB_USER=admin \COUCHDB_PASSWORD=yourpassword \COUCHDB_DATABASE=obsidian \COUCHDB_PASSPHRASE=your-encryption-passphrase \COUCHDB_OBFUSCATE_PROPERTIES=false \VAULT_NAME=MyVault \npx obsidian-sync-mcp

Omit COUCHDB_PASSPHRASE if you don't use E2E encryption in LiveSync. Set COUCHDB_OBFUSCATE_PROPERTIES=true if "Obfuscate Properties" is also enabled in your LiveSync settings. For an existing vault the server detects the actual setting from the database at startup and corrects a mismatch with a warning; only for a brand-new empty database does the value need to match your LiveSync settings. If the vault was created with LiveSync 1.0.33+ and path obfuscation, also set COUCHDB_ID_DERIVATION_KEY to your LiveSync recovery code (sls-id-v1:...) so the server can resolve note paths.

Or with Docker:

bash
docker run -p 127.0.0.1:8787:8787 \  -v mcp-data:/data -e DATA_DIR=/data \  -e VAULT_PATH=/vault -v ~/Documents/MyVault:/vault \  -e VAULT_NAME=MyVault \  ghcr.io/es617/obsidian-sync-mcp:latest

Your MCP endpoint is http://localhost:8787/mcp.

Want remote access? Add a tunnel (machine must stay on):

bash
cloudflared tunnel --url http://localhost:8787    # freetailscale funnel 8787                             # or Tailscalengrok http 8787                                   # or ngrok

Set BASE_URL to the tunnel URL when using authentication.


Tools

ToolDescription
read_noteRead a note's markdown content by path
write_noteCreate or overwrite a note (replaces entire content)
edit_noteEdit a note without rewriting it — append, prepend (after frontmatter), or replace exact text
list_foldersList all folders in the vault with note counts — use to discover folder names
list_tagsList all tags in the vault with counts — use to discover tags before filtering
list_notesList notes with timestamps. Filter by folder, name, tag, or date. Sort by name or modified.
search_notesSearch note text for terms (OR, case-insensitive substrings); paths and frontmatter titles are searched first. Filter by folder, tag, or date. Returns paths with one context line each, never the note body, after a status line that states which CouchDB sequence the index is caught up with.
delete_noteDelete a note
move_noteMove or rename a note — works across folders, creates destination folders automatically
get_note_metadataGet frontmatter, tags, outgoing links, backlinks, size, and timestamps — navigate the knowledge graph

Every tool response includes an Obsidian deep link (obsidian://open?vault=...&file=...) that works on Mac and iOS.

"Add a bullet point to my daily note." "Find my notes about the MCP server and fix the typo in the second one."


Authentication

Set MCP_AUTH_TOKEN to a password to enable authentication:

bash
MCP_AUTH_TOKEN=mysecretpassword npx obsidian-sync-mcp

The server includes a self-contained OAuth 2.1 provider. When an agent connects:

  1. A browser window opens with a password page
  2. Enter the MCP_AUTH_TOKEN password
  3. The agent gets an access token and refreshes it transparently

The session is shared across all your Claude interfaces (Desktop, Web, Mobile) and persists across server restarts. You'll need to re-enter the password after 14 days of inactivity (configurable via MCP_REFRESH_DAYS).

For non-OAuth clients (curl, MCP Inspector, custom agents), you can also pass the token directly as Authorization: Bearer <MCP_AUTH_TOKEN>.

Without MCP_AUTH_TOKEN, the server runs without authentication — suitable for local use or behind a private network.


Environment variables

VariableRequiredDefaultDescription
VAULT_PATHFilesystem mode—Path to your Obsidian vault directory
COUCHDB_URLCouchDB mode—CouchDB server URL
COUCHDB_USERCouchDB modeadminCouchDB username
COUCHDB_PASSWORDCouchDB mode—CouchDB password (required)
COUCHDB_DATABASECouchDB modeobsidianCouchDB database name. The server never creates it: if it doesn't exist, startup fails with an error
COUCHDB_PASSPHRASECouchDB mode—LiveSync E2E encryption passphrase (must match plugin setting)
COUCHDB_OBFUSCATE_PROPERTIESCouchDB modefalseSet to true if "Obfuscate Properties" is enabled in LiveSync (obfuscates file paths, sizes, dates in the database). For existing vaults the actual setting is auto-detected at startup; this value only decides the format for a brand-new empty database
COUCHDB_ID_DERIVATION_KEYCouchDB mode—LiveSync "independent ID derivation" recovery code (sls-id-v1:...). Needed to read and write notes on vaults created with LiveSync 1.0.33+ that use path obfuscation; leave unset for older (passphrase-derived) vaults. Get it from LiveSync's "Show current recovery code"
COUCHDB_CASE_SENSITIVECouchDB modefalseSet to true only if your LiveSync vault has "Handle filenames as case-sensitive" enabled. It must match the vault, or obfuscated document IDs won't resolve (the server fails to start with a clear message). Leave unset otherwise
VAULT_NAMEBothMyVaultVault name (used for deep links and index storage)
MCP_AUTH_TOKENOptional—Password for authentication
BASE_URLOptionalhttp://localhost:PORTPublic URL (for OAuth callbacks when using a tunnel)
PORTOptional8787HTTP port
HOSTOptional0.0.0.0Bind address (127.0.0.1 to restrict to localhost)
MCP_ALLOWED_HOSTSOptional—Comma-separated extra Host values accepted in no-auth mode (e.g. 192.168.1.5,mybox.local). No-auth mode rejects any other Host to block browser DNS-rebinding; localhost is always allowed. Ignored when MCP_AUTH_TOKEN is set.
DATA_DIROptional~/.obsidian-mcpDirectory for persisted data (metadata index, auth tokens)
LOG_LEVELOptional—Set to debug for verbose logging (library logs, change feed, index sync)
DISPLAY_TIMEZONEOptionalserver's zoneIANA time zone for the human-readable half of the server time in search_notes status lines (UTC is always printed beside it), e.g. Europe/Berlin. An invalid zone falls back to UTC with a warning at startup
MCP_REFRESH_DAYSOptional14Days before auth session expires
READ_ONLYOptionalfalseSet to true to disable all write tools (write_note, edit_note, delete_note, move_note). Only read tools are exposed via MCP, and the vault backend rejects writes as well. Useful when sharing the server with multiple AI clients and write access should be opt-in. This protects the vault from MCP clients; it is not a database-level guarantee. To make CouchDB itself refuse writes, use CouchDB-side controls, such as a validate_doc_update function that rejects the server's CouchDB user.
WRITE_FOLDERSOptional—Comma-separated list of vault-relative folders where writes are allowed (e.g. MCP,Inbox). When set, the whole vault stays readable but write_note, edit_note, delete_note, and move_note refuse paths outside these folders (move_note requires both source and destination to be writable). Enforced server-side, unlike MCP_INSTRUCTIONS. Matching is case-sensitive and folder-boundary-aware (MCP matches MCP/note.md but not MCP-private/note.md). Ignored when READ_ONLY=true; unset means the whole vault is writable.
MCP_INSTRUCTIONSOptional—Extra text appended to the server's MCP instructions (the string clients inject into the system prompt). Use this to bake vault-specific conventions into the server — e.g. folder structure, naming rules, folders to avoid — so they apply across every MCP client without per-client config. Best-effort: not all clients respect instructions.
MCP_INSTRUCTIONS_FILEOptional—Path to a file (e.g. markdown) whose contents are appended to the MCP instructions. Easier than MCP_INSTRUCTIONS for multi-line conventions. If both are set, the file wins and MCP_INSTRUCTIONS is ignored (with a startup warning). Missing/unreadable file or files larger than 32 KB are fatal startup errors. Store this file somewhere only the service user can write (e.g. chmod 600) — its contents land in every MCP session's system prompt, so write access to it = prompt-injection access to every client.

Set VAULT_PATH for filesystem mode or COUCHDB_URL for CouchDB mode.


Try without an agent

Test the server interactively using the MCP Inspector:

bash
VAULT_PATH=~/Documents/MyVault npx obsidian-sync-mcp &npx @modelcontextprotocol/inspector

Set transport to Streamable HTTP, enter http://localhost:8787/mcp, and connect.


How to update

How you run itHow to update
npx obsidian-sync-mcpAutomatic — npx pulls latest
Fly.ioFrom the same directory where you ran setup: fly deploy. If you lost the fly.toml, run fly config save --app your-app-name to restore it.
Dockerdocker pull ghcr.io/es617/obsidian-sync-mcp:latest and restart. The image runs as the unprivileged node user (uid 1000). If your data volume was created by an older image that ran as root, make it writable once: docker run --rm -v mcp-data:/data alpine chown -R 1000:1000 /data (for a bind mount, chown -R 1000:1000 the host directory)

Known limitations

  • Single vault per instance. Each server connects to one vault. For multiple vaults, run multiple instances on different ports.
  • Single machine on Fly.io. Auth state is in-memory, so multiple machines break the OAuth flow. The setup script enforces this automatically.
  • No conflict resolution. If an agent and Obsidian edit the same note simultaneously, last write wins.
  • Text only. Binary attachments are not exposed through MCP tools.
  • Deep links depend on the client. Obsidian obsidian:// deep links are included in every tool response. They work on Claude Mobile and in browsers, but some clients (Claude Desktop) may not render them as clickable links.
  • Node 22+ required.
  • Setup script requires bash. The deploy/setup.sh script works on macOS and Linux. On Windows, use WSL or Git Bash.

Safety

This server gives an AI agent read/write access to your Obsidian vault.

Agents can modify and delete notes. Keep backups. Use tool approval deliberately.

Authentication is optional. Always set MCP_AUTH_TOKEN when exposing to the internet.

Use HTTPS in production. Use a tunnel or deploy behind a reverse proxy.

Don't leave LOG_LEVEL=debug on in production. Debug logging records every tool call's arguments, including note contents, and full error stacks. Credentials embedded in COUCHDB_URL are redacted from logs at every level.

This software is provided as-is under the MIT license. You are responsible for what agents do with your vault.


Development

bash
git clone --recursive https://github.com/es617/obsidian-sync-mcp.gitcd obsidian-sync-mcpnpm install && npm run buildnpm test          # unit testsnpm run test:e2e  # integration tests

License

MIT — see LICENSE.

Acknowledgements

来源:README.md,提交 1a4d53f

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

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

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分