obsidian-ts-mcp

obsidian-ts-mcp

A Model Context Protocol server that wraps the official Obsidian CLI to allow AI agents to read, write, search, and manage notes within an Obsidian vault. It provides 16 specialized tools for comprehensive vault interaction, including note management, task tracking, and metadata manipulation.

Category
访问服务器

README

obsidian-ts-mcp

A Model Context Protocol (MCP) server that wraps the official Obsidian CLI, letting AI agents in VS Code (and any other MCP client) read, write, search, and manage notes inside an Obsidian vault.

Prerequisites

Requirement Minimum version
Node.js 18
Obsidian desktop app 1.12 (with CLI enabled)
Obsidian Catalyst licence Required for CLI access

The Obsidian desktop app must be running when the MCP server is in use. The obsidian binary must be available on your PATH.

Installation

git clone https://github.com/dickiedyce/obsidian-ts-mcp.git
cd obsidian-ts-mcp
npm install
npm run build

Configuration

VS Code (user-level MCP)

Add the following to your VS Code MCP configuration:

OS Path
macOS ~/Library/Application Support/Code/User/mcp.json
Linux ~/.config/Code/User/mcp.json
Windows %APPDATA%\Code\User\mcp.json
{
  "servers": {
    "obsidian": {
      "type": "stdio",
      "command": "node",
      "args": ["/absolute/path/to/obsidian-ts-mcp/dist/server.js"],
      "env": {
        "OBSIDIAN_VAULT": "My Vault"
      }
    }
  }
}

Claude Desktop

Add to claude_desktop_config.json (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows):

{
  "mcpServers": {
    "obsidian": {
      "command": "node",
      "args": ["/absolute/path/to/obsidian-ts-mcp/dist/server.js"],
      "env": {
        "OBSIDIAN_VAULT": "My Vault"
      }
    }
  }
}

Set OBSIDIAN_VAULT to the name of the vault you want to target. The name must match exactly what Obsidian shows in the vault switcher.

Environment variables

Variable Description
OBSIDIAN_VAULT Default vault name appended to every CLI call.

Available tools

The server exposes 26 tools organised into nine groups.

Core -- note management

Tool Description
create_note Create a new note, optionally from a template.
read_note Read the full markdown contents of a note.
append_to_note Append content to the end of a note.
prepend_to_note Prepend content after the frontmatter of a note.
search_vault Full-text search with Obsidian query syntax.
daily_note Get or create today's daily note.
daily_append Append content to today's daily note.

Discovery and context

Tool Description
get_vault_info Vault name, path, file/folder counts, size.
list_files List files, optionally filtered by folder or extension.
get_tags List all tags with occurrence counts.
get_backlinks Find notes that link to a given note.
get_outline Heading structure of a note.

Properties and metadata

Tool Description
set_property Set a frontmatter property on a note.
read_property Read a frontmatter property value.

Tasks

Tool Description
list_tasks List tasks, with filters for status, file, or daily note.
toggle_task Toggle a task checkbox on or off.

Daily notes (extended)

Tool Description
daily_read Read the contents of today's daily note.
daily_prepend Prepend content after the frontmatter of the daily note.

Templates

Tool Description
list_templates List all available templates in the vault.
read_template Read the contents of a template, optionally resolved.

Links

Tool Description
get_links List all outgoing links from a note.

Properties (extended)

Tool Description
list_properties List all frontmatter properties used across the vault.
remove_property Remove a frontmatter property from a note.

Tags (extended)

Tool Description
get_tag_info Get detailed info about a specific tag and its files.

File management

Tool Description
move_file Move or rename a file; Obsidian updates internal links.

Bases

Tool Description
query_base Query an Obsidian Base and return structured results.

Project structure

src/
  cli.ts          -- Low-level Obsidian CLI wrapper (exec, arg building, errors).
  tools.ts        -- MCP tool definitions (names, descriptions, JSON schemas).
  handlers.ts     -- Dispatches tool calls (26 tools) to CLI commands.
  server.ts       -- MCP server entry-point (stdio transport, error handling).
  validation.ts   -- Input validation against tool schemas.
tests/
  cli.test.ts           -- Unit tests for argument building and error types.
  runObsidian.test.ts   -- Tests for CLI execution, timeouts, vault targeting.
  handlers.test.ts      -- Tests for all 26 tool handlers (CLI is mocked).
  tools.test.ts         -- Schema validation for every tool definition.
  validation.test.ts    -- Input validation tests (types, enums, required fields).
  server.test.ts        -- Server factory, error formatting, version checks.

Development

npm run dev           # Watch-mode TypeScript compilation
npm test              # Run the test suite once
npm run test:watch    # Run tests in watch mode
npm run test:coverage # Run tests with coverage report
npm run build         # One-shot compilation
npm run lint          # Run ESLint
npm run format:check  # Check Prettier formatting
npm start             # Start the MCP server on stdio

How it works

  1. An MCP client (VS Code, Claude Desktop, etc.) launches the server over stdio.
  2. The client calls tools/list and receives the 26 tool definitions from src/tools.ts.
  3. When the client invokes a tool, src/server.ts routes the call to handleTool() in src/handlers.ts.
  4. handleTool() validates input against the tool schema, then uses buildArgs() and runObsidian() from src/cli.ts to execute the corresponding obsidian CLI command.
  5. The CLI output is returned to the client as a text content block.

Testing

Tests use Vitest and mock the CLI layer so they never invoke the real Obsidian binary. Run:

npm test

Security considerations

  • Full vault access. The server has read/write access to every note in the targeted vault. Limit OBSIDIAN_VAULT to vaults you are comfortable exposing to AI agents.
  • No authentication. The stdio transport has no built-in auth. Access control depends entirely on who can launch the server process.
  • Input validation. All tool inputs are validated against their declared schemas before execution. The server uses execFile (not exec) to avoid shell injection, but note that file/path values are passed directly to the Obsidian CLI.
  • Environment inheritance. The child process inherits the parent's environment variables. Avoid storing secrets in env vars visible to the server process.

Troubleshooting

Symptom : obsidian: command not found
Cause: CLI binary not on PATH
Fix: Ensure Obsidian 1.12+ is installed and the CLI is enabled in Settings > General

Symptom : Command timed out after 15000ms
Cause: Obsidian desktop app not running
Fix: Start the Obsidian app before using the MCP server

Symptom : vault not found
Cause: Vault name mismatch
Fix: Check that OBSIDIAN_VAULT matches the exact name in Obsidian’s vault switcher

Symptom : Catalyst licence required
Cause: Missing licence
Fix: The Obsidian CLI requires a Catalyst licence — purchase one at obsidian.md

Symptom : Server exits immediately
Cause: Node.js version too old
Fix: Ensure Node.js >= 18 (node --version)

Licence

MIT

推荐服务器

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

官方
精选