Obsidian MCP Server
A Model Context Protocol (MCP) server that provides AI assistants with access to your Obsidian vault through the Obsidian Local REST API plugin.
README
Obsidian MCP Server
A Model Context Protocol (MCP) server that provides AI assistants with access to your Obsidian vault through the Obsidian Local REST API plugin.
Features
Tools
- obsidian-get-note: Retrieve note content by filename
- obsidian-create-note: Create new notes with optional frontmatter
- obsidian-update-note: Update existing note content and metadata
- obsidian-delete-note: Delete notes from the vault
- obsidian-search-notes: Search for notes containing specific text
- obsidian-list-files: List all files and folders in the vault
- obsidian-get-vault-info: Get vault information and statistics
- obsidian-create-folder: Create new folders in the vault
- obsidian-get-tags: Get all tags used in the vault
- obsidian-ping: Check server connectivity
Resources
- obsidian://note/{filename}: Access individual note content
- obsidian://vault/files: Complete file and folder listing
- obsidian://vault/info: Vault information and statistics
- obsidian://vault/tags: All tags in the vault
- obsidian://search/{query}: Dynamic search results
Prerequisites
- Obsidian with the Local REST API plugin installed and enabled
- Node.js (version 18 or higher)
Setting up Obsidian Local REST API
- Install the Obsidian Local REST API plugin
- Enable the plugin in Obsidian settings
- Configure the plugin settings:
- Port: Default is
27123(or choose your preferred port) - API Key: Set a secure API key (optional but recommended)
- CORS: Enable if needed for web-based MCP clients
- Port: Default is
Installation
From NPM (when published)
npm install -g obsidian-mcp-server
From Source
git clone <repository-url>
cd obsidian-mcp-server
npm install
npm run build
Configuration
The server uses environment variables for configuration:
Using .env File (Recommended)
- Copy the example environment file:
cp .env.example .env
- Edit
.envfile with your settings:
# Required: Obsidian Local REST API base URL
OBSIDIAN_API_BASE_URL=http://localhost:27123
# Optional: API key if configured in Obsidian plugin
OBSIDIAN_API_KEY=your-api-key-here
The server automatically loads the .env file when started.
Using Environment Variables
Alternatively, you can set environment variables directly:
# Required: Obsidian Local REST API base URL
export OBSIDIAN_API_BASE_URL="http://localhost:27123"
# Optional: API key if configured in Obsidian plugin
export OBSIDIAN_API_KEY="your-api-key-here"
With Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\\Claude\\claude_desktop_config.json
{
"mcpServers": {
"obsidian": {
"command": "obsidian-mcp-server",
"env": {
"OBSIDIAN_API_BASE_URL": "http://localhost:27123",
"OBSIDIAN_API_KEY": "your-api-key-here"
}
}
}
}
With Other MCP Clients
For stdio transport:
OBSIDIAN_API_BASE_URL="http://localhost:27123" OBSIDIAN_API_KEY="your-key" obsidian-mcp-server
Usage Examples
Once connected, you can ask your AI assistant to:
Basic Operations
- "Show me the content of my 'Meeting Notes.md' file"
- "Create a new note called 'Ideas.md' with the content 'My brilliant ideas'"
- "Search for notes containing 'project'"
- "List all files in my vault"
Advanced Operations
- "Create a note with frontmatter including tags and creation date"
- "Update my daily note with today's tasks"
- "Show me all tags in my vault"
- "Create a folder called 'Projects' for organizing my work"
Working with Resources
- Access note content directly:
obsidian://note/filename.md - View vault statistics:
obsidian://vault/info - Get search results:
obsidian://search/your%20query
Development
Setup
git clone <repository-url>
cd obsidian-mcp-server
npm install
Development Mode
npm run dev
Build
npm run build
Testing
# Test with MCP Inspector
npx @modelcontextprotocol/inspector npm run dev
# Or test with a specific configuration
OBSIDIAN_API_BASE_URL="http://localhost:27123" npx @modelcontextprotocol/inspector npm run dev
API Reference
Environment Variables
| Variable | Description | Default | Required |
|---|---|---|---|
OBSIDIAN_API_BASE_URL |
Base URL for Obsidian Local REST API | http://localhost:27123 |
No |
OBSIDIAN_API_KEY |
API key for authentication | - | No |
Tool Schemas
obsidian-get-note
{
filename: string // The filename of the note to retrieve
}
obsidian-create-note
{
filename: string // The filename for the new note
content: string // The content of the note
frontmatter?: Record<string, any> // Optional frontmatter metadata
}
obsidian-search-notes
{
query: string // The search query text
}
Resource URIs
obsidian://note/{filename}- Individual note contentobsidian://vault/files- Complete file listingobsidian://vault/info- Vault informationobsidian://vault/tags- All tagsobsidian://search/{query}- Search results
Troubleshooting
Connection Issues
- Server not accessible: Ensure Obsidian is running and the Local REST API plugin is enabled
- Port conflicts: Check if port 27123 (or your configured port) is available
- API key issues: Verify the API key matches your Obsidian plugin configuration
Common Problems
- "Cannot find module" errors: Run
npm installto install dependencies - Permission errors: Ensure proper file permissions for the build directory
- CORS errors: Enable CORS in the Obsidian Local REST API plugin settings
Debug Mode
Run with debug logging:
DEBUG=* OBSIDIAN_API_BASE_URL="http://localhost:27123" obsidian-mcp-server
📚 Documentation
📖 Complete Documentation
See the docs/ folder for comprehensive guides, or check the Documentation Index for organized access to all guides.
Setup & Configuration
- LM Studio Setup Guide - Complete LM Studio configuration and deployment
- LM Studio Quick Start - Quick reference for LM Studio integration
- Environment File Usage - Using .env files with LM Studio and other clients
Docker & Deployment
- Docker Deployment Guide - Complete Docker containerization guide
- Docker Summary - Docker toolkit integration overview
Publishing & Distribution
- Registry Publishing Guide - Complete guide to publish to Docker MCP Registry
- Publishing Summary - Quick publishing checklist and steps
Quick Links
| Topic | Guide | Description |
|---|---|---|
| 🚀 Getting Started | LM Studio Quick Start | Fastest way to get running |
| 🐳 Docker | Docker Summary | Containerization overview |
| ⚙️ Configuration | Environment Files | Managing environment variables |
| 🏪 Publishing | Registry Publishing | Share with the community |
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes and add tests
- Run the build:
npm run build - Submit a pull request
License
MIT License - see LICENSE file for details.
Related Projects
- Obsidian - A powerful knowledge base
- Obsidian Local REST API - REST API plugin for Obsidian
- Model Context Protocol - Protocol for AI-context integration
- Claude Desktop - AI assistant supporting MCP
Built with ❤️ for the Obsidian and AI community
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。