Obsidian MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add -e "OBSIDIAN_API_KEY=${OBSIDIAN_API_KEY}" -e "OBSIDIAN_VAULT_PATH=${OBSIDIAN_VAULT_PATH}" obsidian-mcp-8782 -- npx -y @duquesnay/obsidian-mcp-ts
Required:OBSIDIAN_API_KEYOBSIDIAN_VAULT_PATH
README.md

Interact with Obsidian via the Local REST API community plugin.

Obsidian MCP Server (TypeScript)

A TypeScript MCP server to interact with Obsidian via the Local REST API community plugin.

Note: This is a TypeScript port of the original mcp-obsidian Python project by MarkusPfundstein. All credit for the original concept and API design goes to the original author.

Features

  • 🚀 High Performance: LRU caching, request deduplication, and optimized batch processing
  • 🔧 Type Safety: Full TypeScript with strict typing and comprehensive error handling
  • 📋 Dynamic Tool Discovery: Automatically discovers and loads tools with metadata
  • 🎯 Smart Error Handling: Simplified error responses with actionable suggestions
  • 📦 Modular Architecture: Clean separation of concerns with reusable utilities
  • 📊 MCP Resources: Read-only access to vault data through the resources protocol
  • 📏 Resource Metadata: File size and last modified timestamps for better cache optimization
  • ⚠️ Protocol-Compliant Errors: Standard MCP error codes for consistent error handling

Performance Optimization: Internal Resource Caching

The Obsidian MCP server automatically optimizes performance through intelligent internal resource caching. This system provides significant speed improvements for frequently used operations while remaining completely transparent to users.

Real-time Cache Synchronization

The server includes a sophisticated subscription system that automatically invalidates cached data when files change. This ensures you always see current data without manual cache clearing:

  • Automatic Updates: File operations (create, update, delete) trigger immediate cache invalidation
  • Smart Invalidation: Only affected caches are cleared, preserving unrelated cached data
  • MCP Client Notifications: Connected clients receive real-time resource update notifications
  • Zero Configuration: The subscription system works automatically with no setup required

For technical details, see the Subscription System Documentation.

How It Works

Several major tools now use internal MCP resources with smart caching instead of making direct API calls every time:

Tool Internal Resource Cache Duration Performance Benefit
obsidian_get_all_tags vault://tags 5 minutes 10-50x faster for tag operations
obsidian_get_recent_changes vault://recent 30 seconds Near-instant recent file listings with titles & previews
obsidian_get_file_contents vault://note/{path} 2 minutes Dramatically faster for repeated file access
obsidian_simple_search vault://search/{query} 1 minute Cached search results for common queries
obsidian_list_files_in_vault vault://structure 5 minutes Instant vault browsing after first load
obsidian_list_files_in_dir vault://folder/{path} 2 minutes Fast folder navigation

User Benefits

  • Transparent Performance: All speed improvements happen automatically - no configuration required
  • Backward Compatible: Existing workflows continue to work exactly the same way
  • Smart Invalidation: Cache automatically updates when you modify files through the tools
  • Reduced API Load: Fewer direct calls to Obsidian's REST API improves overall responsiveness
  • Better User Experience: Operations like browsing tags, searching, and accessing recent files feel instant

Technical Details

The optimization works by:

  1. Resource-First Strategy: Tools check internal MCP resources before making API calls
  2. Tiered Caching: Different cache durations based on data volatility (30s for recent changes, 5min for vault structure)
  3. Graceful Fallback: If resources aren't available, tools automatically fall back to direct API calls
  4. Memory Efficient: Uses LRU caching with automatic cleanup to prevent memory leaks

This optimization is part of our commitment to making the Obsidian MCP server both powerful and performant for daily use.

MCP Resource Enhancements

Resource Metadata (v2.3.0)

All MCP resources now include optional metadata in the _meta field, providing file size and modification timestamps without requiring additional API calls. This enables better cache optimization and resource management by clients.

Metadata Structure
{
  "uri": "vault://note/meeting-notes.md",
  "name": "Meeting Notes",
  "mimeType": "text/plain",
  "text": "# Meeting Notes\n...",
  "_meta": {
    "size": 2048,                           // File size in bytes
    "sizeFormatted": "2.00 KB",             // Human-readable size
    "lastModified": "2025-10-07T14:30:00.000Z"  // ISO 8601 timestamp (UTC)
  }
}
Use Cases
  • Cache Validation: Use lastModified timestamps to determine if cached resources are stale
  • Resource Filtering: Filter resources by size before fetching

Tools (6)

obsidian_get_all_tagsRetrieves all tags present in the Obsidian vault.
obsidian_get_recent_changesLists recently modified files in the vault.
obsidian_get_file_contentsReads the content of a specific markdown note.
obsidian_simple_searchPerforms a search query across the vault.
obsidian_list_files_in_vaultLists the structure of the entire vault.
obsidian_list_files_in_dirLists files within a specific directory in the vault.

Environment Variables

OBSIDIAN_API_KEYrequiredAPI key for the Local REST API plugin
OBSIDIAN_VAULT_PATHrequiredLocal file system path to the Obsidian vault

Configuration

claude_desktop_config.json
{"mcpServers": {"obsidian": {"command": "npx", "args": ["-y", "@duquesnay/obsidian-mcp-ts"], "env": {"OBSIDIAN_API_KEY": "your_api_key", "OBSIDIAN_VAULT_PATH": "/path/to/vault"}}}}

Try it

List all the files in my 'Projects' folder in Obsidian.
Search my vault for notes related to 'AI regulations' and summarize the findings.
What are the most recently modified notes in my vault?
Read the content of my 'Meeting Notes' file and extract the action items.

Frequently Asked Questions

What are the key features of Obsidian MCP Server?

High-performance LRU caching for vault data. Real-time cache synchronization with file changes. Read-only access to vault structure and file contents. Resource metadata including file size and modification timestamps. Full TypeScript type safety and protocol-compliant error handling.

What can I use Obsidian MCP Server for?

Quickly searching and retrieving information from a large personal knowledge base. Automating the summarization of daily meeting notes stored in Obsidian. Monitoring recent changes to vault files to stay updated on project progress. Navigating and auditing vault structure without leaving the AI chat interface.

How do I install Obsidian MCP Server?

Install Obsidian MCP Server by running: npx -y @duquesnay/obsidian-mcp-ts

What MCP clients work with Obsidian MCP Server?

Obsidian MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Obsidian MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare