excalidraw-mcp
You can programmatically author, edit, inspect, repair, and preview native Excalidraw diagrams in memory via MCP.
Create rectangles, ellipses, diamonds, circles, standalone text, and frames with labels, colors, opacity, fonts, roughness, roundness, and stroke/fill styling.
Create labeled connectors/arrows between coordinates or bound elements, with routing modes, docking faces, arrowheads, and styling.
Update element geometry, labels, frames, and visual properties; delete elements while detaching surviving connectors; clear the scene; and undo the last mutation.
Execute atomic batches of mixed mutations such as add, connect, move, resize, update, delete, lock/group, duplicate, and layout repair with client-side IDs.
Inspect scene summaries, spatial descriptions, elements, element details, searches, viewport, live-server status, and MCP resources.
Automatically diagnose and repair overlaps, connector issues, containment, text clipping, and spacing with dry-run, scope, and aggressiveness controls.
Render inline PNG/JPEG previews of the canvas with configurable scale, padding, background, and max dimension.
With the full toolset, additionally export PNG/SVG/Obsidian Markdown, save/load scenes, generate diagrams, manage element state, set viewport, run a live WebSocket canvas, and publish encrypted Excalidraw share URLs.
Enables AI agents to create, inspect, edit, diagnose, and export native Excalidraw diagrams in Schema v2 format, including PNG rendering, .excalidraw file persistence, layout repair, element management, and shareable excalidraw.com links.
Provides conversion of Mermaid flowchart and graph syntax into native Excalidraw diagrams, supporting direction options, node shapes, subgraphs, and edge labels.
Excalidraw MCP Server
A headless, in-memory Model Context Protocol server enabling AI agents to programmatically generate, inspect, repair, and export native Excalidraw diagrams.
Excalidraw MCP is a backend-oriented Model Context Protocol (MCP) server that empowers AI coding agents to create, inspect, edit, diagnose, and export native Excalidraw diagrams over standard stdio.
Operating directly on scene graphs and element trees in memory with FreeType font metrics and topological collision solvers, it eliminates browser automation overhead to achieve sub-millisecond diagram mutations. All diagrams serialize strictly to Excalidraw Schema v2 JSON, guaranteeing immediate compatibility with excalidraw.com, IDE plugins, and high-resolution export pipelines.
Visual Showcase
System architecture diagram generated programmatically by Excalidraw MCP itself. Editable source: docs/architecture.excalidraw.
Related MCP server: fcp-drawio
Key Features
Headless In-Memory Operations: Operates 100% in pure Python on scene graphs in server memory with zero browser runtime or Node.js dependencies.
Native Excalidraw Schema v2: Outputs fully valid, editable
.excalidrawJSON documents compatible with excalidraw.com.Obstacle-Aware Orthogonal Routing: Calculates Manhattan arrow paths around intervening shapes with 15 px clearance corridors and dynamic cardinal-face docking.
Parallel Multi-Edge Lanes: Displaces parallel connectors between the same shapes into distinct 24 px lanes to prevent overlapping lines.
Font-Aware Text Metrics: Uses FreeType and Pillow to measure exact typographic envelopes, preventing label clipping inside rectangles, rhombuses, and ellipses.
Automated Layout Repair (
auto_fix_layout): Detects bounding box collisions, text clipping, and frame escapes, executing 5-phase de-collision and spacing with transactional regression rollback.Atomic Batch Authoring (
batch_mutate): Enables agents to create, move, style, connect, lock, group, and repair up to 500 operations in a single roundtrip with dynamicclient_idresolution.Halved Schema Context Footprint: Minimalist tool contracts and compact minified JSON responses strip
outputSchemaoverhead, reducing turn context usage by up to 50.4%.High-Resolution Headless Export: Headless Pillow rasterization generating PNG exports up to 8192 px, vector SVG exports, Obsidian Excalidraw plugin Markdown files (
.excalidraw.md), and inline vision previews (preview) capped to optimal model envelopes (max_dimension=1568).Interactive Live Canvas (
live_server): Real-time Starlette/Uvicorn WebSocket visualizer streaming agent mutations live into an open browser tab.Encrypted Web Sharing (
export_to_excalidraw_url): Publishes scenes directly to excalidraw.com using 128-bit AES-GCM client-side encryption.Bundled Agent Skills: Packages 6 prompt and pattern guides covering architecture design, flowcharts, 60-30-10 color palettes, and quality gates, installable via
exca-mcp install-skills(including automatic discovery for Claude Code viaexca-mcp install-skills --claude).
Quick Start
Run Excalidraw MCP instantly with uvx (zero install required):
uvx exca-mcpOr install via pip:
pip install exca-mcp
python -m excalidraw_mcpInstallation
Method | Command | Description |
uvx (Recommended) |
| Zero-install ephemeral execution. |
pip |
| Standard Python package installation. |
Docker |
| Containerized execution via stdio. |
Source |
| Local clone for development. |
CLI Utilities
exca-mcp includes built-in subcommands for environment diagnostics, configuration generation, and agent skill distribution:
# Run environment & dependency diagnostics (Python, fonts, storage, skills)
exca-mcp doctor
# Print copy-pasteable client configuration JSON
exca-mcp print-config claude # Claude Desktop / Claude Code
exca-mcp print-config cursor # Cursor (.cursor/mcp.json)
exca-mcp print-config zed # Zed (settings.json)
exca-mcp print-config windsurf # Windsurf
exca-mcp print-config opencode # OpenCode
exca-mcp print-config antigravity # Google Antigravity / Gemini CLI
# Install agent skills into your editor
exca-mcp install-skills --claude # ~/.claude/skills/excalidraw/
exca-mcp install-skills --cursor # .cursor/skills/
exca-mcp install-skills --windsurf # .windsurf/skills/
exca-mcp install-skills --target <path>MCP Client Configuration
Add Excalidraw MCP to your AI development environment:
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"excalidraw": {
"command": "uvx",
"args": ["exca-mcp"]
}
}
}Cursor
Add to .cursor/mcp.json or Global MCP Settings:
{
"mcpServers": {
"excalidraw": {
"command": "uvx",
"args": ["exca-mcp"]
}
}
}Zed
Add to ~/.config/zed/settings.json:
{
"context_servers": {
"excalidraw": {
"command": {
"path": "uvx",
"args": ["exca-mcp"]
}
}
}
}Remote Daemon / Streamable HTTP (Docker & Kubernetes)
Excalidraw MCP natively supports the MCP streamable-http transport for remote deployments in containers, Kubernetes clusters, or standalone daemons:
# Local development daemon (binds to 127.0.0.1:8000/mcp)
exca-mcp --transport streamable-http --port 8000
# Container / Kubernetes daemon (binds to 0.0.0.0:8000/mcp)
exca-mcp --transport streamable-http --host 0.0.0.0 --port 8000Minimal Dockerfile for remote deployments:
FROM python:3.12-slim
RUN pip install --no-cache-dir exca-mcp
EXPOSE 8000
CMD ["exca-mcp", "--transport", "streamable-http", "--host", "0.0.0.0", "--port", "8000"]Security Note: When binding to non-loopback addresses (
0.0.0.0), the server prints a warning tostderrbecause MCP does not provide built-in client authentication. Always protect network-exposed instances behind an authenticated reverse proxy (e.g., Envoy, Traefik, NGINX) or private cluster VPC.
For configuration in OpenCode, Claude Code CLI, Gemini/Antigravity CLI, or Docker environments, see docs/operations.md.
Toolset Overview (core vs full)
Excalidraw MCP provides two toolset profiles controlled by the EXCALIDRAW_TOOLSET environment variable:
Profile | Tools | Context Overhead | Primary Capabilities |
| 12 | ~3,133 tokens | Primitives ( |
| 21 | ~5,628 tokens | Includes all |
To enable the complete 21-tool profile:
export EXCALIDRAW_TOOLSET=fullSee docs/tools.md for the complete reference of all 21 tools, safety annotations, parameter schemas, and MCP resources.
Minimal Usage Example
AI agents can construct, connect, repair, and preview diagrams using the default core toolset:
# 1. Create container boundary frame
f = add_frame(name="Application Tier", x=100, y=100, w=600, h=220)
# 2. Add styled components inside the frame
s1 = create_shape(type="rectangle", x=140, y=160, w=180, h=90, label="API Gateway", frame_id=f["frame_id"], backgroundColor="#e7f5ff")
s2 = create_shape(type="rectangle", x=460, y=160, w=180, h=90, label="Auth Service", frame_id=f["frame_id"], backgroundColor="#fff3bf")
# 3. Connect components with an elbowed directional arrow
create_connector(source_id=s1["rectangle_id"], target_id=s2["rectangle_id"], label="verify_token()", elbowed=True)
# 4. Diagnose layout defects and render an inline visual preview
auto_fix_layout(dry_run=False, aggressiveness="balanced")
preview(max_dimension=1568, format="png")For comprehensive end-to-end multi-tier cloud and flowchart workflows, see docs/features.md.
Documentation Index
Guide | Description |
Technical architecture, subsystem request flow, state management, and geometry algorithms. | |
Detailed capability breakdown and end-to-end workflow examples. | |
Complete MCP tools reference, parameter schemas, code examples, resources, and task prompts. | |
5-phase layout repair engine, parameters, visual comparisons, and rollback guarantees. | |
Environment variables reference, storage semantics, extended client configurations, and troubleshooting. | |
Security model, write sandboxing, live server origin protection, and cloud sharing encryption. | |
Packaged agent skills catalog, design guides, and CLI installer ( | |
Structured Sugiyama layered graph generation, ranking, and geometry rules. | |
Migration guide mapping all 48 legacy v0.2.x tools to v0.3.0 equivalents. | |
Version release history and migration notes. | |
Developer guide, test suite execution, and pull request guidelines. | |
Vulnerability disclosure procedures and policy. |
Development & Contribution
# Clone the repository
git clone https://github.com/Dharshan2208/excalidraw-mcp.git
cd excalidraw-mcp
# Synchronize dependencies with uv (including test & dev tools)
uv sync --locked
# Run the full test suite (551 unit & integration tests)
uv run --locked pytest tests/
# Run code quality gates (linting & typechecking)
uvx ruff check excalidraw_mcp tests
uv run --with mypy mypy excalidraw_mcp
# Verify byte-compilation
uv run --locked python -B -m compileall -q -f main.py excalidraw_mcp tests
# Validate package build
uv build
uvx twine check dist/*See CONTRIBUTING.md for contribution guidelines.
License
This project is licensed under the MIT License.
Available Tools
12 toolsadd_frameC
Create a frame container, optionally enclosing existing elements.
Inputs: h (required), w (required), x (required), y (required), +9 more.
add_textC
Add standalone text element to the scene.
Inputs: x (required), y (required), content (required), opacity, +4 more.
auto_fix_layoutC
Diagnose and automatically repair layout defects with rollback safety.
Inputs: name, dry_run, min_gap, verbose, +2 more.
batch_mutateC
Atomically execute a batch of canvas mutations in a single revision step.
Inputs: operations (required).
clearADestructiveIdempotent
Clear all elements and state from the active scene.
Inputs: no named parameters.
create_connectorC
Create a connector arrow between coordinates or bound shape elements.
Inputs: x, y, x2, y2, +18 more.
create_shapeC
Create a shape (rectangle, ellipse, diamond) with optional label and styling.
Inputs: w (required), x (required), y (required), type (required), +13 more.
deleteBDestructive
Delete an element and detach surviving connectors.
Inputs: element_id (required).
inspect_sceneCRead-only
Query scene metrics, spatial descriptions, elements, viewport, or server status.
Inputs: mode, type, limit, query, +8 more.
previewBRead-only
Render an inline image preview of the active Excalidraw canvas.
Inputs: scale, format, padding, background, +1 more.
undoADestructive
Restore the scene before the most recent successful mutation.
Inputs: no named parameters.
update_elementBIdempotent
Update element position, size, label, or visual styling atomically.
Inputs: element_id (required), x, y, label, +15 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Most tools have clearly distinct canvas operations: create shape/connector/text/frame, update, delete, clear, preview, inspect, undo, and layout repair. The main overlap is that batch_mutate can perform many of the same mutations as the individual creation/update/delete tools, though its batch-atomic purpose is still reasonably distinct.
The set mixes verb_noun names such as create_shape, add_frame, update_element, and inspect_scene with bare verbs such as preview, undo, clear, and delete. The names are readable and mostly intuitive, but the convention is not consistent across all tools.
Twelve tools is a well-scoped size for an Excalidraw canvas server. Each tool maps to a meaningful operation, and the set avoids both trivial thinness and excessive fragmentation.
The surface covers core canvas lifecycle operations: creation, inspection, preview, update, deletion, clearing, batching, layout repair, and undo. Minor gaps remain, such as redo, duplicate, and group/ungroup operations, but the main workflows are covered.
Maintenance
Related MCP Connectors
Collaborative whiteboard MCP server — create objects, connectors, C4 diagrams, and manage boards
MCP server for generating rough-draft project plans from natural-language prompts.
Immutable diagrams for AI agents: create, edit, validate and render versioned diagrams over MCP.
Render, verify, describe, and safely edit Mermaid diagrams through MCP.
Related MCP Servers
- AlicenseBqualityCmaintenanceAn MCP server that generates beautiful Excalidraw architecture diagrams with perfect auto-layout, stateful editing, and architecture-aware component styling.26108 PyPI164MIT
- AlicenseBqualityDmaintenanceMCP server that enables LLMs to create and edit draw.io diagrams using high-level intent commands, with automatic layout and styling.45 npm4MIT
- AlicenseAqualityCmaintenanceAn MCP server for Excalidraw diagram creation and headless rendering, enabling interactive canvas editing and automated SVG/PNG export via Playwright.41MIT
- AlicenseBqualityCmaintenanceMCP server that enables AI assistants to create, parse, render, and validate Draw.io diagrams programmatically.1465 PyPI2MIT