Obsidian Vault MCP server

Enables interaction with Obsidian vaults for file operations, content search, and metadata management, facilitating note-taking and knowledge base organization.
Back to servers
Setup instructions
Provider
cyanheads
Release date
Jan 24, 2025
Language
TypeScript
Package
Stats
3.6K downloads
127 stars

The Obsidian MCP Server provides a bridge between AI assistants or development tools and your Obsidian vault through the Model Context Protocol (MCP). It enables programmatic access to read, write, search, and manage your Obsidian notes via a standardized interface, leveraging the Obsidian Local REST API plugin.

Prerequisites

  • Obsidian installed on your system
  • Obsidian Local REST API plugin installed and enabled in your vault
  • API key configured in the Local REST API plugin settings
  • Node.js (v18 or later recommended) and npm installed

Installation and Configuration

Setting Up Your MCP Client

Add the following configuration to your MCP client's settings file (e.g., cline_mcp_settings.json):

{
  "mcpServers": {
    "obsidian-mcp-server": {
      "command": "npx",
      "args": ["obsidian-mcp-server"],
      "env": {
        "OBSIDIAN_API_KEY": "YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN",
        "OBSIDIAN_BASE_URL": "http://127.0.0.1:27123",
        "OBSIDIAN_VERIFY_SSL": "false",
        "OBSIDIAN_ENABLE_CACHE": "true"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Connecting to the Obsidian API

There are two ways to connect:

Option 1: Non-encrypted HTTP (Recommended for Simplicity)

  1. Enable the "Non-encrypted (HTTP) Server" in the Obsidian Local REST API plugin settings
  2. Use the following environment configuration:
"env": {
  "OBSIDIAN_API_KEY": "YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN",
  "OBSIDIAN_BASE_URL": "http://127.0.0.1:27123"
}

Option 2: Encrypted HTTPS

  1. Use the default HTTPS endpoint provided by the plugin
  2. Set OBSIDIAN_VERIFY_SSL to "false" to trust the self-signed certificate:
"env": {
  "OBSIDIAN_API_KEY": "YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN",
  "OBSIDIAN_BASE_URL": "https://127.0.0.1:27124",
  "OBSIDIAN_VERIFY_SSL": "false"
}

Configuration Options

Variable Description Required Default
OBSIDIAN_API_KEY API Key from the Obsidian Local REST API plugin Yes undefined
OBSIDIAN_BASE_URL Base URL of your Obsidian Local REST API Yes http://127.0.0.1:27123
OBSIDIAN_VERIFY_SSL Set to false to disable SSL verification No true
OBSIDIAN_ENABLE_CACHE Enable the in-memory vault cache No true
OBSIDIAN_CACHE_REFRESH_INTERVAL_MIN Cache refresh interval in minutes No 10
MCP_TRANSPORT_TYPE Server transport: stdio or http No stdio

Available Tools

The server provides several tools to interact with your Obsidian vault:

Reading Notes

{
  "tool": "obsidian_read_note",
  "args": {
    "filePath": "Path/To/Your/Note.md",
    "format": "markdown",
    "includeStat": true
  }
}

Updating Notes

{
  "tool": "obsidian_update_note",
  "args": {
    "targetType": "filePath",
    "targetIdentifier": "Path/To/Your/Note.md",
    "wholeFileMode": "append",
    "content": "Content to append to the note"
  }
}

Search and Replace

{
  "tool": "obsidian_search_replace",
  "args": {
    "targetType": "filePath",
    "targetIdentifier": "Path/To/Your/Note.md",
    "replacements": [
      {
        "search": "old text",
        "replace": "new text"
      }
    ],
    "useRegex": false,
    "replaceAll": true
  }
}

Global Search

{
  "tool": "obsidian_global_search",
  "args": {
    "query": "search term",
    "searchInPath": "optional/folder/path",
    "useRegex": false,
    "page": 1,
    "pageSize": 10
  }
}

Listing Notes

{
  "tool": "obsidian_list_notes",
  "args": {
    "dirPath": "Folder/Path",
    "fileExtensionFilter": ".md",
    "nameRegexFilter": ".*meeting.*"
  }
}

Managing Frontmatter

{
  "tool": "obsidian_manage_frontmatter",
  "args": {
    "filePath": "Path/To/Your/Note.md",
    "operation": "set",
    "key": "tags",
    "value": ["tag1", "tag2"]
  }
}

Managing Tags

{
  "tool": "obsidian_manage_tags",
  "args": {
    "filePath": "Path/To/Your/Note.md",
    "operation": "add",
    "tags": ["newtag1", "newtag2"]
  }
}

Deleting Notes

{
  "tool": "obsidian_delete_note",
  "args": {
    "filePath": "Path/To/Your/Note.md"
  }
}

Vault Cache Service

The server includes an intelligent in-memory cache to enhance performance and resilience:

  • Improves search speed, especially in large vaults
  • Provides fallback capabilities if the Obsidian API is temporarily unresponsive
  • Refreshes periodically to stay updated with your vault's content
  • Updates proactively when files are modified through the server's tools

The cache is enabled by default but can be configured via environment variables:

  • OBSIDIAN_ENABLE_CACHE: Set to true (default) or false to enable/disable
  • OBSIDIAN_CACHE_REFRESH_INTERVAL_MIN: Sets refresh interval in minutes (default: 10)

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "obsidian-mcp-server" '{"command":"npx","args":["obsidian-mcp-server"],"env":{"OBSIDIAN_API_KEY":"YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN","OBSIDIAN_BASE_URL":"http://127.0.0.1:27123","OBSIDIAN_VERIFY_SSL":"false","OBSIDIAN_ENABLE_CACHE":"true"},"disabled":false,"autoApprove":[]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "obsidian-mcp-server": {
            "command": "npx",
            "args": [
                "obsidian-mcp-server"
            ],
            "env": {
                "OBSIDIAN_API_KEY": "YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN",
                "OBSIDIAN_BASE_URL": "http://127.0.0.1:27123",
                "OBSIDIAN_VERIFY_SSL": "false",
                "OBSIDIAN_ENABLE_CACHE": "true"
            },
            "disabled": false,
            "autoApprove": []
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "obsidian-mcp-server": {
            "command": "npx",
            "args": [
                "obsidian-mcp-server"
            ],
            "env": {
                "OBSIDIAN_API_KEY": "YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN",
                "OBSIDIAN_BASE_URL": "http://127.0.0.1:27123",
                "OBSIDIAN_VERIFY_SSL": "false",
                "OBSIDIAN_ENABLE_CACHE": "true"
            },
            "disabled": false,
            "autoApprove": []
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later