obsidian-vault-mcp

obsidian-vault-mcp

An MCP server that enables Claude Desktop to read and write an Obsidian vault hosted on a VPS, using SSH or HTTP transport with OAuth authentication.

Category
访问服务器

README

obsidian-vault-mcp

An MCP server that gives Claude Desktop read/write access to an Obsidian vault that lives on a VPS. The server runs on the VPS with direct filesystem access to the vault; Claude Desktop launches it over an ssh stdio pipe. There is no SSH library inside the server — SSH is only the transport Claude Desktop uses to start it and exchange JSON-RPC.

Part of a "centralise the vault on the VPS" setup:

  Mac                                            VPS (always-on)
  ┌ Obsidian app ──(obsidian-remote-ssh plugin)── SSH ─▶ Go daemon ─┐
  │                                                                 ├─▶  the one vault
  └ Claude Desktop ─(ssh stdio → node index.js)── SSH ─▶ THIS server┘        ▲
                                                                     Hermes agent (direct fs)

Tools

Read: list_notes, read_note, search_notes. Write (disabled with --read-only): write_note, create_note, append_to_note, edit_note, delete_note, move_note.

All paths are vault-relative and confined to the vault root — .., absolute paths, symlink escapes, and null bytes are rejected; writes/deletes/moves are restricted to allowed extensions (.md, .markdown, .canvas, .txt by default; override with --ext).

Build & test locally

npm install
npm run build            # bundles to dist/index.js (single file)
npm run smoke            # spins up the server against a temp vault and exercises every tool
npm run typecheck        # optional: tsc --noEmit

You can also drive it interactively with the MCP Inspector:

npm run inspect -- /absolute/path/to/a/vault

Deploy to the VPS

Requires Node 20+ on the VPS.

VPS=user@your-vps DEST=obsidian-mcp ./scripts/deploy.sh
# copies dist/index.js to  ~/obsidian-mcp/index.js  on the VPS

Smoke-test the remote copy from your Mac (should print a startup line on stderr, then wait):

ssh user@your-vps node obsidian-mcp/index.js /absolute/path/to/vault
# Ctrl-C to stop

Wire up Claude Desktop (per Mac)

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "obsidian-vault": {
      "command": "ssh",
      "args": [
        "user@your-vps",
        "node",
        "/home/user/obsidian-mcp/index.js",
        "/home/user/asep_brain"
      ]
    }
  }
}

Restart Claude Desktop. A second Mac (different vault on the same VPS) uses the same block with that Mac's vault path as the last argument.

Notes:

  • ssh must authenticate non-interactively (key auth, no passphrase prompt) — test with ssh user@your-vps true.
  • Add "--read-only" as a final arg to expose only the read tools.
  • Config is passed as CLI args, not env, because ssh does not forward environment variables by default.

CLI

node index.js <vault-root> [--read-only] [--ext .md,.canvas] [--http [--port 8787] [--host 127.0.0.1]]

Default (no --http): stdio transport, launched over ssh by Claude Desktop (above). With --http: a long-lived HTTP server for Claude's remote connectors, including the mobile app (see below).


Reach it from the Claude mobile app (remote connector)

The mobile app can't use ssh. Like claude.ai / Desktop / Cowork, it connects to remote MCP servers from Anthropic's cloud, over Streamable HTTP to a public HTTPS URL. So the same server also runs an HTTP transport (--http) fronted by a self-hosted OAuth 2.1 layer — the ssh key gate is gone once it's public, so a login gate replaces it.

Claude mobile ──HTTPS──▶ Caddy (:443, auto Let's Encrypt)  ─▶  node index.js --http (127.0.0.1:8787)
                          91-99-211-116.sslip.io                 ├ OAuth 2.1 (passphrase login, PKCE, JWT)
                                                                  └ /mcp  (guarded by bearer JWT)  ─▶ vault

The stdio/ssh path for Claude Desktop is unchanged and runs independently.

HTTP-mode configuration (env vars)

--http reads these from the environment:

Var Required Meaning
MCP_PUBLIC_URL yes Public origin, e.g. https://91-99-211-116.sslip.io. Used as the OAuth issuer/audience.
MCP_JWT_SECRET yes 32+ random bytes used to sign access/refresh tokens. Rotating it revokes all tokens.
MCP_USERS_FILE one of Per-user {id, passphrase, vault} map (see below) — for multiple people/vaults.
MCP_AUTH_PASSPHRASE one of Single-user shortcut: the login passphrase for the one vault given as the CLI arg. Use this or MCP_USERS_FILE.
MCP_CLIENTS_FILE no Where DCR client registrations persist (default: next to index.js).
MCP_NO_AUTH no Set to 1 to disable auth — local testing only, never public.

Multiple people, multiple vaults

Point MCP_USERS_FILE at a JSON file with one entry per person — each distinct passphrase maps to that person's own vault. Everyone adds the same connector URL in their own Claude account; the passphrase they log in with is what routes them to the right vault. See users.example.json.

{
  "users": [
    { "id": "asep", "passphrase": "a-long-passphrase",           "vault": "/home/bepitulaz/asep_brain" },
    { "id": "retno", "passphrase": "a-DIFFERENT-long-passphrase", "vault": "/home/bepitulaz/obsidian", "readOnly": false }
  ]
}

In this mode the CLI vault argument is not needed (node dist/index.js --http). Optional per-user keys: readOnly and ext.

Test HTTP mode locally

npm run build
npm run smoke:http           # spins up two servers: tools-over-HTTP + full OAuth handshake

# Or drive it by hand (auth disabled) with the MCP Inspector:
MCP_NO_AUTH=1 node dist/index.js /path/to/vault --http --port 8787
#   → point the Inspector (Streamable HTTP) at http://localhost:8787/mcp

Deploy to a public HTTPS endpoint (VPS)

See DEPLOY.md for the full, copy-pasteable runbook — installing Caddy, the /etc/obsidian-mcp.env secrets, the systemd unit, the Caddyfile, firewall, verification, and troubleshooting. It's written so an agent with shell access on the VPS can follow it end to end.

In short: sslip.io gives an HTTPS-capable hostname for the bare IP with no domain purchase (91-99-211-116.sslip.io91.99.211.116); Caddy terminates TLS on 443 and reverse-proxies to the Node service on 127.0.0.1:8787; the service runs under systemd reading its secrets from /etc/obsidian-mcp.env. Requires Node 20+ and ports 80 + 443 open.

Add it in the Claude mobile app

Settings → ConnectorsAdd custom connector → paste https://91-99-211-116.sslip.io/mcp → leave Advanced settings (Client ID/Secret) blank (the server supports Dynamic Client Registration) → Add. When prompted, complete the browser login with your own passphrase. All tools then appear. Each person adds the same URL in their own Claude account and logs in with their own passphrase to reach their own vault.

Security notes (the public surface is read + write)

  • The passphrase and JWT secret live only in the mode-600 EnvironmentFile. Use a strong passphrase.
  • Access tokens are short-lived (1h) JWTs; rotate MCP_JWT_SECRET to revoke everything immediately.
  • Run --read-only in the systemd unit if you don't need mobile writes — it shrinks the blast radius.
  • Keep the Node service bound to 127.0.0.1; only Caddy faces the internet, over HTTPS.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选