Back to MCP Servers

Obsidian

SSE-enabled MCP server for remote Obsidian vault management with 29 tools for notes, directories, frontmatter, tags, search, and link operations. Docker-ready with health monitoring.

knowledge-memorydockermonitoring
By smith-and-web
173Updated 6 days agoTypeScriptMIT

Installation

npx -y obsidian-mcp-server

Configuration

{
  "mcpServers": {
    "obsidian-mcp-server": {
      "command": "npx",
      "args": ["-y", "obsidian-mcp-server"]
    }
  }
}

How to use

  1. Run the installation command above (if needed)
  2. Open your Claude Code settings file (~/.claude/settings.json)
  3. Add the configuration to the mcpServers section
  4. Restart Claude Code to apply changes

Obsidian MCP Server

CI npm Docker License Node.js MCP TypeScript Sponsor

A Model Context Protocol (MCP) server that enables AI assistants like Claude to interact with your Obsidian vault. Access your notes, create content, manage tags, and search your knowledge base through natural conversation.

Features

Note Management

  • CRUD Operations: Create, read, update, and delete notes (with safety confirmation)
  • Write Modes: Overwrite, append, or prepend content
  • Batch Reading: Read multiple notes in a single request
  • File Info: Get metadata without reading content (efficient for large vaults)
  • Move/Duplicate: Reorganize your vault structure
  • Section Operations: Read, append, or replace specific sections by heading

Frontmatter & Tags

  • Frontmatter Parsing: Get/set YAML frontmatter as structured JSON (powered by gray-matter)
  • Tag Management: Add/remove tags (frontmatter or inline)
  • Tag Auditing: Find notes missing required tags
  • Tag Search: List all tags with usage counts

Search & Links

  • Full-Text Search: Search content and filenames with context
  • Backlinks: Find all notes linking to a specific note
  • Broken Links: Detect wiki-links that don't resolve
  • Find & Replace: Bulk text replacement with regex support

Directory Operations

  • Create/Delete/Rename: Full directory management
  • List Contents: Browse vault structure

Performance

  • Token Optimization: Optional compact response mode (40-60% smaller responses)
  • Efficient Scanning: Get file info without reading content
  • SSE Transport: Remote access without local installation

Quick Start

npx (Quickest)

Run directly without installation:

VAULT_PATH=/path/to/your/vault npx @smith-and-web/obsidian-mcp-server

With options:

VAULT_PATH=/path/to/vault PORT=3001 COMPACT_RESPONSES=true npx @smith-and-web/obsidian-mcp-server

Docker (Recommended for Production)

Using the pre-built image from GitHub Container Registry:

docker run -d \
  --name obsidian-mcp \
  -v /path/to/your/vault:/vault:rw \
  -p 3001:3000 \
  -e VAULT_PATH=/vault \
  ghcr.io/smith-and-web/obsidian-mcp-server:latest

Or with Docker Compose:

  1. Create a docker-compose.yml:

    version: '3.8'
    services:
      obsidian-mcp:
        image: ghcr.io/smith-and-web/obsidian-mcp-server:latest
        container_name: obsidian-mcp
        restart: unless-stopped
        volumes:
          - /path/to/your/vault:/vault:rw
        ports:
          - "3001:3000"
        environment:
          - VAULT_PATH=/vault
  2. Start the server

    docker-compose up -d
  3. Verify it's running

    curl http://localhost:3001/health

Local Development

  1. Install dependencies

    npm install
  2. Set environment variables

    export VAULT_PATH=/path/to/your/vault
    export PORT=3000
  3. Start the server

    npm start
    # Or with auto-reload:
    npm run dev

AI Assistant Configuration

Claude Desktop

Add to your Claude Desktop config file:

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

Option 1: Local server (via mcp-remote)

{
  "mcpServers": {
    "obsidian": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "http://localhost:3001/sse"]
    }
  }
}

Option 2: Remote server with HTTPS

{
  "mcpServers": {
    "obsidian": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://your-domain.com/sse"]
    }
  }
}

Option 3: Direct npx (runs server locally)

{
  "mcpServers": {
    "obsidian": {
      "command": "npx",
      "args": ["@smith-and-web/obsidian-mcp-server"],
      "env": {
        "VAULT_PATH": "/path/to/your/vault",
        "PORT": "3001"
      }
    }
  }
}

Cursor

Add to your Cursor MCP settings (Settings → MCP):

Option 1: Connect to running server

{
  "mcpServers": {
    "obsidian": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "http://localhost:3001/sse"]
    }
  }
}

Option 2: Run server directly

{
  "mcpServers": {
    "obsidian": {
      "command": "npx",
      "args": ["@smith-and-web/obsidian-mcp-server"],
      "env": {
        "VAULT_PATH": "/path/to/your/vault",
        "PORT": "3001"
      }
    }
  }
}

Other MCP Clients

Any MCP-compatible client can connect using mcp-remote:

npx mcp-remote http://localhost:3001/sse

Or connect directly to the SSE endpoint at http://localhost:3001/sse.

Available Tools

Note Operations

ToolDescription
read-noteRead note contents (supports frontmatterOnly for efficiency)
read-multiple-notesBatch read multiple notes
create-noteCreate a new note
edit-noteReplace note contents
write-noteWrite with modes: overwrite, append, or prepend
delete-noteDelete a note (requires confirmation)
move-noteMove/rename a note
duplicate-noteCopy a note to a new location
get-notes-infoGet file metadata without reading content

Directory Operations

ToolDescription
list-vaultList files and directories
create-directoryCreate a new directory
delete-directoryDelete a directory (with recursive option)
rename-directoryRename/move a directory

Frontmatter & Tags

ToolDescription
get-frontmatterGet YAML frontmatter as JSON
update-frontmatterUpdate frontmatter fields
add-tagsAdd tags to frontmatter or inline
remove-tagsRemove tags from note
list-tagsList all tags with counts
find-notes-by-tagFind notes with a specific tag
search-missing-tagFind notes missing a tag
audit-tagsAudit folder for required tags

Search & Links

ToolDescription
search-vaultFull-text search with context
get-backlinksFind notes linking to a note
find-broken-linksFind unresolved wiki-links
find-replaceBulk find and replace

Section Operations

ToolDescription
read-sectionRead content under a heading
append-to-sectionAppend to a section
replace-sectionReplace section content
append-to-fileAppend to end of file
insert-at-markerInsert at a text marker
list-headingsList all headings in a note

Architecture

┌─────────────────┐     HTTPS/SSE      ┌──────────────────┐
│  Claude Desktop │ ◄────────────────► │   MCP Server     │
└─────────────────┘                    │   (Express.js)   │
                                       └────────┬─────────┘
                                                │
                                       ┌────────▼─────────┐
                                       │   VaultManager   │
                                       │   (File System)  │
                                       └────────┬─────────┘
                                                │
                                       ┌────────▼─────────┐
                                       │  Obsidian Vault  │
                                       │   (Markdown)     │
                                       └──────────────────┘

Project Structure

obsidian-mcp-server/
├── src/
│   ├── index.ts              # Express server entry point
│   ├── vault/
│   │   ├── VaultManager.ts   # Core vault operations
│   │   └── frontmatter.ts    # YAML parsing utilities
│   ├── tools/
│   │   ├── definitions.ts    # MCP tool schemas
│   │   ├── handlers.ts       # Tool execution logic
│   │   └── index.ts          # Tool exports
│   ├── server/
│   │   ├── mcp.ts            # MCP protocol handlers
│   │   └── middleware.ts     # Express middleware
│   └── types/
│       └── index.ts          # TypeScript type definitions
├── tests/                    # Vitest unit tests
├── Dockerfile
├── docker-compose.yml
├── package.json
└── README.md

Environment Variables

VariableDefaultDescription
PORT3000Server port
VAULT_PATH/vaultPath to Obsidian vault
COMPACT_RESPONSESfalseEnable minified response keys for 40-60% smaller responses
API_KEY(none)API key for authentication. When set, requires Bearer token or query param

API Endpoints

EndpointMethodDescription
/healthGETHealth check
/sseGETSSE endpoint for MCP
/ssePOSTDirect MCP protocol calls
/messagePOSTSSE transport messages

Authentication

The server supports optional API key authentication. When API_KEY is set, all /sse and /message endpoints require authentication. The /health endpoint remains public.

Enabling Authentication

Set the API_KEY environment variable:

# Docker
docker run -d \
  --name obsidian-mcp \
  -v /path/to/vault:/vault:rw \
  -p 3001:3000 \
  -e VAULT_PATH=/vault \
  -e API_KEY=your-secret-key \
  ghcr.io/smith-and-web/obsidian-mcp-server:latest

# npx
API_KEY=your-secret-key VAULT_PATH=/path/to/vault npx @smith-and-web/obsidian-mcp-server

Authentication Methods

Clients can authenticate using either method:

  1. Authorization Header (recommended):

    Authorization: Bearer your-secret-key
  2. Query Parameter:

    /sse?api_key=your-secret-key

Client Configuration with API Key

Claude Desktop / Cursor (via mcp-remote):

{
  "mcpServers": {
    "obsidian": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote",
        "https://your-domain.com/sse?api_key=your-secret-key"
      ]
    }
  }
}

Direct npx with API key:

{
  "mcpServers": {
    "obsidian": {
      "command": "npx",
      "args": ["@smith-and-web/obsidian-mcp-server"],
      "env": {
        "VAULT_PATH": "/path/to/your/vault",
        "API_KEY": "your-secret-key"
      }
    }
  }
}

Security Considerations

  • Generate strong keys: Use a random string of at least 32 characters
  • HTTPS required: Always use HTTPS when exposing the server remotely to prevent key interception
  • File Access: The server has full read/write access to the mounted vault
  • CORS: Currently allows all origins. Restrict in production if needed
  • Network security: Consider additional layers like VPN or firewall rules for sensitive vaults

Deployment with NGINX Proxy Manager

For remote access with SSL:

  1. Add a Proxy Host:

    • Domain: obsidian.yourdomain.com
    • Forward Hostname: obsidian-mcp (container name)
    • Forward Port: 3000
    • Enable Websockets
  2. SSL Tab: Request Let's Encrypt certificate

  3. Advanced Tab (for SSE):

    proxy_buffering off;
    proxy

View source on GitHub