Skip to main content

MCP server for Obsidian with full Canvas support

Project description

obsidian-mcp

MCP server for Obsidian with full Canvas support.

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

pip install -e .

Or with uv:

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-mcp": {
      "command": "uv",
      "args": ["--directory", "/path/to/obsidian-mcp", "run", "obsidian-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.2.tar.gz (51.3 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.2-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: obsidian_api_mcp-0.1.2.tar.gz
  • Upload date:
  • Size: 51.3 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":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for obsidian_api_mcp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 687a4016044dbd941d681ca9ffe3dd47f60dd5c568daa4e79061b98838fa25c3
MD5 8deba032387fea72fabfe863a4da025f
BLAKE2b-256 39a75e8314b51802f387a4cbd04c083606b82de83da65f1f7891f37926fc1753

See more details on using hashes here.

File details

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

File metadata

  • Download URL: obsidian_api_mcp-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 16.3 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":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for obsidian_api_mcp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fa7a033164dd7ec68dc2cd77ba0c3101947cb67845f724b52948ce26b7132c67
MD5 258787beeee8fb74d539dcadedcc5450
BLAKE2b-256 982f9462430f0d98835cb40abb237f057575c203f552cc9fb0f4225093e3e87a

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