Obsidian MCP Server

Obsidian MCP Server

A server that enables AI agents to perform sophisticated knowledge discovery and analysis across Obsidian vaults through the Local REST API plugin, supporting complex multi-step workflows with advanced filtering and full content retrieval.

Category
访问服务器

Tools

search_vault

Search Obsidian vault for notes matching criteria. Args: query: Text or regex pattern to search for query_type: "text" or "regex" search_in_path: Limit search to specific folder title_contains: Filter by title (string or array) title_match_mode: "any" or "all" for multiple title terms tag: Filter by tag (string, array, or JSON string like title_contains) tag_match_mode: "any" or "all" for multiple tag terms context_length: Characters of context around matches include_content: Return full note content modified_since/until: Filter by modification date (YYYY-MM-DD) created_since/until: Filter by creation date (YYYY-MM-DD) page_size/page: Pagination controls max_matches_per_file: Limit matches per file

get_note_content

Get the full content and metadata of a specific note by path. Args: path: Full path to the note within the vault

browse_vault_structure

Browse vault directory structure. Args: path: Path to browse from (defaults to vault root) include_files: Include files in listing (default: False, folders only) recursive: List nested contents recursively

README

Obsidian MCP Server

An MCP (Model Context Protocol) server that enables AI agents to perform sophisticated knowledge discovery and analysis across your Obsidian vault through the Local REST API plugin.

Why This Matters

This server transforms your Obsidian vault into a powerful knowledge base for AI agents, enabling complex multi-step workflows like:

  • "Retrieve notes from my 'Projects/Planning' folder containing 'roadmap' or 'timeline' in titles, created after April 1st, then analyze them for any blockers or dependencies and present a consolidated risk assessment with references to the source notes"

  • "Find all notes tagged with 'research' or 'analysis' from the last month, scan their content for incomplete sections or open questions, then cross-reference with my 'Team/Expertise' notes to suggest which colleagues could help address each gap"

  • "Get the complete content of meeting notes from 'Leadership/Quarterly' containing 'budget' or 'headcount', analyze them for action items assigned to my department, and create a chronological timeline with source note references"

The server's advanced filtering, regex support, and full content retrieval capabilities allow agents to perform nuanced knowledge work that would take hours manually.

Prerequisites

  1. Install the Obsidian Local REST API plugin in your Obsidian vault
  2. Configure and enable the plugin in Obsidian settings
  3. Note the API URL (default: https://localhost:27124) and API key if you've set one

Installation

From PyPI (Recommended)

# Install from PyPI
pip install obsidian-api-mcp-server

# Or with uv
uv pip install obsidian-api-mcp-server

Add to MCP Configuration

Add to your MCP client configuration (e.g., Claude Desktop):

{
  "mcpServers": {
    "obsidian-api-mcp-server": {
      "command": "uvx",
      "args": [
        "--from",
        "obsidian-api-mcp-server>=1.0.1",
        "obsidian-api-mcp"
      ],
      "env": {
        "OBSIDIAN_API_URL": "https://localhost:27124",
        "OBSIDIAN_API_KEY": "your-api-key-here"
      }
    }
  }
}

From Source (Development)

# Clone the repository
git clone https://github.com/pmmvr/obsidian-api-mcp-server
cd obsidian-api-mcp-server

# Install with uv
uv pip install -e .

# Or with pip
pip install -e .

Configuration

Set environment variables for the Obsidian API:

# Required: Obsidian API URL (HTTPS by default)
export OBSIDIAN_API_URL="https://localhost:27124"  # Default

# Optional: API key if you've configured authentication
export OBSIDIAN_API_KEY="your-api-key-here"

Important Security Note: Avoid hardcoding your OBSIDIAN_API_KEY directly into scripts or committing it to version control. Consider using a .env file (which is included in the .gitignore of this project) and a library like python-dotenv to manage your API key, or use environment variables managed by your operating system or shell.

Note: The server defaults to HTTPS and disables SSL certificate verification for self-signed certificates commonly used with local Obsidian instances. For HTTP connections, set OBSIDIAN_API_URL="http://localhost:27123".

Usage

Run the MCP server:

obsidian-mcp

Available Tools

The server provides three powerful tools:

  1. search_vault - Advanced search with flexible filters and full content retrieval:

    • query - Text or regex search across note content (optional)
    • query_type - Search type: "text" (default) or "regex"
    • search_in_path - Limit search to specific folder path
    • title_contains - Filter by text in note titles (string, array, or JSON string)
    • title_match_mode - How to match multiple terms: "any" (OR) or "all" (AND)
    • tag - Filter by tag (string, array, or JSON string - searches frontmatter and inline #tags)
    • tag_match_mode - How to match multiple tags: "any" (OR) or "all" (AND)
    • context_length - Amount of content to return (set high for full content)
    • include_content - Boolean to retrieve complete content of all matching notes
    • created_since/until - Filter by creation date
    • modified_since/until - Filter by modification date
    • page_size - Results per page
    • max_matches_per_file - Limit matches per note

    Key Features:

    • When no query is provided, automatically returns full content for filter-only searches
    • include_content=True forces full content retrieval for any search
    • Supports regex patterns for complex text matching (OR conditions, case-insensitive search, etc.)
  2. get_note_content - Retrieve complete content and metadata of a specific note by path

  3. browse_vault_structure - Navigate vault directory structure efficiently:

    • path - Directory to browse (defaults to vault root)
    • include_files - Boolean to include files (default: False, folders only for speed)
    • recursive - Boolean to browse all nested directories

Example Use Cases

Basic Searches

  1. Find notes by title in a specific folder:

    search_vault(
      search_in_path="Work/Projects/",
      title_contains="meeting"
    )
    
  2. Find notes with multiple title terms (OR logic):

    search_vault(
      title_contains=["foo", "bar", "fizz", "buzz"],
      title_match_mode="any"  # Default
    )
    
  3. Find notes with ALL title terms (AND logic):

    search_vault(
      title_contains=["project", "2024"],
      title_match_mode="all"
    )
    
  4. Get all recent notes with full content:

    search_vault(
      modified_since="2025-05-20",
      include_content=True
    )
    
  5. Text search with context:

    search_vault(
      query="API documentation",
      search_in_path="Engineering/",
      context_length=500
    )
    
  6. Search by tag:

    search_vault(
      tag="project"
    )
    
  7. Regex search for OR conditions:

    search_vault(
      query="foo|bar",
      query_type="regex",
      search_in_path="Projects/"
    )
    
  8. Regex search for tasks assigned to specific people:

    search_vault(
      query="(TODO|FIXME|ACTION).*@(alice|bob)",
      query_type="regex",
      search_in_path="Work/Meetings/"
    )
    

Advanced Multi-Step Workflows

These examples demonstrate how agents can chain together sophisticated knowledge discovery tasks:

  1. Strategic Project Analysis:

    # Step 1: Get all project documentation
    search_vault(
      search_in_path="Projects/Infrastructure/",
      title_contains=["planning", "requirements", "architecture"],
      title_match_mode="any",
      include_content=True
    )
    
    # Step 2: Find related technical discussions
    search_vault(
      tag=["infrastructure", "technical-debt"],
      tag_match_mode="any",
      modified_since="2025-04-01",
      include_content=True
    )
    

    Agent can then analyze dependencies, identify risks, and recommend resource allocation

  2. Meeting Action Item Mining:

# Get all recent meeting notes with full content
search_vault(
  search_in_path="Meetings/",
  title_contains=["standup", "planning", "retrospective"],
  title_match_mode="any",
  created_since="2025-05-01",
  include_content=True
)

Agent scans content for action items, extracts assignments, and creates chronological tracking

  1. Research Gap Analysis:
# Find research notes with questions or gaps
search_vault(
  query="(TODO|QUESTION|INVESTIGATE|UNCLEAR)",
  query_type="regex",
  tag=["research", "analysis"],
  tag_match_mode="any",
  include_content=True
)

# Cross-reference with team expertise
search_vault(
  search_in_path="Team/",
  tag=["expertise", "skills"],
  tag_match_mode="any",
  include_content=True
)

Agent identifies knowledge gaps and suggests team members who could help

  1. Vault Structure Exploration:
# Quick organizational overview
browse_vault_structure(recursive=True)

# Deep dive into specific areas
browse_vault_structure(
  path="Projects/CurrentSprint/",
  include_files=True,
  recursive=True
)
  1. Tag-Based Knowledge Mapping:
# Find notes with multiple tags (AND logic)
search_vault(
  tag=["project", "urgent"],
  tag_match_mode="all",
  include_content=True
)

# Find notes with any relevant tags (OR logic)
search_vault(
  tag=["architecture", "design", "implementation"],
  tag_match_mode="any",
  modified_since="2025-04-15"
)

Development

# Install with test dependencies
uv pip install -e ".[test]"

# Run the server
python -m obsidian_mcp.server

# Run tests
uv run behave features/blackbox_tests.feature
# Or use the test runner
python run_tests.py

License

This project is licensed under the MIT License - see the LICENSE file for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选