Obsidian MCP Server
A lightweight MCP server that enables AI assistants to securely read, create, and modify notes in an Obsidian vault, with support for semantic search and web scraping.
README
Obsidian MCP Server
A lightweight Model Context Protocol (MCP) server that enables AI assistants like Claude Desktop to securely interact with your Obsidian vault.
★ Insight ─────────────────────────────────────
What this server does:
- Acts as a secure bridge between AI clients and your Obsidian vault
- Exposes 6 tools for reading, creating, and modifying notes (down from 15!)
- Supports web scraping with automatic HTML→Markdown conversion
- Enables semantic search across your vault
Key design decisions:
- Uses Bun for zero-build-step TypeScript execution
- Communicates via stdio (standard input/output) for security
- Requires Obsidian Local REST API plugin for vault access
- No external schema validation library (native TypeScript only)
─────────────────────────────────────────────────
Prerequisites
- Bun v1.0 or higher
- Obsidian with the Local REST API plugin installed
- Claude Desktop (or any MCP-compatible client)
Installation
1. Install dependencies
bun install
2. Configure the Local REST API plugin in Obsidian
- Open Obsidian Settings → Community Plugins → Local REST API
- Enable the plugin
- Copy your API key
3. Configure Claude Desktop
Choose one of the following setup methods:
Option A: Per-Project Configuration
Create or edit the Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"obsidian": {
"command": "bun",
"args": ["/absolute/path/to/obsidian-mcp/src/index.ts"],
"env": {
"OBSIDIAN_API_KEY": "your-api-key-here",
"OBSIDIAN_API_URL": "http://127.0.0.1:27124"
}
}
}
}
Option B: Global Configuration (Recommended for Claude Code)
Make Obsidian tools available to all Claude Code sessions:
-
Create the global MCP config directory:
mkdir -p ~/.config/claude -
Create
~/.config/claude/mcp_config.json:{ "mcpServers": { "obsidian": { "command": "bun", "args": ["/absolute/path/to/obsidian-mcp/src/index.ts"], "env": { "OBSIDIAN_API_KEY": "your-api-key-here", "OBSIDIAN_API_URL": "http://127.0.0.1:27124" } } } } -
Verify installation:
claude mcp list
The tools are now available in any Claude Code session without additional setup!
4. Restart Claude Desktop
The server will start automatically when you launch Claude Desktop.
Available Tools
The 15 original tools have been consolidated into 6 more powerful tools:
| Tool | Description |
|---|---|
active_file |
Get/update/append/patch/delete the currently open note |
vault_file |
Get/create/append/delete any file in your vault |
search_vault |
Search with simple text, Dataview DQL, or JsonLogic |
list_vault_files |
List files in a vault directory |
open_file_in_obsidian |
Open a file in the Obsidian UI |
fetch_webpage |
Fetch a public webpage and convert to Markdown |
Tool Details
active_file
Perform operations on the currently active note in Obsidian.
Parameters:
operation(required):get|update|append|patch|deleteformat:markdown(default) |json(for get operation)content: Content for update/append/patch operationstargetType: For patch -heading|block|frontmattertarget: For patch - target identifier- Additional patch options:
targetDelimiter,trimTargetWhitespace,contentType
vault_file
Perform operations on files in your vault by path.
Parameters:
operation(required):get|create|append|deletefilename(required): The file path (can include subdirectories)format:markdown(default) |json(for get operation)content: Content for create/append operations
search_vault
Search your vault using simple text, Dataview DQL, or JsonLogic.
Parameters:
queryType(required):simple|dataview|jsonlogicquery(required): The search querycontextLength: Characters of context around matches (simple search only, default: 100)
list_vault_files
List files in a vault directory.
Parameters:
directory: Optional subdirectory path (omit for root)
open_file_in_obsidian
Open a file in the Obsidian UI.
Parameters:
filename(required): The file path to opennewLeaf: Open in a new pane/tab (default: false)
fetch_webpage
Fetch a public webpage and convert to Markdown.
Parameters:
url(required): The URL to fetchmaxLength: Limit response length (default: 5000)startIndex: Starting index for pagination (default: 0)raw: Return raw HTML instead of Markdown (default: false)
Usage Examples
Ask Claude to work with your notes
"Read my current note and summarize it"
"What tags do I have in my vault?"
"Search my notes for 'machine learning'"
"Create a new note called 'Research Project' with the following outline..."
"Fetch https://example.com and save it as a note"
Development
Run directly with Bun:
# Set environment variables
export OBSIDIAN_API_KEY="your-key"
export OBSIDIAN_API_URL="http://127.0.0.1:27124"
# Run the server
bun run src/index.ts
Code Quality
# Run tests
bun test
# Type checking
bun run typecheck
# Linting
bun run lint
bun run lint:fix
# Formatting
bun run format
bun run format:check
Security
This project follows a source-code transparency security model. See SECURITY.md for full details.
Key security features:
- Local execution only (communicates via stdio, no network exposure)
- API keys never logged or exposed
- SSRF protection (blocks internal network access)
- Input validation on all parameters
- No telemetry or external network calls
- 30-second timeout on all API requests
Why this is secure for open-source distribution:
- You can review the source code yourself
- Runs as your local user (no privilege escalation)
- Only connects to localhost Obsidian API
- Web fetch blocks private/internal networks
Troubleshooting
Server won't start:
- Verify Bun is installed:
bun --version - Check the API key is correct in the config
- Ensure Obsidian is running with Local REST API enabled
Tools not available in Claude:
- Check Claude Desktop logs (View → Toggle Developer → Show Logs)
- Verify the config file path and syntax
- Restart Claude Desktop after config changes
API errors:
- Verify Local REST API plugin is configured in Obsidian
- Check the API URL and port are correct
- Ensure your vault is accessible
Project Structure
obsidian-mcp/
├── src/
│ ├── index.ts # Entry point
│ ├── core/
│ │ └── server.ts # MCP server implementation
│ ├── tools/
│ │ ├── local-rest-api.ts # Obsidian API tools (consolidated to 5)
│ │ └── fetch.ts # Web scraping tool
│ ├── shared/
│ │ ├── tool-registry.ts # Tool registration system
│ │ └── tool-registry.test.ts # Tests
├── .eslintrc.json # ESLint configuration
├── .prettierrc.json # Prettier configuration
├── package.json
├── tsconfig.json
└── README.md
What's New
v0.1.0
- Consolidated 15 tools into 6 more powerful tools
- Added timeout handling (30s default) for all API requests
- Fixed IP validation security bug (172.16-31 range)
- Added ESLint and Prettier configuration
- Added test suite with Bun
- Simplified tool descriptions for better AI understanding
- Added global Claude Code setup instructions
References
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。