Obsidian Second Brain MCP

Obsidian Second Brain MCP

Local MCP server that automates an open Obsidian vault through Obsidian's official CLI, offering tools for note creation/update, search, tasks, daily notes, and organization. It uses MCP over STDIO, requires no cloud services, and provides safety/audit features for autonomous writes.

Category
访问服务器

README

Obsidian Second Brain MCP

Local MCP server for Codex and Antigravity that automates an open Obsidian vault through Obsidian's official command-line interface. It uses MCP over STDIO, so no HTTP listener, API key, embeddings index, or cloud service is required. Obsidian remains the system of record; the server does not edit an iCloud vault directly.

Requirements

  • macOS with Obsidian 1.12.7 or newer.
  • Node.js 20 or newer (the installer uses the Node executable that launched it).
  • A built checkout of this project (npm install then npm run build).
  • An open Obsidian vault.

Enable Obsidian's CLI before installing the MCP server:

  1. Open Obsidian and choose Settings → General → Command line interface.
  2. Enable the CLI and accept the macOS registration prompt.
  3. Confirm that command -v obsidian prints a path (usually /usr/local/bin/obsidian). If it is elsewhere, set OBSIDIAN_BIN when starting the MCP server or before running the installer.

The server selects the most recently opened vault ID from ~/Library/Application Support/obsidian/obsidian.json. This means the vault can stay in iCloud while commands still go through Obsidian. Set OBSIDIAN_VAULT_ID to target a different registered vault.

Install and configure

From the project directory:

npm install
npm run build
node scripts/install.mjs --dry-run
node scripts/install.mjs

The installer verifies Node, dist/index.js, and the Obsidian CLI; discovers the open vault ID; and merges an obsidian STDIO server into both client configurations:

  • Codex: ~/.codex/config.toml
  • Antigravity: ~/.gemini/config/mcp_config.json

Existing files are backed up with a timestamped .bak.* suffix before a real update. Existing settings and custom fields in the obsidian server entry are preserved; the command, entrypoint arguments, detected vault/CLI environment, and approval setting are refreshed. Codex receives default_tools_approval_mode = "auto" inside the [mcp_servers.obsidian] table so normal calls to this server do not require a confirmation for every operation.

Use one of these flags when only one client should be changed:

node scripts/install.mjs --codex-only
node scripts/install.mjs --antigravity-only

--dry-run performs prerequisite checks and prints the planned paths and backups without creating directories, backups, or configuration files. A missing Obsidian CLI is reported as a warning in dry-run mode, but blocks a real install. The installer never reads or prints note contents.

After installation, restart Codex and Antigravity, or use each client's MCP refresh/reload action. A running client does not automatically reload a changed MCP configuration; /mcp can show the current session's server state, but a full client restart may still be needed after the first install.

Tools

The server exposes ten tools. Read-only tools return structured data and do not write the audit log; mutations return concise before/after evidence and append one JSONL audit record.

Tool Purpose
vault_overview Counts and samples files, folders, tags, properties, orphans, dead ends, unresolved links, and incomplete tasks.
search_notes Native Obsidian search with query, folder, case-sensitive, context, and result-limit controls.
read_note Reads content plus file metadata, outline, properties, outgoing links, and backlinks. Identify a note by path or file.
create_note Creates by path/name, content or template, optional properties, open, and overwrite controls.
update_note Appends or prepends content, sets/removes properties, and changes a task's status.
organize_note Moves, renames, or sends a note to Obsidian trash. It never permanently deletes.
daily_note Reads, opens, appends to, or prepends to the active daily note.
manage_tasks Lists tasks or completes/reopens/assigns a custom one-character task status.
suggest_use_cases Uses native graph and organization signals to rank three contextual second-brain workflows.
run_obsidian_command Runs an argument array for other Obsidian/plugin commands after safety checks.

The server instructions encourage an MCP client to search before assuming a note exists, inspect links/backlinks before proposing connections, use typed tools for ordinary work, and call suggest_use_cases when the user wants creative ideas grounded in their actual vault.

Creative workflows

The recommendation tool can surface workflows such as:

  • Forgotten-note resurfacing: rotate orphan notes into a daily review and connect the useful ones to active projects.
  • Bridge-note generator: find disconnected tag/link clusters and outline a synthesis note that gives them a shared concept.
  • Knowledge-gap radar: turn unresolved links and dead ends into a ranked research queue.
  • Weekly synthesis cockpit: combine recent notes and unfinished tasks into wins, open loops, decisions, and next actions.
  • Idea-collision studio: combine unrelated tag clusters into writing, experiment, or project concepts grounded in real notes.

Example prompts:

Find three overlooked connections in my vault and explain why they matter.
Turn today's loose notes into a connected synthesis note.
Show unfinished tasks and append the best next actions to today's daily note.
Suggest three creative second-brain workflows based on how my vault is structured.

For changes that affect several notes, ask the client to search/read first, show the proposed targets, and then perform the writes. The server permits autonomous writes by design, so client-level approval settings remain an important user choice.

Configuration

The MCP process reads these environment variables at startup:

Variable Default Meaning
OBSIDIAN_BIN obsidian Absolute path or executable name for the Obsidian CLI.
OBSIDIAN_VAULT_ID Detected open vault ID Registered Obsidian vault ID to pass on every command.
OBSIDIAN_MCP_AUDIT_LOG ~/Library/Application Support/obsidian-mcp/audit.jsonl JSONL mutation audit path.
OBSIDIAN_MCP_TIMEOUT_MS 30000 Per-command timeout; invalid/non-positive values use 30 seconds.

The generated client entry uses the absolute Node executable, dist/index.js, the resolved Obsidian CLI path, and the detected vault ID, so it is independent of the shell's PATH. If the project moves or the default vault changes, rerun the installer to refresh those absolute values.

Safety and audit behavior

  • All Obsidian arguments are passed as an array to execFile; there is no shell interpolation.
  • Permanent deletion, arbitrary eval, and raw dev:*/developer-control commands are blocked, including through run_obsidian_command.
  • organize_note uses Obsidian's delete/trash command only.
  • Every mutation records timestamp, tool, vault, affected targets, sanitized arguments, status, duration, and before/after metadata or content hashes.
  • Content/body/text arguments are represented only by length and SHA-256 in the audit log. Note contents are not copied to logs or printed by the installer.
  • The audit directory is created with mode 0700 and the JSONL file with mode 0600.

Development and tests

npm run check       # TypeScript type-check without emitting
npm run build       # Compile to dist/index.js
npm test            # Unit and MCP contract tests
npm run test:smoke  # Optional real-vault smoke test
node --check scripts/install.mjs
node scripts/install.mjs --dry-run

The real-vault smoke test is opt-in because it creates, updates, and trashes fixture notes. It should only be run with Obsidian open on the intended test vault. It exercises linked notes, search/read, properties, backlinks, tasks, trash, and audit entries, and must leave no fixture behind.

Troubleshooting

Obsidian CLI was not found — enable the CLI under Obsidian Settings → General, accept the registration prompt, and verify command -v obsidian. Set OBSIDIAN_BIN=/absolute/path/to/obsidian if registration used a non-standard path.

Compiled entrypoint not found — run npm install and npm run build from the project directory, then rerun the installer. The configured entrypoint is the absolute dist/index.js path.

No vault is detected — open the desired vault in Obsidian, or set OBSIDIAN_VAULT_ID to a vault ID from the vaults object in Obsidian's obsidian.json registry.

Tools do not appear — restart the client after installation and inspect its MCP page (/mcp in Codex). Check that the configured command and dist/index.js still exist and that Node is version 20 or newer.

A command fails — run the same read-only command in a terminal (for example, obsidian vault) and inspect the returned error. The server applies a vault ID to every command; a stale ID can be corrected with OBSIDIAN_VAULT_ID or by rerunning the installer after opening the desired vault.

推荐服务器

Baidu Map

Baidu Map

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

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

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

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

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

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

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

官方
精选
本地
TypeScript
VeyraX

VeyraX

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

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
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 模型以安全和受控的方式获取实时的网络信息。

官方
精选