obsidian-mcp
Obsidian MCP Server
An MCP (Model Context Protocol) server that lets AI agents directly interact with Obsidian vaults. Supports both direct file system access and the Obsidian Local REST API plugin.
Features
Note Operations
- Read, create, update, delete, and move notes
- Parse YAML frontmatter, wikilinks (
[[links]]), tags, embeds, and callouts - Manage frontmatter metadata (merge updates without overwriting existing fields)
Search
- Full-text search with
+must-haveand-excludesyntax - Search by tag, frontmatter metadata, or wikilink backlinks
- Context snippets for search results
Obsidian-Specific
- Wikilink creation and backlink discovery
- Vault link graph analysis
- Template management with
{{variable}}substitution - Daily notes (get, create, append)
- Built-in variables:
{{date}},{{time}},{{datetime}},{{year}},{{month}},{{day}},{{weekday}}
Memory Store
- Save agent memories/knowledge as structured Obsidian notes
- Categorize memories (general, conversation, fact, task, insight)
- Set importance levels (1-5)
- Recall memories by text search, category, or importance
- Link memories to related notes via wikilinks
REST API Integration
- Use Obsidian's built-in search engine via the Local REST API plugin
- Open notes directly in the Obsidian app
- Execute Obsidian commands remotely
- Graceful fallback when the plugin is not installed
Installation
From PyPI (recommended)
pip install obsidian-mcp
From source
git clone https://github.com/your-username/obsidian-mcp.git
cd obsidian-mcp
pip install -e .
Configuration
Set environment variables to configure the server:
Usage with MCP Clients
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"obsidian": {
"command": "obsidian-mcp",
"env": {
"OBSIDIAN_VAULT_PATH": "/path/to/your/vault"
}
}
}
}
Codex / Other MCP Clients
{
"mcpServers": {
"obsidian": {
"command": "obsidian-mcp",
"env": {
"OBSIDIAN_VAULT_PATH": "E:\\vault\\your-vault"
}
}
}
}
With REST API enabled
{
"mcpServers": {
"obsidian": {
"command": "obsidian-mcp",
"env": {
"OBSIDIAN_VAULT_PATH": "/path/to/your/vault",
"OBSIDIAN_REST_API_ENABLED": "true",
"OBSIDIAN_REST_API_TOKEN": "your-api-token"
}
}
}
}
Available Tools
Obsidian Local REST API Plugin (Optional)
To use the REST API features:
- Install the Local REST API community plugin in Obsidian
- Enable it and note the API key from plugin settings
- Set
OBSIDIAN_REST_API_ENABLED=trueandOBSIDIAN_REST_API_TOKEN=<your-key>
License
MIT
Obsidian MCP 服务器
一个 MCP(模型上下文协议)服务器,让 AI 智能体可以直接与 Obsidian 笔记库交互。支持直接文件系统访问和 Obsidian Local REST API 插件两种方式。
功能特性
笔记操作
- 读取、创建、更新、删除和移动笔记
- 解析 YAML frontmatter、wikilinks (
[[双向链接]])、标签、嵌入和 Callout - 管理 frontmatter 元数据(合并更新,不会覆盖现有字段)
搜索
- 全文搜索,支持
+必须包含和-排除语法 - 按标签、frontmatter 元数据或 wikilink 反向链接搜索
- 搜索结果附带上下文片段
Obsidian 特性
- Wikilink 创建和反向链接发现
- 笔记库链接图谱分析
- 模板管理,支持
{{变量}}替换 - 每日笔记(获取、创建、追加)
- 内置变量:
{{date}}、{{time}}、{{datetime}}、{{year}}、{{month}}、{{day}}、{{weekday}}
记忆存储
- 将智能体记忆/知识保存为结构化的 Obsidian 笔记
- 分类管理(general、conversation、fact、task、insight)
- 设置重要性等级(1-5)
- 通过文本搜索、分类或重要性召回记忆
- 通过 wikilinks 将记忆与相关笔记关联
REST API 集成
- 通过 Local REST API 插件使用 Obsidian 内置搜索引擎
- 在 Obsidian 应用中直接打开笔记
- 远程执行 Obsidian 命令
- 插件未安装时优雅降级到直接文件访问
安装
pip install obsidian-mcp
或从源码安装:
git clone https://github.com/your-username/obsidian-mcp.git
cd obsidian-mcp
pip install -e .
配置
在 MCP 客户端中使用
Claude Desktop — 在 claude_desktop_config.json 中添加:
{
"mcpServers": {
"obsidian": {
"command": "obsidian-mcp",
"env": {
"OBSIDIAN_VAULT_PATH": "E:\\vault\\YourVault"
}
}
}
}
License
MIT