
Obsidian
HTTP-SSEEnhanced MCP server for interacting with Obsidian vault through Claude.ai remote integration
Enhanced MCP server for interacting with Obsidian vault through Claude.ai remote integration
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.
Simultaneous access to multiple Obsidian vaults through a single MCP server:
vault
parameterPerfect integration with Claude.ai's Remote MCP feature:
MCP_HTTP_STATELESS=true
)Access your Obsidian vault securely from anywhere:
Advanced querying capabilities beyond the original:
Enterprise-grade monitoring and auto-restart capabilities:
scripts/health-check.sh
)scripts/monitor-mcp.sh
)scripts/setup-autostart.sh
)This server equips your AI with specialized tools to interact with your Obsidian vault:
Tool Name | Description | Key Features |
---|---|---|
obsidian_read_file | Retrieves the content and metadata of a specified file. | - Read in markdown or json format.- Case-insensitive path fallback. - Includes file stats (creation/modification time). |
obsidian_update_file | Modifies notes using whole-file operations. | - append , prepend , or overwrite content.- Can create files if they don't exist. - Targets files by path, active note, or periodic note. |
obsidian_search_replace | Performs search-and-replace operations within a target note. | - Supports string or regex search. - Options for case sensitivity, whole word, and replacing all occurrences. |
obsidian_global_search | Performs a search across the entire vault. | - Text or regex search. - Filter by path and modification date. - Paginated results. |
obsidian_list_files | Lists files and subdirectories within a specified vault folder. | - Filter by file extension or name regex. - Provides a formatted tree view of the directory. |
obsidian_manage_frontmatter | Atomically manages a note's YAML frontmatter. | - get , set , or delete frontmatter keys.- Avoids rewriting the entire file for metadata changes. |
obsidian_manage_tags | Adds, removes, or lists tags for a note. | - Manages tags in both YAML frontmatter and inline content. |
obsidian_delete_file | Permanently deletes a specified file from the vault. | - Case-insensitive path fallback for safety. |
obsidian_dataview_query | Execute Dataview DQL queries against your vault. | - Run TABLE, LIST queries using Dataview syntax. - Query notes by tags, frontmatter, dates. - Generate reports and analytics. |
obsidian_task_query | Search and analyze tasks across your vault. | - Filter by status, date ranges, priorities. - Multiple output formats. - Extract task metadata (due dates, tags). |
| Overview | Features | Installation | | Configuration | Project Structure | Vault Cache Service | | Tools | Resources | Development | License |
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:
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.
Leverages the robust utilities provided by the mcp-ts-template
:
McpError
), and automatic logging.dotenv
) with comprehensive validation.zod
for schema validation and custom sanitization logic.ObsidianRestApiService
.💡 Quick Setup: For automatic startup on boot, see the Auto-Start Setup Guide after installation.
git clone https://github.com/BoweyLou/obsidian-mcp-server-enhanced.git cd obsidian-mcp-server-enhanced
npm install
This compiles the TypeScript code to JavaScript in thenpm run build
dist/
directory and makes the entry point executable.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 |
---|---|---|---|
MCP_AUTH_KEY | Authentication key for Claude.ai Remote MCP access. Generate with openssl rand -hex 32 | Yes (Remote) | undefined |
OBSIDIAN_VAULTS | JSON array of vault configurations for multi-vault mode. | Yes (Multi) | undefined |
OBSIDIAN_API_KEY | API Key from Obsidian plugin (single-vault mode only). | Yes (Single) | undefined |
OBSIDIAN_BASE_URL | Base URL of Obsidian API (single-vault mode only). | Yes (Single) | http://127.0.0.1:27123 |
MCP_TRANSPORT_TYPE | Server transport: stdio or http . | No | http |
MCP_HTTP_PORT | Port for the HTTP server. | No | 3010 |
MCP_HTTP_HOST | Host for the HTTP server. | No | 127.0.0.1 |
MCP_HTTP_STATELESS | Enable stateless mode for Claude.ai compatibility. | No | false |
MCP_ALLOWED_ORIGINS | Comma-separated origins for CORS. Set for production. | No | (none) |
MCP_LOG_LEVEL | Logging level (debug , info , error , etc.). | No | info |
OBSIDIAN_VERIFY_SSL | Set to false to disable SSL verification. | No | true |
OBSIDIAN_ENABLE_CACHE | Set to true to enable the in-memory vault cache. | No | true |
OBSIDIAN_CACHE_REFRESH_INTERVAL_MIN | Refresh interval for the vault cache in minutes. | No | 10 |
The server supports both single-vault (backwards compatible) and multi-vault modes:
# .env file MCP_AUTH_KEY=your-generated-mcp-auth-key OBSIDIAN_API_KEY=your-obsidian-plugin-api-key OBSIDIAN_BASE_URL=http://127.0.0.1:27123 MCP_TRANSPORT_TYPE=http MCP_HTTP_STATELESS=true
# .env file MCP_AUTH_KEY=your-generated-mcp-auth-key OBSIDIAN_VAULTS='[ { "id": "work", "name": "Work Vault", "apiKey": "work-vault-api-key", "baseUrl": "http://127.0.0.1:27123", "verifySsl": false }, { "id": "personal", "name": "Personal Vault", "apiKey": "personal-vault-api-key", "baseUrl": "http://127.0.0.1:27122", "verifySsl": false } ]' MCP_TRANSPORT_TYPE=http MCP_HTTP_STATELESS=true
openssl rand -hex 32
.env
with OBSIDIAN_VAULTS
JSON configurationnpm run start:http
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):
https://
endpoint (e.g., https://127.0.0.1:27124
)OBSIDIAN_VERIFY_SSL=false
for self-signed certificatesNon-encrypted (HTTP) - Recommended:
http://
endpoint (e.g., http://127.0.0.1:27123
)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:
"env": { "MCP_AUTH_KEY": "your-generated-mcp-auth-key", "OBSIDIAN_API_KEY": "your-obsidian-api-key", "OBSIDIAN_BASE_URL": "http://127.0.0.1:27123" }
Multi-vault configuration:
"env": { "MCP_AUTH_KEY": "your-generated-mcp-auth-key", "OBSIDIAN_VAULTS": "[{\"id\":\"work\",\"name\":\"Work\",\"apiKey\":\"work-key\",\"baseUrl\":\"http://127.0.0.1:27123\"},{\"id\":\"personal\",\"name\":\"Personal\",\"apiKey\":\"personal-key\",\"baseUrl\":\"http://127.0.0.1:27122\"}]" }
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:
{ "mcpServers": { "obsidian-mcp-server": { "command": "node", "args": ["/path/to/your/obsidian-mcp-server-enhanced/dist/index.js"], "env": { "MCP_AUTH_KEY": "your-generated-mcp-auth-key", "OBSIDIAN_API_KEY": "your-obsidian-api-key", "OBSIDIAN_BASE_URL": "http://127.0.0.1:27123", "OBSIDIAN_ENABLE_CACHE": "true" } } } }
Multi-vault configuration:
{ "mcpServers": { "obsidian-mcp-server": { "command": "node", "args": ["/path/to/your/obsidian-mcp-server-enhanced/dist/index.js"], "env": { "MCP_AUTH_KEY": "your-generated-mcp-auth-key", "OBSIDIAN_VAULTS": "[{\"id\":\"work\",\"name\":\"Work Vault\",\"apiKey\":\"work-api-key\",\"baseUrl\":\"http://127.0.0.1:27123\"},{\"id\":\"personal\",\"name\":\"Personal Vault\",\"apiKey\":\"personal-api-key\",\"baseUrl\":\"http://127.0.0.1:27122\"}]", "OBSIDIAN_ENABLE_CACHE": "true" } } } }
For remote access to your Obsidian vault from anywhere, you can use Tailscale to securely expose your MCP server over the internet.
Generate MCP Auth Key:
openssl rand -hex 32
Configure 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=true
Configure Vaults: Set up single or multi-vault configuration (see Multi-Vault Configuration)
Start the MCP Server:
npm run build && npm run start:http
Enable Tailscale Funnel:
tailscale funnel 3010
Get Your Public URL: Check your Tailscale device URL:
tailscale status --self | grep "Funnel on"
Add to your Claude.ai Remote MCP servers using your MCP authentication key:
Single-vault setup:
{ "url": "https://your-device.your-tailnet.ts.net/mcp?api_key=your-mcp-auth-key", "name": "Obsidian Vault" }
Multi-vault setup:
{ "url": "https://your-device.your-tailnet.ts.net/mcp?api_key=your-mcp-auth-key", "name": "Obsidian Multi-Vault" }
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.
Once set up, you can use tools remotely from Claude.ai:
Single-vault commands (uses default vault):
Use obsidian_task_query to show me tasks due today with format="table"
Multi-vault commands (specify vault):
Use obsidian_task_query with vault="work" to show me work tasks due today
Use obsidian_read_file with filePath="daily-note.md" and vault="personal"
Use obsidian_dataview_query with vault="work" to run: TABLE file.name FROM #meeting WHERE file.cday = date(today)
🚀 Pro Tip: For production use, set up automatic startup on boot so your server and Tailscale Funnel start automatically without manual intervention.
The codebase follows a modular structure within the src/
directory:
src/
├── index.ts # Entry point: Initializes and starts the server
├── config/ # Configuration loading (env vars, package info)
│ └── index.ts
├── mcp-server/ # Core MCP server logic and capability registration
│ ├── server.ts # Server setup, transport handling, tool/resource registration
│ ├── resources/ # MCP Resource implementations (currently none)
│ ├── tools/ # MCP Tool implementations (subdirs per tool)
│ └── transports/ # Stdio and HTTP transport logic, auth middleware
├── services/ # Abstractions for external APIs or internal caching
│ ├── obsidianRestAPI/ # Typed client for Obsidian Local REST API
│ └── vaultManager/ # Multi-vault configuration and service management
├── types-global/ # Shared TypeScript type definitions (errors, etc.)
└── utils/ # Common utility functions (logger, error handler, security, etc.)
For a detailed file tree, run npm run tree
or see docs/tree.md.
This server includes an intelligent in-memory cache designed to enhance performance and resilience when interacting with your vault.
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.VaultCacheService
builds an in-memory map of all .md
files in your vault, storing their content and modification times.obsidian_update_file
, the service proactively updates the cache for that specific file, ensuring immediate consistency.obsidian_global_search
tool first attempts a live API search. If this fails, it automatically falls back to searching the in-memory cache.The cache is enabled by default but can be configured via environment variables:
OBSIDIAN_ENABLE_CACHE
: Set to true
(default) or false
to enable or disable the cache service.OBSIDIAN_CACHE_REFRESH_INTERVAL_MIN
: Defines the interval in minutes for the periodic background refresh. Defaults to 10
.The Obsidian MCP Server provides a suite of tools for interacting with your vault(s), callable via the Model Context Protocol.
All tools support an optional vault
parameter to specify which vault to operate on:
vault
parameter, tools use the first configured vaultvault: "vault-id"
to target a specific vaultobsidian_read_file(filePath="note.md", vault="work")
Tool Name | Description | Key Arguments |
---|---|---|
obsidian_read_file | Retrieves the content and metadata of a file. | filePath , vault? , format? , includeStat? |
obsidian_update_file | Modifies a file by appending, prepending, or overwriting. | targetType , content , vault? , targetIdentifier? , wholeFileMode |
obsidian_search_replace | Performs search-and-replace operations in a note. | targetType , replacements , vault? , useRegex? , replaceAll? |
obsidian_global_search | Searches the entire vault for content. | query , vault? , searchInPath? , useRegex? , page? , pageSize? |
obsidian_list_files | Lists files and subdirectories in a folder. | dirPath , vault? , fileExtensionFilter? , nameRegexFilter? |
obsidian_manage_frontmatter | Gets, sets, or deletes keys in a note's frontmatter. | filePath , operation , key , vault? , value? |
obsidian_manage_tags | Adds, removes, or lists tags in a note. | filePath , operation , tags , vault? |
obsidian_delete_file | Permanently deletes a file from the vault. | filePath , vault? |
obsidian_dataview_query | Execute Dataview DQL queries against your vault. | query , vault? , format? |
obsidian_task_query | Search and analyze tasks across your vault. | vault? , status? , dateRange? , folder? , priority? , format? |
obsidian_periodic_notes | Create and manage daily, weekly, monthly, yearly notes. | operation , periodType , vault? , date? , content? , append? |
obsidian_block_reference | Work with block references and heading operations. | operation , filePath , vault? , heading? , content? , blockId? |
obsidian_graph_analysis | Analyze note connections and vault relationships. | operation , vault? , filePath? , minConnections? , maxDepth? |
obsidian_template_system | Create files from templates with variable substitution. | operation , vault? , templatePath? , targetPath? , variables? |
obsidian_smart_linking | Get intelligent link suggestions and recommendations. | operation , vault? , filePath? , content? , maxSuggestions? |
Note: All tools support comprehensive error handling, multi-vault routing, and return structured JSON responses.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
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: