Skip to main content

MCP server for Obsidian with full Canvas support

Project description

obsidian-api-mcp

MCP server for Obsidian with full Canvas support.

Prerequisites

Required: Install the Local REST API plugin in Obsidian.

Install via BRAT:

  1. Install BRAT from Obsidian Community Plugins
  2. Add Beta plugin: ArtiPyHeart/obsidian-local-rest-api
  3. Enable the plugin and copy your API key from settings

Features

  • Async architecture - Uses httpx.AsyncClient for non-blocking HTTP requests
  • Coarse-grained tools - 6 tools instead of 16+ to reduce context overhead
  • Full Canvas support - Read, create, and modify Canvas nodes and edges
  • Canvas search - Search results include Canvas text nodes with metadata

Installation

From PyPI (recommended)

# Using uvx (recommended)
uvx obsidian-api-mcp

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

From source

git clone https://github.com/ArtiPyHeart/obsidian-local-rest-api.git
cd obsidian-local-rest-api/mcp/obsidian-mcp
uv pip install -e .

Configuration

Set environment variables (or use a .env file):

Variable Description Default
OBSIDIAN_API_KEY API key from Local REST API plugin (required)
OBSIDIAN_HOST Obsidian host 127.0.0.1
OBSIDIAN_PORT Obsidian port 27123
OBSIDIAN_PROTOCOL Protocol (http or https) http
OBSIDIAN_VERIFY_SSL Verify SSL certificates false

Claude Desktop Configuration

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "obsidian-api-mcp": {
      "command": "uvx",
      "args": ["obsidian-api-mcp"],
      "env": {
        "OBSIDIAN_API_KEY": "your-api-key",
        "OBSIDIAN_HOST": "127.0.0.1",
        "OBSIDIAN_PORT": "27123",
        "OBSIDIAN_PROTOCOL": "http"
      }
    }
  }
}

Tools

1. obsidian_files - File Operations

Unified file operations for the Obsidian vault.

Operations:

  • list - List files in a directory (use path="" for root)
  • get - Get content of a single file
  • batch_get - Get contents of multiple files concatenated
  • put - Create or overwrite a file
  • append - Append content to a file
  • delete - Delete a file
{
  "operation": "get",
  "path": "notes/example.md"
}

2. obsidian_patch - Content Insertion

Insert content relative to a heading, block reference, or frontmatter field.

Target types:

  • heading - Target a heading path (use :: as delimiter for nested headings)
  • block - Target a block reference (without ^ prefix)
  • frontmatter - Target a frontmatter field name

Operations: append, prepend, replace

Heading example (note: use full heading path):

{
  "filepath": "note.md",
  "target_type": "heading",
  "target": "Main Title::Tasks",
  "operation": "append",
  "content": "\n- [ ] New task"
}

Frontmatter example:

{
  "filepath": "note.md",
  "target_type": "frontmatter",
  "target": "status",
  "operation": "replace",
  "content": "published"
}

Block reference example:

{
  "filepath": "note.md",
  "target_type": "block",
  "target": "my-block-id",
  "operation": "append",
  "content": "\nAdditional content"
}

3. obsidian_search - Search

Search for documents in the vault.

Query types:

  • simple - Text search across all files (including Canvas text nodes)
  • complex - JsonLogic query for advanced filtering
{
  "query_type": "simple",
  "query": "project ideas",
  "context_length": 100
}
{
  "query_type": "complex",
  "query": {"glob": ["*.md", {"var": "path"}]}
}

4. obsidian_periodic - Periodic Notes

Operations for periodic notes and recent changes.

Note: Requires Periodic Notes plugin for get/recent operations, and Dataview plugin for changes operation.

Operations:

  • config - Get periodic notes configuration (folders, formats, enabled status)
  • get - Get current periodic note (daily/weekly/monthly/quarterly/yearly)
  • recent - Get most recent periodic notes of a type
  • changes - Get recently modified files (requires Dataview plugin)

Get configuration:

{
  "operation": "config"
}

Get current periodic note:

{
  "operation": "get",
  "period": "daily",
  "include_metadata": true
}

Get recent periodic notes:

{
  "operation": "recent",
  "period": "daily",
  "limit": 5,
  "include_content": true
}

Get recently changed files:

{
  "operation": "changes",
  "limit": 10,
  "days": 30
}

5. obsidian_canvas_read - Read Canvas

Get Canvas file structure and metadata.

{
  "filepath": "my-canvas.canvas",
  "include_metadata": true
}

6. obsidian_canvas_write - Modify Canvas

Add, update, or delete Canvas nodes and edges.

Target types:

  • node / edge - Single operations (requires operation)
  • nodes / edges - Batch operations

Node types: text, file, link, group

Single node add:

{
  "filepath": "my-canvas.canvas",
  "target_type": "node",
  "operation": "add",
  "id": "node1",
  "node_type": "text",
  "x": 0,
  "y": 0,
  "width": 200,
  "height": 100,
  "text": "Hello World"
}

Single node update:

{
  "filepath": "my-canvas.canvas",
  "target_type": "node",
  "operation": "update",
  "id": "node1",
  "text": "Updated text"
}

Single edge add:

{
  "filepath": "my-canvas.canvas",
  "target_type": "edge",
  "operation": "add",
  "id": "edge1",
  "fromNode": "node1",
  "toNode": "node2",
  "fromSide": "right",
  "toSide": "left"
}

Batch operations:

{
  "filepath": "my-canvas.canvas",
  "target_type": "nodes",
  "add": [
    {"id": "n1", "type": "text", "x": 0, "y": 0, "width": 200, "height": 100, "text": "Node 1"},
    {"id": "n2", "type": "text", "x": 300, "y": 0, "width": 200, "height": 100, "text": "Node 2"}
  ],
  "update": {
    "existing_node_id": {"text": "Updated content"}
  },
  "delete": ["old_node_id"]
}

Requirements

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

obsidian_api_mcp-0.1.5.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

obsidian_api_mcp-0.1.5-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file obsidian_api_mcp-0.1.5.tar.gz.

File metadata

  • Download URL: obsidian_api_mcp-0.1.5.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for obsidian_api_mcp-0.1.5.tar.gz
Algorithm Hash digest
SHA256 5060a30a54e9f54cb85c0d7c54cd67d48116ce907beb7f2c707eb020cc17678a
MD5 b6a8cc713d412ab1c2cd47f85441ccdf
BLAKE2b-256 b09d1448d22d99ea98e3b251d1a9313d32f448e960d9eacee77de7dffc11234d

See more details on using hashes here.

File details

Details for the file obsidian_api_mcp-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: obsidian_api_mcp-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for obsidian_api_mcp-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4fc43c8280ad93dea4b29746da8f0ec487f15616936aea5e3f1af8f7a8fea719
MD5 ef159b93913cf461c21bf3b1b9a59708
BLAKE2b-256 d1928b1a8ebea877f08d7558d965e36753cdce868c4722e149ac6f50308e6f95

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page