Skip to main content
Glama
Obsidian Local REST API MCP Server

Obsidian Local REST API MCP Server

by j-shelfwood

Obsidian Local REST API MCP Server

An AI-Native MCP (Model Context Protocol) server that provides intelligent, task-oriented tools for interacting with Obsidian vaults through a local REST API.

🧠 AI-Native Design Philosophy

This MCP server has been redesigned following AI-Native principles rather than simple API-to-tool mapping. Instead of exposing low-level CRUD operations, it provides high-level, task-oriented tools that LLMs can reason about more effectively.

Before vs After: The Transformation

Old Approach (CRUD-Based)

New Approach (AI-Native)

Why Better

list_files (returns everything)

list_directory(path, limit, offset)

Prevents context overflow with pagination

create_file + update_file

write_file(path, content, mode)

Single tool handles create/update/append

create_note + update_note

create_or_update_note(path, content, frontmatter)

Intelligent upsert removes decision complexity

search_notes(query)

search_vault(query, scope, path_filter)

Precise, scopeable search with advanced filtering

(no equivalent)

get_daily_note(date)

High-level abstraction for common workflow

(no equivalent)

get_recent_notes(limit)

Task-oriented recent file access

(no equivalent)

find_related_notes(path, on)

Conceptual relationship discovery

Related MCP server: Obsidian MCP Server

🛠 Available Tools

Directory & File Operations

list_directory

Purpose: List directory contents with pagination to prevent context overflow

{
  "path": "Projects/",
  "recursive": false,
  "limit": 20,
  "offset": 0
}

AI Benefit: LLM can explore vault structure incrementally without overwhelming context

read_file

Purpose: Read content of any file in the vault

{"path": "notes/meeting-notes.md"}

write_file

Purpose: Write file with multiple modes - replaces separate create/update operations

{
  "path": "notes/summary.md",
  "content": "# Meeting Summary\n...",
  "mode": "append"  // "overwrite", "append", "prepend"
}

AI Benefit: Single tool handles all write scenarios, removes ambiguity

delete_item

Purpose: Delete any file or directory

{"path": "old-notes/"}

AI-Native Note Operations

create_or_update_note

Purpose: Intelligent upsert - creates if missing, updates if exists

{
  "path": "daily/2024-12-26",
  "content": "## Tasks\n- Review AI-native MCP design",
  "frontmatter": {"tags": ["daily", "tasks"]}
}

AI Benefit: Eliminates "does this note exist?" decision tree

get_daily_note

Purpose: Smart daily note retrieval with common naming patterns

{"date": "today"}  // or "yesterday", "2024-12-26"

AI Benefit: Abstracts file system details and naming conventions

get_recent_notes

Purpose: Get recently modified notes

{"limit": 5}

AI Benefit: Matches natural "what did I work on recently?" queries

Advanced Search & Discovery

search_vault

Purpose: Multi-scope search with advanced filtering

{
  "query": "machine learning",
  "scope": ["content", "filename", "tags"],
  "path_filter": "research/"
}

AI Benefit: Precise, targeted search reduces noise

Purpose: Discover conceptual relationships between notes

{
  "path": "ai-research.md",
  "on": ["tags", "links"]
}

AI Benefit: Enables relationship-based workflows and serendipitous discovery

Legacy Tools (Backward Compatibility)

The server maintains backward compatibility with existing tools like get_note, list_notes, get_metadata_keys, etc.

Prerequisites

Installation

npx obsidian-local-rest-api-mcp

From Source

# Clone the repository
git clone https://github.com/j-shelfwood/obsidian-local-rest-api-mcp.git
cd obsidian-local-rest-api-mcp

# Install dependencies with bun
bun install

# Build the project
bun run build

Configuration

Set environment variables for API connection:

export OBSIDIAN_API_URL="http://obsidian-local-rest-api.test"  # Default URL (or http://localhost:8000 for non-Valet setups)
export OBSIDIAN_API_KEY="your-api-key"          # Optional bearer token

Usage

Running the Server

# Development mode with auto-reload
bun run dev

# Production mode
bun run start

# Or run directly
node build/index.js

MCP Client Configuration

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "obsidian-vault": {
      "command": "npx",
      "args": ["obsidian-local-rest-api-mcp"],
      "env": {
        "OBSIDIAN_API_URL": "http://obsidian-local-rest-api.test",
        "OBSIDIAN_API_KEY": "your-api-key-if-needed"
      }
    }
  }
}

VS Code with MCP Extension

Use the included .vscode/mcp.json configuration file.

Development

# Watch mode for development
bun run dev

# Build TypeScript
bun run build

# Type checking
bun run tsc --noEmit

Architecture

  • ObsidianApiClient - HTTP client wrapper for REST API endpoints

  • ObsidianMcpServer - MCP server implementation with tool handlers

  • Configuration - Environment-based configuration with validation

Error Handling

The server includes comprehensive error handling:

  • API connection failures

  • Invalid tool parameters

  • Network timeouts

  • Authentication errors

Errors are returned as MCP tool call responses with descriptive messages.

Debugging

Enable debug logging by setting environment variables:

export DEBUG=1
export NODE_ENV=development

Server logs are written to stderr to avoid interfering with MCP protocol communication on stdout.

Troubleshooting

MCP Server Fails to Start

If your MCP client shows "Start Failed" or similar errors:

  1. Test the server directly:

    npx obsidian-local-rest-api-mcp --version

    Should output the version number.

  2. Test MCP protocol:

    # Run our test script
    node -e "
    const { spawn } = require('child_process');
    const child = spawn('npx', ['obsidian-local-rest-api-mcp'], { stdio: ['pipe', 'pipe', 'pipe'] });
    child.stdout.on('data', d => console.log('OUT:', d.toString()));
    child.stderr.on('data', d => console.log('ERR:', d.toString()));
    setTimeout(() => {
      child.stdin.write(JSON.stringify({jsonrpc:'2.0',id:1,method:'initialize',params:{protocolVersion:'2024-11-05',capabilities:{},clientInfo:{name:'test',version:'1.0.0'}}})+'\n');
      setTimeout(() => child.kill(), 2000);
    }, 500);
    "

    Should show initialization response.

  3. Check Environment Variables:

    • Ensure OBSIDIAN_API_URL points to a running Obsidian Local REST API

    • Test the API directly: curl http://obsidian-local-rest-api.test/api/files (or your configured API URL)

  4. Verify Obsidian Local REST API:

    • Install and run Obsidian Local REST API

    • Confirm it's accessible on the configured port

    • Check if authentication is required

Common Issues

"Command not found": Make sure Node.js/npm is installed and npx is available

"Connection refused": Obsidian Local REST API is not running or wrong URL

Laravel Valet .test domains: If using Laravel Valet, ensure your project directory name matches the .test domain (e.g., obsidian-local-rest-api.test for a project in /obsidian-local-rest-api/)

"Unauthorized": Check if API key is required and properly configured

"Timeout": Increase timeout in client configuration or check network connectivity

Cherry Studio Configuration

For Cherry Studio, use these exact settings:

  • Name: obsidian-vault (or any name you prefer)

  • Type: Standard Input/Output (stdio)

  • Command: npx

  • Arguments: obsidian-local-rest-api-mcp

  • Environment Variables:

    • OBSIDIAN_API_URL: Your API URL (e.g., http://obsidian-local-rest-api.test for Laravel Valet)

    • OBSIDIAN_API_KEY: Optional API key if authentication is required

  • Environment Variables:

    • OBSIDIAN_API_URL: http://obsidian-local-rest-api.test (or your API URL)

    • OBSIDIAN_API_KEY: your-api-key (if required)

Contributing

  1. Fork the repository

  2. Create a feature branch

  3. Make changes with proper TypeScript types

  4. Test with your Obsidian vault

  5. Submit a pull request

License

MIT

Available Tools

13 tools
create_or_update_noteA

Create or update a note with content and frontmatter. Performs upsert operation - creates if doesn't exist, updates if it does.

Inputs: path (required), content (required), frontmatter.

delete_itemC

Delete a file or directory from the vault

Inputs: path (required).

get_daily_noteA

Get daily note for a specific date. Handles common daily note naming conventions and file locations.

Inputs: date.

get_metadata_keysB

Get all available frontmatter keys from notes

Inputs: no named parameters.

get_metadata_valuesC

Get all unique values for a specific frontmatter key

Inputs: key (required).

get_noteC

Get a specific note with its content and metadata (legacy)

Inputs: path (required).

get_recent_notesC

Get recently modified notes, ordered by modification time

Inputs: limit.

list_directoryA

List directory contents with pagination to prevent context overflow. Shows immediate contents by default.

Inputs: path, recursive, limit, offset.

list_notesB

List all notes in the vault with optional search filter (legacy with search support)

Inputs: search.

read_fileB

Read content of a specific file from the vault

Inputs: path (required).

search_vaultC

Search vault content across files, filenames, and metadata with advanced filtering

Inputs: query (required), scope, path_filter.

write_fileC

Write file content with different modes: overwrite (default), append, or prepend. Handles both create and update operations.

Inputs: path (required), content (required), mode.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 13 tools

    Disambiguation4/5

    Most tools have distinct purposes, but there is some overlap between get_note/read_file and create_or_update_note/write_file that could cause confusion. The descriptions help clarify differences (e.g., get_note is legacy, write_file handles append/prepend modes), but an agent might still misselect between these pairs in certain scenarios.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with snake_case throughout (e.g., create_or_update_note, list_directory, search_vault). There are no deviations in naming conventions, making the set predictable and easy to parse.

    Tool Count5/5

    With 13 tools, this server is well-scoped for managing an Obsidian vault, covering operations like CRUD for notes/files, metadata handling, search, and directory listing. Each tool earns its place without feeling excessive or insufficient for the domain.

    Completeness4/5

    The tool set provides comprehensive coverage for vault management, including create, read, update, delete, search, and metadata operations. A minor gap exists in note linking or backlink management beyond find_related_notes, but core workflows are well-supported with no dead ends.

    Maintenance

    ActivitySlowing
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A lightweight server that enables AI assistants like Cursor & Claude to read from and write to Obsidian vaults, allowing actions like creating notes, checking existing content, and managing todos through natural language.
      4,522 npm
      33
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      A server that provides HTTP API access to manage Obsidian Vaults and Markdown files, allowing users to access notes, statistics, links, templates, and search capabilities.
      MIT

    Appeared in Searches