MCP server for Obsidian with full Canvas support
Project description
obsidian-api-mcp
MCP server for Obsidian with full Canvas support.
Features
- Async architecture - Uses
httpx.AsyncClientfor 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 (usepath=""for root)get- Get content of a single filebatch_get- Get contents of multiple files concatenatedput- Create or overwrite a fileappend- Append content to a filedelete- 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/recentoperations, and Dataview plugin forchangesoperation.
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 typechanges- 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 (requiresoperation)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
- Python 3.11+
- Obsidian with Local REST API plugin installed
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file obsidian_api_mcp-0.1.4.tar.gz.
File metadata
- Download URL: obsidian_api_mcp-0.1.4.tar.gz
- Upload date:
- Size: 12.0 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96e02b3b92ff4ec0889a67c7b36aa81541cb1b5658064b85846eec44f069e4a4
|
|
| MD5 |
0bf95d825cb6c43d3063cdf2e1942ffb
|
|
| BLAKE2b-256 |
7cf107b37e3448d2682b6d93516ba4fb80f482feec309bd85a94b0b1a4a5e189
|
File details
Details for the file obsidian_api_mcp-0.1.4-py3-none-any.whl.
File metadata
- Download URL: obsidian_api_mcp-0.1.4-py3-none-any.whl
- Upload date:
- Size: 16.4 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2523f791ea229dd616830e2fa1e35222085cae2e0dc7c614eca7edb33d65a274
|
|
| MD5 |
9343b70219521970bcb0dd1418b40efb
|
|
| BLAKE2b-256 |
140667af3ccea601c4ed54bd83e02f6b2f0a93615dc1505da67e9a5962cb7459
|