Obsidian MCP Server
Obsidian MCP Server
A Model Context Protocol server designed for LLMs to interact with Obsidian vaults. Built with TypeScript and featuring secure API communication, efficient file operations, and comprehensive search capabilities, it enables AI assistants to seamlessly manage knowledge bases through a clean, flexible tool interface.
The Model Context Protocol (MCP) enables AI models to interact with external tools and resources through a standardized interface.
Requires the Local REST API plugin in Obsidian.
Features
File Operations
- Atomic file/directory operations with validation
- Resource monitoring and cleanup
Search System
- Full-text search with configurable context
- Advanced JsonLogic queries for files, tags, and metadata
- Support for glob patterns and frontmatter fields
Property Management
- YAML frontmatter parsing and intelligent merging
- Automatic timestamps (created by Obsidian, modified by server)
- Custom field support
Security & Performance
- API key auth with rate limiting and SSL options
- Resource monitoring and health checks
Installation
- Install Node.js (LTS recommended)
- Enable Local REST API plugin in Obsidian
- Clone and build:
Or install from npm:
Configuration
Add to your MCP client settings (e.g., claude_desktop_config.json
or cline_mcp_settings.json
):
Environment Variables:
Required:
OBSIDIAN_API_KEY
: Your API key from Obsidian's Local REST API plugin settings
Connection Settings:
VERIFY_SSL
: Enable SSL certificate verification (default: false in development)OBSIDIAN_PROTOCOL
: Protocol to use (default: "https")OBSIDIAN_HOST
: Host address (default: "127.0.0.1")OBSIDIAN_PORT
: Port number (default: 27124)
Request Limits:
REQUEST_TIMEOUT
: Request timeout in milliseconds (default: 5000)MAX_CONTENT_LENGTH
: Maximum response content length in bytes (default: 52428800 [50MB])MAX_BODY_LENGTH
: Maximum request body length in bytes (default: 52428800 [50MB])
Rate Limiting:
RATE_LIMIT_WINDOW_MS
: Rate limit window in milliseconds (default: 900000 [15 minutes])RATE_LIMIT_MAX_REQUESTS
: Maximum requests per window (default: 200)
Tool Execution:
TOOL_TIMEOUT_MS
: Tool execution timeout in milliseconds (default: 60000 [1 minute])
SSL Certificate Setup:
For Windows Users:
- Development Setup (Not Recommended for Production):
- Set
VERIFY_SSL
to "false" - Set
OBSIDIAN_PROTOCOL
to "http" - Enable "Non-encrypted (HTTP) Server" in Obsidian's Local REST API settings
- Set
- Production Setup (Recommended):
- Set
VERIFY_SSL
to "true" - Get the certificate from Obsidian Settings > Local REST API > 'How to Access'
- Open Windows Certificate Manager (certmgr.msc)
- Navigate to "Trusted Root Certification Authorities" > "Certificates"
- Right-click > "All Tasks" > "Import" and select the certificate file
- Set
For Other Systems:
- macOS: Add certificate to Keychain Access
- Linux: Add to ca-certificates
Additional configuration options:
Error Handling:
- All errors include a 5-digit error code
- HTTP status codes are automatically converted (e.g., 404 -> 40400)
- Default server error code: 50000
- Detailed error messages include original error stack traces in development
Tools
File Management
Search Operations
Content Modification
Command Management
File Navigation
Property Management
Best Practices
File Operations
- Use atomic operations with validation
- Handle errors and monitor performance
Search Implementation
- Use appropriate search tool for the task:
- obsidian_find_in_file for text search
- obsidian_complex_search for metadata/tag filtering
- Keep context size reasonable (default: 10 chars)
Property Management
- Use appropriate types and validate updates
- Handle arrays and custom fields properly
- Never set timestamps (managed automatically)
Error Prevention
- Validate inputs and handle errors gracefully
- Monitor patterns and respect rate limits
Contributing
- Fork the repository
- Create a feature branch
- Submit a Pull Request
For bugs and features, create an issue at https://github.com/cyanheads/obsidian-mcp-server/issues.
Publishing
The package is automatically published to npm when version tags are pushed:
This will trigger the GitHub Action to build and publish the package.
License
Apache License 2.0
<div align="center"> Built with the Model Context Protocol </div>
You must be authenticated.
Enables interaction between LLMs and Obsidian vaults through the Model Context Protocol, supporting secure file operations, content management, and advanced search capabilities.