Supports environment variable loading through dotenv for server configuration.
Provides comprehensive access to Obsidian vaults with tools for reading, writing, searching, and managing notes. Enables file operations, frontmatter management, tag operations, and Dataview query execution.
Enables secure remote access to Obsidian vaults through Tailscale Funnel with end-to-end encryption, automatic HTTPS certificates, and no port forwarding requirements.
Uses Zod for schema validation and custom sanitization logic in MCP server operations.
Obsidian MCP Server - Enhanced
Enhanced Obsidian MCP Server with Claude.ai Remote Integration, Tailscale Support, and Advanced Query Capabilities!
š„ Enhanced Fork Notice: This is an enhanced version of the excellent cyanheads/obsidian-mcp-server with additional features specifically tailored for remote Claude.ai integration, advanced task querying, and security via Tailscale.
An MCP (Model Context Protocol) server providing comprehensive access to your Obsidian vault. Enables LLMs and AI agents to read, write, search, and manage your notes and files through the Obsidian Local REST API plugin.
Built on the cyanheads/mcp-ts-template
, this server follows a modular architecture with robust error handling, logging, and security features.
š Enhanced Features (This Fork)
šļø Multi-Vault Support
Simultaneous access to multiple Obsidian vaults through a single MCP server:
Multiple Vault Management: Connect to multiple Obsidian instances on different ports simultaneously
Vault-Specific Routing: Tools automatically route to the correct vault based on
vault
parameterIndividual Authentication: Separate API keys for each vault with centralized MCP authentication
Backwards Compatible: Existing single-vault configurations continue to work unchanged
Dynamic Configuration: JSON-based vault configuration with validation and error handling
š Claude.ai Remote Integration
Perfect integration with Claude.ai's Remote MCP feature:
Stateless HTTP Mode: Dedicated stateless transport for Claude.ai compatibility (
MCP_HTTP_STATELESS=true
)Session-Based Mode: Traditional session management for other MCP clients
Simplified Authentication: Uses dedicated MCP_AUTH_KEY for server access
Zero Configuration: Works out-of-the-box with Claude.ai Remote MCP servers
Production Ready: Enterprise-grade stability and error handling
š Tailscale Secure Remote Access
Access your Obsidian vault securely from anywhere:
Tailscale Funnel Integration: Secure HTTPS endpoints with automatic certificates
End-to-End Encryption: All traffic encrypted through Tailscale network
No Port Forwarding: Zero network configuration required
Access Control: Built-in Tailscale ACL support for enterprise security
š Enhanced Task & Query System
Advanced querying capabilities beyond the original:
Tasks Plugin Integration: Deep integration with Obsidian Tasks plugin
Advanced Date Parsing: Natural language date recognition
Priority Detection: Visual and text-based priority parsing
Multiple Output Formats: Table, list, and summary views
š§ Production Monitoring & Reliability
Enterprise-grade monitoring and auto-restart capabilities:
Health Check Script: Comprehensive component validation (
scripts/health-check.sh
)Intelligent Monitoring: Auto-restart with process lifecycle management (
scripts/monitor-mcp.sh
)macOS Auto-Start: Launch agent configuration for system startup (
scripts/setup-autostart.sh
)Dynamic Port Management: Automatic port conflict resolution (3010-3013 range)
Enhanced Logging: Detailed connection debugging and API key validation
š Core Capabilities: Obsidian Tools š ļø
This server equips your AI with specialized tools to interact with your Obsidian vault:
Tool Name | Description | Key Features |
Retrieves the content and metadata of a specified file. | - Read in
or
format. - Case-insensitive path fallback. - Includes file stats (creation/modification time). | |
Modifies notes using whole-file operations. | -
,
, or
content. - Can create files if they don't exist. - Targets files by path, active note, or periodic note. | |
Performs search-and-replace operations within a target note. | - Supports string or regex search. - Options for case sensitivity, whole word, and replacing all occurrences. | |
Performs a search across the entire vault. | - Text or regex search. - Filter by path and modification date. - Paginated results. | |
Lists files and subdirectories within a specified vault folder. | - Filter by file extension or name regex. - Provides a formatted tree view of the directory. | |
Atomically manages a note's YAML frontmatter. | -
,
, or
frontmatter keys. - Avoids rewriting the entire file for metadata changes. | |
Adds, removes, or lists tags for a note. | - Manages tags in both YAML frontmatter and inline content. | |
Permanently deletes a specified file from the vault. | - Case-insensitive path fallback for safety. | |
Execute Dataview DQL queries against your vault. | - Run TABLE, LIST queries using Dataview syntax. - Query notes by tags, frontmatter, dates. - Generate reports and analytics. | |
Search and analyze tasks across your vault. | - Filter by status, date ranges, priorities. - Multiple output formats. - Extract task metadata (due dates, tags). |
Table of Contents
| Overview | Features | Installation | | Configuration | Project Structure | Vault Cache Service | | Tools | Resources | Development | License |
Overview
The Obsidian MCP Server acts as a bridge, allowing applications (MCP Clients) that understand the Model Context Protocol (MCP) ā like advanced AI assistants (LLMs), IDE extensions, or custom scripts ā to interact directly and safely with your Obsidian vault.
Instead of complex scripting or manual interaction, your tools can leverage this server to:
Automate vault management: Read notes, update content, manage frontmatter and tags, search across files, list directories, and delete files programmatically.
Integrate Obsidian into AI workflows: Enable LLMs to access and modify your knowledge base as part of their research, writing, or coding tasks.
Build custom Obsidian tools: Create external applications that interact with your vault data in novel ways.
Built on the robust mcp-ts-template
, this server provides a standardized, secure, and efficient way to expose Obsidian functionality via the MCP standard. It achieves this by communicating with the powerful Obsidian Local REST API plugin running inside your vault.
Developer Note: This repository includes a .clinerules file that serves as a developer cheat sheet for your LLM coding agent with quick reference for the codebase patterns, file locations, and code snippets.
Features
Core Utilities
Leverages the robust utilities provided by the mcp-ts-template
:
Logging: Structured, configurable logging (file rotation, console, MCP notifications) with sensitive data redaction.
Error Handling: Centralized error processing, standardized error types (
McpError
), and automatic logging.Configuration: Environment variable loading (
dotenv
) with comprehensive validation.Input Validation/Sanitization: Uses
zod
for schema validation and custom sanitization logic.Request Context: Tracking and correlation of operations via unique request IDs.
Type Safety: Strong typing enforced by TypeScript and Zod schemas.
HTTP Transport Option: Native Node.js HTTP server with session management, CORS support, and API key authentication.
Obsidian Integration
Obsidian Local REST API Integration: Communicates directly with the Obsidian Local REST API plugin via HTTP requests managed by the
ObsidianRestApiService
.Comprehensive Command Coverage: Exposes key vault operations as MCP tools (see Tools section).
Vault Interaction: Supports reading, updating (append, prepend, overwrite), searching (global text/regex, search/replace), listing, deleting, and managing frontmatter and tags.
Targeting Flexibility: Tools can target files by path, the currently active file in Obsidian, or periodic notes (daily, weekly, etc.).
Vault Cache Service: An intelligent in-memory cache that improves performance and resilience. It caches vault content, provides a fallback for the global search tool if the live API fails, and periodically refreshes to stay in sync.
Safety Features: Case-insensitive path fallbacks for file operations, clear distinction between modification types (append, overwrite, etc.).
Installation
Prerequisites
Obsidian: You need Obsidian installed.
Obsidian Local REST API Plugin: Install and enable the Obsidian Local REST API plugin within your Obsidian vault.
API Key: Configure an API key within the Local REST API plugin settings in Obsidian. You will need this key to configure the server.
Node.js & npm: Ensure you have Node.js (v18 or later recommended) and npm installed.
Tailscale (for remote access): Install Tailscale and enable Tailscale Funnel for secure remote Claude.ai integration.
š” Quick Setup: For automatic startup on boot, see the Auto-Start Setup Guide after installation.
Installation
Clone this enhanced repository:
git clone https://github.com/BoweyLou/obsidian-mcp-server-enhanced.git cd obsidian-mcp-server-enhancedInstall dependencies:
npm installBuild the project:
npm run buildThis compiles the TypeScript code to JavaScript in the
dist/
directory and makes the entry point executable.
Configuration
Environment Variables
Configure the server using environment variables.
These variables must be set in the MCP client configuration (e.g., cline_mcp_settings.json
) or in your environment before starting the server (if running directly).
If running directly, they can be set in a .env
file in the project root or directly in your environment.
Variable | Description | Required | Default |
| Authentication key for Claude.ai Remote MCP access. Generate with
| Yes (Remote) |
|
| JSON array of vault configurations for multi-vault mode. | Yes (Multi) |
|
| API Key from Obsidian plugin (single-vault mode only). | Yes (Single) |
|
| Base URL of Obsidian API (single-vault mode only). | Yes (Single) |
|
| Server transport:
or
. | No |
|
| Port for the HTTP server. | No |
|
| Host for the HTTP server. | No |
|
| Enable stateless mode for Claude.ai compatibility. | No |
|
| Comma-separated origins for CORS. Set for production. | No | (none) |
| Logging level (
,
,
, etc.). | No |
|
| Set to
to disable SSL verification. | No |
|
| Set to
to enable the in-memory vault cache. | No |
|
| Refresh interval for the vault cache in minutes. | No |
|
Multi-Vault Configuration
The server supports both single-vault (backwards compatible) and multi-vault modes:
Single-Vault Mode (Legacy)
Multi-Vault Mode (Recommended)
Setup Process
Generate MCP Auth Key:
openssl rand -hex 32
Configure Multiple Obsidian Instances: Install Local REST API plugin on different ports
Get API Keys: Extract API keys from each Obsidian instance's plugin settings
Configure Vaults: Update
.env
withOBSIDIAN_VAULTS
JSON configurationStart Server:
npm run start:http
Access via Claude.ai: Use your Tailscale URL with MCP_AUTH_KEY
Connecting to the Obsidian API
Single-Vault Mode
To connect in single-vault mode, configure the base URL (OBSIDIAN_BASE_URL
) and API key (OBSIDIAN_API_KEY
). The Obsidian Local REST API plugin offers two connection types:
Encrypted (HTTPS):
Uses secure
https://
endpoint (e.g.,https://127.0.0.1:27124
)Requires
OBSIDIAN_VERIFY_SSL=false
for self-signed certificates
Non-encrypted (HTTP) - Recommended:
Uses
http://
endpoint (e.g.,http://127.0.0.1:27123
)Simpler setup, no SSL verification needed
Multi-Vault Mode
For multi-vault mode, configure each vault individually in the OBSIDIAN_VAULTS
JSON array with its own API key and base URL. Each vault can use either HTTP or HTTPS as needed.
Example configurations:
Single-vault with HTTP:
Multi-vault configuration:
Local MCP Client Settings (Optional)
Note: For Claude.ai Remote MCP integration, skip this section and use the Tailscale Remote Access Setup instead.
For local MCP clients (e.g., Cline), add to your settings (e.g., cline_mcp_settings.json
):
Single-vault configuration:
Multi-vault configuration:
š Remote Access Setup (Tailscale)
For remote access to your Obsidian vault from anywhere, you can use Tailscale to securely expose your MCP server over the internet.
Prerequisites
Tailscale Account: Sign up at tailscale.com
Tailscale Installed: Install Tailscale on your machine running the MCP server
Tailscale Funnel Enabled: Enable Tailscale Funnel for your account
Setup Steps
Generate MCP Auth Key:
openssl rand -hex 32Configure Environment: Set up your
.env
file with the generated key:MCP_AUTH_KEY=your-generated-auth-key MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 MCP_HTTP_STATELESS=trueConfigure Vaults: Set up single or multi-vault configuration (see Multi-Vault Configuration)
Start the MCP Server:
npm run build && npm run start:httpEnable Tailscale Funnel:
tailscale funnel 3010Get Your Public URL: Check your Tailscale device URL:
tailscale status --self | grep "Funnel on"
Claude.ai Remote MCP Configuration
Add to your Claude.ai Remote MCP servers using your MCP authentication key:
Single-vault setup:
Multi-vault setup:
Authentication Note: Claude.ai Remote MCP uses the
MCP_AUTH_KEY
for server authentication. Individual vault operations use the vault-specific API keys configured in your environment.
Security Considerations
Dual Authentication: MCP server authentication via MCP_AUTH_KEY, vault authentication via individual API keys
Tailscale Encryption: All traffic is encrypted end-to-end by Tailscale
Private Network: Only you can access the server through your Tailscale network
Automatic SSL: Tailscale Funnel provides automatic HTTPS certificates
Vault Isolation: Each vault uses its own API key for secure access control
Example Usage
Once set up, you can use tools remotely from Claude.ai:
Single-vault commands (uses default vault):
Multi-vault commands (specify vault):
š Pro Tip: For production use, set up automatic startup on boot so your server and Tailscale Funnel start automatically without manual intervention.
Project Structure
The codebase follows a modular structure within the src/
directory:
For a detailed file tree, run npm run tree
or see docs/tree.md.
Vault Cache Service
This server includes an intelligent in-memory cache designed to enhance performance and resilience when interacting with your vault.
Purpose and Benefits
Performance: By caching file content and metadata, the server can perform search operations much faster, especially in large vaults. This reduces the number of direct requests to the Obsidian Local REST API, resulting in a snappier experience.
Resilience: The cache acts as a fallback for the
obsidian_global_search
tool. If the live API search fails or times out, the server seamlessly uses the cache to provide results, ensuring that search functionality remains available even if the Obsidian API is temporarily unresponsive.Efficiency: The cache is designed to be efficient. It performs an initial build on startup and then periodically refreshes in the background by checking for file modifications, ensuring it stays reasonably up-to-date without constant, heavy API polling.
How It Works
Initialization: When enabled, the
VaultCacheService
builds an in-memory map of all.md
files in your vault, storing their content and modification times.Periodic Refresh: The cache automatically refreshes at a configurable interval (defaulting to 10 minutes). During a refresh, it only fetches content for files that are new or have been modified since the last check.
Proactive Updates: After a file is modified through a tool like
obsidian_update_file
, the service proactively updates the cache for that specific file, ensuring immediate consistency.Search Fallback: The
obsidian_global_search
tool first attempts a live API search. If this fails, it automatically falls back to searching the in-memory cache.
Configuration
The cache is enabled by default but can be configured via environment variables:
OBSIDIAN_ENABLE_CACHE
: Set totrue
(default) orfalse
to enable or disable the cache service.OBSIDIAN_CACHE_REFRESH_INTERVAL_MIN
: Defines the interval in minutes for the periodic background refresh. Defaults to10
.
Tools
The Obsidian MCP Server provides a suite of tools for interacting with your vault(s), callable via the Model Context Protocol.
Multi-Vault Support
All tools support an optional vault
parameter to specify which vault to operate on:
Default Behavior: Without
vault
parameter, tools use the first configured vaultSpecific Vault: Add
vault: "vault-id"
to target a specific vaultExample:
obsidian_read_file(filePath="note.md", vault="work")
Tool Name | Description | Key Arguments |
| Retrieves the content and metadata of a file. |
,
,
,
|
| Modifies a file by appending, prepending, or overwriting. |
,
,
,
,
|
| Performs search-and-replace operations in a note. |
,
,
,
,
|
| Searches the entire vault for content. |
,
,
,
,
,
|
| Lists files and subdirectories in a folder. |
,
,
,
|
| Gets, sets, or deletes keys in a note's frontmatter. |
,
,
,
,
|
| Adds, removes, or lists tags in a note. |
,
,
,
|
| Permanently deletes a file from the vault. |
,
|
| Execute Dataview DQL queries against your vault. |
,
,
|
| Search and analyze tasks across your vault. |
,
,
,
,
,
|
| Create and manage daily, weekly, monthly, yearly notes. |
,
,
,
,
,
|
| Work with block references and heading operations. |
,
,
,
,
,
|
| Analyze note connections and vault relationships. |
,
,
,
,
|
| Create files from templates with variable substitution. |
,
,
,
,
|
| Get intelligent link suggestions and recommendations. |
,
,
,
,
|
Note: All tools support comprehensive error handling, multi-vault routing, and return structured JSON responses.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Attribution
This enhanced version is based on the excellent work by cyanheads in the original obsidian-mcp-server project. All core functionality and architecture credit goes to the original author.
Enhancements in this fork:
Multi-Vault Support: Simultaneous access to multiple Obsidian vaults with vault-specific routing
Claude.ai Remote MCP integration and compatibility fixes
Tailscale Funnel integration for secure remote access
Enhanced HTTP transport layer with authentication separation (MCP_AUTH_KEY)
Advanced task querying with Tasks plugin integration
5 New Advanced Tools: Periodic notes, block references, graph analysis, template system, and smart linking
Production-ready configuration for enterprise use
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A Model Context Protocol server that provides comprehensive access to Obsidian vaults with Claude.ai remote integration, Tailscale support, and advanced query capabilities.
Related MCP Servers
- -securityAlicense-qualityEnables interaction between LLMs and Obsidian vaults through the Model Context Protocol, supporting secure file operations, content management, and advanced search capabilities.Last updated -209222Apache 2.0
- -securityAlicense-qualityA local MCP server that enables AI applications like Claude Desktop to securely access and work with Obsidian vaults, providing capabilities for reading notes, executing templates, and performing semantic searches.Last updated -362MIT License
- AsecurityAlicenseAqualityThis project implements a Model Context Protocol (MCP) server for connecting AI models with Obsidian knowledge bases. Through this server, AI models can directly access and manipulate Obsidian notes, including reading, creating, updating, and deleting notes, as well as managing folder structures.Last updated -1177209MIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that enables AI assistants to read, write, and manipulate notes in your Obsidian vault through a standardized interface.Last updated -52282ISC License