Obsidian MCP Server

Obsidian MCP Server

Enables interaction between LLMs and Obsidian vaults through the Model Context Protocol, supporting secure file operations, content management, and advanced search capabilities.

cyanheads

File Systems
Note Taking
Search
Local
TypeScript
Visit Server

Tools

obsidian_list_files_in_vault

Lists all files and directories in the root directory of your Obsidian vault. Returns a hierarchical structure of files and folders, including metadata like file type.

obsidian_list_files_in_dir

Lists all files and directories that exist in a specific Obsidian directory. Returns a hierarchical structure showing files, folders, and their relationships. Useful for exploring vault organization and finding specific files.

obsidian_get_file_contents

Return the content of a single file in your vault. Supports markdown files, text files, and other readable formats. Returns the raw content including any YAML frontmatter.

obsidian_find_in_file

Full-text search across all files in the vault. Returns matching files with surrounding context for each match. Useful for finding specific content, references, or patterns across notes.

obsidian_append_content

Append content to a new or existing file in the vault.

obsidian_patch_content

Update the entire content of an existing note or create a new one.

obsidian_complex_search

Advanced search functionality using JsonLogic queries. Enables complex file filtering based on paths, metadata, modification times, and content patterns. Supports logical operations, date comparisons, and pattern matching.

obsidian_get_properties

Get properties (title, tags, status, etc.) from an Obsidian note's YAML frontmatter. Returns all available properties including custom fields.

obsidian_update_properties

Update properties in an Obsidian note's YAML frontmatter. Intelligently merges arrays (tags, type, status), handles custom fields, and automatically manages timestamps (created by Obsidian, modified by MCP server). Existing properties not included in the update are preserved.

README

Obsidian MCP Server

TypeScript Model Context Protocol Version License Status GitHub

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
  • Error handling and graceful failure

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
  • Graceful shutdown handling

Installation

Note: Requires Node.js

  1. Enable Local REST API plugin in Obsidian
  2. Clone and build:
git clone git@github.com:cyanheads/obsidian-mcp-server.git
cd obsidian-mcp-server
npm install
npm run build

Or install from npm:

npm install obsidian-mcp-server

Configuration

Add to your MCP client settings (e.g., claude_desktop_config.json or cline_mcp_settings.json):

{
  "mcpServers": {
    "obsidian-mcp-server": {
      "command": "node",
      "args": ["/path/to/obsidian-mcp-server/build/index.js"],
      "env": {
        "OBSIDIAN_API_KEY": "your_api_key_here",
        "VERIFY_SSL": "false",
        "OBSIDIAN_PROTOCOL": "https",
        "OBSIDIAN_HOST": "127.0.0.1",
        "OBSIDIAN_PORT": "27124",
        "REQUEST_TIMEOUT": "5000",
        "MAX_CONTENT_LENGTH": "52428800",
        "MAX_BODY_LENGTH": "52428800",
        "RATE_LIMIT_WINDOW_MS": "900000",
        "RATE_LIMIT_MAX_REQUESTS": "200",
        "TOOL_TIMEOUT_MS": "60000"
      }
    }
  }
}

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) # This must be set to false for self-signed certificates. If you are running locally or don't understand what this means, this should be set to false.
  • 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])

Project Structure

The project follows a modular architecture with clear separation of concerns:

src/
  ├── index.ts          # Main entry point
  ├── mcp/              # MCP server implementation
  ├── obsidian/         # Obsidian API client and types
  ├── resources/        # MCP resource implementations
  ├── tools/            # MCP tool implementations
  │   ├── files/        # File operations tools
  │   ├── search/       # Search tools
  │   └── properties/   # Property management tools
  └── utils/            # Shared utilities

Tools

File Management

// List vault contents
obsidian_list_files_in_vault: {
}

// List directory contents
obsidian_list_files_in_dir: {
  dirpath: string; // Path relative to vault root
}

// Get file contents
obsidian_get_file_contents: {
  filepath: string; // Path relative to vault root
}

Search Operations

// Text search with context
obsidian_find_in_file: {
  query: string,
  contextLength?: number  // Default: 10
}

// Advanced search with JsonLogic
obsidian_complex_search: {
  query: JsonLogicQuery
  // Examples:
  // Find by tag:
  // {"in": ["#mytag", {"var": "frontmatter.tags"}]}
  //
  // Find markdown files in a directory:
  // {"glob": ["docs/*.md", {"var": "path"}]}
  //
  // Combine conditions:
  // {"and": [
  //   {"glob": ["*.md", {"var": "path"}]},
  //   {"in": ["#mytag", {"var": "frontmatter.tags"}]}
  // ]}
}

// Get all tags in vault or directory
obsidian_get_tags: {
  path?: string  // Optional: limit to specific directory
}

Content Modification

// Append to file
obsidian_append_content: {
  filepath: string,  // Path relative to vault root
  content: string    // Content to append
}

// Update file content
obsidian_patch_content: {
  filepath: string,  // Path relative to vault root
  content: string    // New content (replaces existing)
}

Property Management

// Get note properties
obsidian_get_properties: {
  filepath: string  // Path relative to vault root
}

// Update note properties
obsidian_update_properties: {
  filepath: string,  // Path relative to vault root
  properties: {
    title?: string,
    author?: string,
    // Note: created/modified timestamps are managed automatically
    type?: Array<"concept" | "architecture" | "specification" |
      "protocol" | "api" | "research" | "implementation" |
      "guide" | "reference">,
    tags?: string[],  // Must start with #
    status?: Array<"draft" | "in-progress" | "review" | "complete">,
    version?: string,
    platform?: string,
    repository?: string,  // URL
    dependencies?: string[],
    sources?: string[],
    urls?: string[],      // URLs
    papers?: string[],
    custom?: Record<string, unknown>
  }
}

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

Resources

The MCP server exposes the following resources:

obsidian://tags  # List of all tags used across the vault

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. 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:

# Update version in package.json
npm version patch  # or minor, or major
git push --follow-tags

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>

Recommended Servers

Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Excel MCP Server

Excel MCP Server

A Model Context Protocol server that enables AI assistants to read from and write to Microsoft Excel files, supporting formats like xlsx, xlsm, xltx, and xltm.

Featured
Local
Go
Playwright MCP Server

Playwright MCP Server

Provides a server utilizing Model Context Protocol to enable human-like browser automation with Playwright, allowing control over browser actions such as navigation, element interaction, and scrolling.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
Apple MCP Server

Apple MCP Server

Enables interaction with Apple apps like Messages, Notes, and Contacts through the MCP protocol to send messages, search, and open app content using natural language.

Featured
Local
TypeScript
contentful-mcp

contentful-mcp

Update, create, delete content, content-models and assets in your Contentful Space

Featured
TypeScript
serper-search-scrape-mcp-server

serper-search-scrape-mcp-server

This Serper MCP Server supports search and webpage scraping, and all the most recent parameters introduced by the Serper API, like location.

Featured
TypeScript