MCP Tools for Obsidian

repository·main·Indexed 21 days ago

https://github.com/jacksteamdev/obsidian-mcp-tools

A secure bridge using the Model Context Protocol (MCP) to connect AI applications like Claude Desktop to Obsidian vaults. It enables AI assistants to read notes, perform semantic searches via Smart Connections, and execute Templater templates without granting direct file system access. The system consists of an Obsidian plugin and a local MCP server, requiring the Local REST API plugin for encrypted communication.

Tokens
19.9K
Snippets
69
Records
93
Agent score
74%

What's inside obsidian-mcp-tools

  1. Security architecture of the MCP Tools plugin

    main

    The plugin implements several security layers to protect vault data:

    • Binary Integrity: All server binaries are signed and include SLSA provenance.
    • Encrypted Communication: All communication is encrypted using the Local REST API's TLS.
    • Secure Key Management: API keys are stored using platform-specific secure methods.
    • Principle of Least Privilege: The server runs with only the minimal required permissions.
  2. Understand the MCP Tools Architecture

    main

    MCP Tools for Obsidian works by creating a secure bridge between your vault and AI applications using two main components:

    1. Obsidian Plugin: Adds MCP capabilities directly to your Obsidian vault.
    2. Local MCP Server: A secure bridge that handles communication with AI applications (like Claude Desktop).

    Security Model: The MCP server acts as a gatekeeper. AI applications never have direct access to your vault files; they interact only with the server's secure API, which requires explicit permission and uses your Local REST API key to perform actions like reading notes or executing templates.

  3. How the feature-based architecture works in the Obsidian plugin

    main

    The Obsidian plugin is organized into self-contained feature modules located in src/features/. This architecture ensures that each feature is decoupled, allowing them to initialize independently, manage their own dependencies, and continue running even if other features fail.

    Each feature module follows a standardized structure:

    • components/: UI components specific to the feature.
    • services/: Business logic.
    • types.ts: Feature-specific TypeScript types.
    • utils.ts: Feature-specific utility functions.
    • constants.ts: Feature-specific constants.
    • index.ts: The public API, which must export a setup function.
    // Example feature structure
    src/features/
    ├── core/
    ├── mcp-server-install/
    ├── mcp-server-prompts/
    └── smart-search/
  4. Develop MCP Tools locally

    main

    This project is a Bun-based monorepo. To set up a development environment:

    1. Install Dependencies:
      bun install
    2. Build All Packages:
      bun run build
    3. Run Development Mode:
      bun run dev

    Workspace Structure:

    • packages/mcp-server/: Server implementation.
    • packages/obsidian-plugin/: Obsidian plugin.
    • packages/shared/: Shared utilities and types.
    bun install
    bun run build
    bun run dev
  5. Verify MCP Server Binary Integrity

    main

    The MCP server binaries are published with SLSA Provenance attestations. You can verify the integrity and origin of the binary using the GitHub CLI to ensure it was built by the official repository's GitHub Actions workflows.

    1. Install the GitHub CLI (gh) via Homebrew (macOS), Scoop (Windows), or apt (Linux).
    2. Run the following command against the binary path or URL:
    gh attestation verify --owner jacksteamdev <binary path or URL>
    gh attestation verify --owner jacksteamdev <binary path or URL>
  6. Configure Prerequisites for MCP Tools

    main

    Before installing, ensure you meet the following requirements:

    Required

    • Obsidian: v1.7.7 or higher.
    • Claude Desktop: Installed and configured.
    • Local REST API Plugin: Must be installed and configured with an API key (this is required for Vault Access).
    • Templater Plugin: For enhanced template integration functionality.
    • Smart Connections Plugin: For semantic search capabilities.
  7. Install the MCP Server via Obsidian Plugin

    main

    To enable MCP (Model Context Protocol) capabilities, you must install the MCP server executable through the Obsidian plugin settings. The plugin automates the download of the correct platform-specific binary and configures Claude Desktop for you.

    Prerequisites

    Before installing, ensure you have the following:

    • Claude Desktop installed.
    • Local REST API plugin installed and configured with an API key (this is required for the server to communicate with Obsidian).
    • Recommended (Optional):
      • Templater plugin for enhanced functionality.
      • Smart Connections plugin for enhanced search.

    Installation Steps

    1. Open the Obsidian plugin settings for mcp-tools-for-obsidian.
    2. The plugin will verify your prerequisites and show their status.
    3. Click the Install button in the settings UI.
    4. The plugin will automatically:
      • Retrieve your API key from the Local REST API plugin.
      • Download the appropriate binary for your OS.
      • Update your Claude Desktop configuration file.
    5. Once complete, the status will change to Installed.
    # No specific CLI command; installation is performed via the Obsidian Settings UI.
  8. Manage feature settings using TypeScript module augmentation

    main

    To ensure type-safe access to feature-specific settings, use TypeScript module augmentation to extend the McpToolsPluginSettings interface. This allows you to add new configuration keys that are automatically recognized when calling McpToolsPlugin.loadData() and McpToolsPlugin.saveData().

    // packages/obsidian-plugin/src/features/some-feature/types.ts
    declare module "obsidian" {
      interface McpToolsPluginSettings {
        featureName?: {
          setting1?: string;
          setting2?: boolean;
        };
      }
    }
  9. Develop the MCP Tools for Obsidian Plugin

    main

    The plugin is part of a monorepo and uses bun for development tasks. Use the following commands to manage the development lifecycle:

    • Install dependencies: bun install
    • Start development build (watch mode): bun run dev
    • Create a production build: bun run build
    • Link plugin to a vault for testing: bun run link <path-to-vault-config-file>
    # Install dependencies
    bun install
    
    # Start development build with watch mode
    bun run dev
    
    # Create a production build
    bun run build
    
    # Link plugin to your vault for testing
    bun run link <path-to-vault-config-file>