obsidian-mcp-server
Connects Claude.ai to your local Obsidian vault for full CRUD access, search, and daily note creation via the Model Context Protocol.
README
obsidian-mcp-server
A production-grade Model Context Protocol (MCP) server that connects Claude.ai to your local Obsidian vault. Gives Claude full CRUD access to your notes, full-text fuzzy search, backlink resolution, frontmatter parsing, and daily note creation — all over the secure stdio transport.
Prerequisites
- Node.js ≥ 20.0.0
- npm ≥ 9.0.0
- An existing Obsidian vault on your local filesystem
- Claude Desktop (macOS, Windows, or Linux)
Installation
Option A — Clone & build locally
git clone https://github.com/yourusername/obsidian-mcp-server.git
cd obsidian-mcp-server
npm install
npm run build
Option B — Install globally via npm (once published)
npm install -g obsidian-mcp-server
Configure the vault path
cp .env.example .env
# Edit .env and set OBSIDIAN_VAULT_PATH to your vault directory
Or pass it on the CLI:
node dist/index.js --vault /path/to/your/vault
Connecting to Claude Desktop
Add the server to your Claude Desktop config file.
macOS
~/Library/Application Support/Claude/claude_desktop_config.json
Windows
%APPDATA%\Claude\claude_desktop_config.json
Linux
~/.config/claude/claude_desktop_config.json
Config snippet (local build)
{
"mcpServers": {
"obsidian": {
"command": "node",
"args": ["/absolute/path/to/obsidian-mcp-server/dist/index.js"],
"env": {
"OBSIDIAN_VAULT_PATH": "/absolute/path/to/your/obsidian/vault"
}
}
}
}
Config snippet (global npm install)
{
"mcpServers": {
"obsidian": {
"command": "obsidian-mcp",
"env": {
"OBSIDIAN_VAULT_PATH": "/absolute/path/to/your/obsidian/vault"
}
}
}
}
After editing the config, restart Claude Desktop. You should see the Obsidian tools available in the tools panel.
Tools Reference
1. read_note
Read a note's body, frontmatter, word count, and last-modified timestamp.
Input:
{
"path": "Projects/MyNote.md"
}
Output:
{
"content": "# My Note\n\nMarkdown body without frontmatter...",
"frontmatter": { "title": "My Note", "tags": ["project"] },
"wordCount": 142,
"lastModified": "2024-03-15T10:30:00.000Z"
}
2. write_note
Create or overwrite a note. Set overwrite: true to replace an existing note.
Input:
{
"path": "Projects/NewNote.md",
"content": "# New Note\n\nContent here.",
"frontmatter": { "tags": ["project", "active"] },
"overwrite": false
}
Output:
{
"success": true,
"path": "Projects/NewNote.md",
"created": true
}
3. append_note
Append content to an existing note, optionally under a specific heading.
Input:
{
"path": "Daily Notes/2024-03-15.md",
"content": "- Completed code review",
"section": "Tasks"
}
Output:
{
"success": true,
"newWordCount": 187
}
4. delete_note
Move a note to .trash/ inside the vault (not permanent deletion). Requires confirm: true.
Input:
{
"path": "Archive/OldNote.md",
"confirm": true
}
Output:
{
"success": true,
"deletedPath": "Archive/OldNote.md"
}
5. list_notes
List notes with optional folder, tag, and recursion filters.
Input:
{
"folder": "Projects",
"tag": "active",
"recursive": true,
"limit": 50
}
Output:
{
"notes": [
{
"path": "Projects/Alpha.md",
"title": "Project Alpha",
"tags": ["project", "active"],
"lastModified": "2024-03-15T09:00:00.000Z",
"wordCount": 320
}
]
}
6. search_notes
Full-text fuzzy search with relevance scoring and highlighted excerpts.
Input:
{
"query": "machine learning neural network",
"limit": 10,
"searchIn": ["title", "content"],
"tag": "research"
}
Output:
{
"results": [
{
"path": "Research/ML-Notes.md",
"title": "ML Notes",
"score": 14.2,
"excerpt": "…backpropagation through **neural network** layers enables **machine learning** models to…",
"tags": ["research", "ml"]
}
]
}
7. get_backlinks
Find all notes that link to a given note via [[WikiLinks]] or [text](path.md).
Input:
{
"path": "Concepts/Recursion.md"
}
Output:
{
"backlinks": [
{
"fromPath": "Algorithms/DFS.md",
"fromTitle": "Depth-First Search",
"context": "…DFS uses [[Recursion]] as its core mechanism for traversing…"
}
]
}
8. create_daily_note
Create an Obsidian-style daily note at Daily Notes/YYYY-MM-DD.md.
Input:
{
"date": "2024-03-15",
"template": "Templates/Daily.md",
"additionalContent": "## Meeting Agenda\n\n- Sprint planning"
}
Output:
{
"path": "Daily Notes/2024-03-15.md",
"alreadyExisted": false
}
Template tokens: {{date}} → 2024-03-15, {{time}} → 09:30 AM, {{title}} → 2024-03-15.
RAG Workflow Example
A typical search → read → write pattern for AI-augmented note-taking:
User: "Summarize all my notes tagged 'meeting' from this week and create a summary note."
Claude:
1. search_notes({ query: "meeting", tag: "meeting", limit: 20 })
→ finds 5 recent meeting notes
2. read_note({ path: "Meetings/2024-03-13.md" })
read_note({ path: "Meetings/2024-03-14.md" })
read_note({ path: "Meetings/2024-03-15.md" })
→ reads each note's content
3. write_note({
path: "Summaries/Week-2024-03-11.md",
content: "# Week Summary\n\n...",
frontmatter: { tags: ["summary", "weekly"] }
})
→ creates the summary note
Security
Path Traversal Protection
Every file path provided to the server is validated against the vault root:
- The path is resolved with
path.resolve()against the vault root. - The resolved absolute path is checked to ensure it starts with the vault root directory.
- Any path that escapes the vault (e.g.,
../../etc/passwd,/absolute/paths) throws aVaultSecurityErrorand is rejected before any I/O occurs.
Atomic Writes
All write operations use a write-to-temp-then-rename pattern:
- Content is written to a
.tmp.PID.TIMESTAMPfile. - The temp file is atomically renamed to the final path.
- On failure, the temp file is cleaned up.
This prevents partial writes from corrupting your notes.
Trash Instead of Delete
delete_note moves notes to .trash/ inside the vault rather than permanently deleting them. Notes can be recovered manually from that folder.
Development
# Run in dev mode with hot reload
npm run dev
# Type check
npm run typecheck
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Lint
npm run lint
# Build for production
npm run build
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feat/my-feature - Make your changes with tests
- Ensure all tests pass:
npm test - Ensure no type errors:
npm run typecheck - Submit a pull request
Please follow the existing code style and ensure exactOptionalPropertyTypes strict mode is maintained.
License
MIT License
Copyright (c) 2024 obsidian-mcp-server contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。