MCP HubMCP Hub
PublikPrinciple

obsidian-mcp-rest

by: PublikPrinciple

An MCP server implementation for accessing Obsidian via local REST API

40created 16/12/2024
Visit
REST
Obsidian

📌Overview

Purpose: To provide a local REST API implementation for accessing and managing Obsidian vaults through AI assistants.

Overview: The Obsidian MCP REST Server facilitates interaction with Obsidian notes and content management through a standardized API, enabling seamless access for AI assistants like Claude Desktop.

Key Features:

  • Access Obsidian Vault Contents: Allows reading, writing, and listing notes in Obsidian vaults to enhance content management.

  • Search Functionality: Enables users to search for specific notes or content within vaults to streamline information retrieval.


Obsidian MCP REST Server

An MCP (Model Context Protocol) server implementation that provides access to Obsidian vaults through a local REST API, enabling AI assistants to interact with Obsidian notes and manage vault content through a standardized interface.

Features

  • Access Obsidian vault contents through MCP
  • Read and write notes
  • List vault contents
  • Search functionality
  • Secure local REST API integration
  • Compatible with Claude Desktop and other AI assistants

Prerequisites

  • Node.js 16 or higher
  • Obsidian with Local REST API plugin installed and configured
  • An Obsidian vault with Local REST API enabled

Installation

To install the package globally:

npm install -g PublikPrinciple/obsidian-mcp-rest

Or use a specific version/branch:

npm install -g PublikPrinciple/obsidian-mcp-rest#main

Configuration

  1. Configure Obsidian Local REST API plugin:

    • Install the plugin
    • Configure the API port (default: 27123)
    • Generate and save an API key
  2. Create a configuration file config.json:

{
  "obsidian": {
    "apiKey": "your-api-key-here",
    "port": 27123,
    "host": "localhost"
  },
  "server": {
    "name": "obsidian-mcp",
    "version": "1.0.0"
  }
}

Usage

Start the server:

obsidian-mcp-rest --config path/to/config.json

Using with Claude Desktop

Configure Claude Desktop to use this MCP server:

  1. Open Claude Desktop settings and navigate to the MCP section.
  2. Add a new server configuration:
{
  "name": "obsidian-mcp",
  "command": "obsidian-mcp-rest",
  "args": ["--config", "path/to/config.json"]
}

Claude can access your Obsidian vault using commands like:

Read note "Projects/MyProject.md"
List all notes in "Projects" folder
Search for notes containing "typescript"

Available Tools

  • listNotes: List all notes in the vault or a specific folder
  • readNote: Read the contents of a specific note
  • writeNote: Create or update a note
  • searchNotes: Search for notes using a query string
  • getMetadata: Get metadata for a specific note

Security

The server runs locally, communicating through stdin/stdout. All requests to the Obsidian REST API are authenticated with your API key, ensuring data remains local to your machine.

Development

  1. Clone the repository:
git clone https://github.com/PublikPrinciple/obsidian-mcp-rest.git
cd obsidian-mcp-rest
  1. Install dependencies:
npm install
  1. Build the project:
npm run build
  1. Run tests:
npm test

Troubleshooting

Installation Issues

If you encounter installation issues, try:

  1. Clone and install locally:
git clone https://github.com/PublikPrinciple/obsidian-mcp-rest.git
cd obsidian-mcp-rest
npm install
npm run build
npm install -g .
  1. If you see TypeScript-related errors, ensure TypeScript is installed globally:
npm install -g typescript

Contributing

Contributions are welcome! Please submit a Pull Request or open an issue for major changes.

License

MIT License - see LICENSE file for details