Excalidraw canvas toolkit for creating, editing, and refining diagrams on a live canvas. Use when an agent needs to (1) draw or lay out diagrams, (2) iteratively refine them by describing the scene and screenshotting its own work, (3) export/import .excalidraw files or PNG/SVG images, (4) save/restore canvas snapshots, (5) convert Mermaid to Excalidraw, or (6) perform element-level CRUD, alignment, distribution, grouping, duplication, and locking. Primary interface is the bundled CLI (npx -y mcp-excalidraw-server <command>) which auto-starts the canvas server; MCP tools and a REST API are equivalent alternatives.
77
96%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Three interfaces drive the same live canvas. Pick the first one that applies:
excalidraw/* tools (e.g. batch_create_elements) are in your tool list, prefer them: results land directly in your context, and screenshots come back as images without touching disk.npx -y mcp-excalidraw-server <command>http://127.0.0.1:3000 (first npx run downloads the package). If the CLI is installed globally (npm i -g mcp-excalidraw-server), the shorter alias excalidraw-canvas <command> works too.http://127.0.0.1:3000 — see references/cheatsheet.md for payloads. The server must already be running.The canvas URL comes from EXPRESS_SERVER_URL (default http://127.0.0.1:3000). Remind the user to open that URL in a browser — screenshots, image export, mermaid conversion, and viewport control need an open tab (CLI exits with code 4 when it's missing).
Results are JSON on stdout — except describe (plain text) and raw-content output when --out is omitted (export scene JSON, screenshot --format svg). Diagnostics on stderr. Exit codes: 0 ok, 1 error, 2 usage, 3 canvas unreachable, 4 browser tab required.
| Task | Command |
|---|---|
| Start / stop / inspect server | start, stop, status |
| Create elements (batch) | add elements.json or echo '[...]' | add or add --one '{...}' |
| Multi-op patch in one call | apply patch.json — {"create":[...],"update":[{"id":"a","set":{...}}],"delete":[...]} |
| Read one / query many | get <id>, query [--type t] [--bbox x0,y0,x1,y1] [--filter k=v] [--filter-json '{...}'] |
| Update / delete | update <id> --set '{...}', delete <id> [...] |
| Understand the scene | describe (plain-text summary: ids, positions, labels, connections) |
| See the scene | screenshot [--out f.png] (PNG without --out → temp file path in JSON; SVG without --out → raw SVG) |
| Layout operations | arrange align|distribute|group|ungroup|lock|unlock|duplicate --ids a,b,c [--to left|horizontal|...] |
| Scene files | export [--out scene.excalidraw], `import [scene.excalidraw |
| Mermaid → canvas | `mermaid [diagram.mmd |
| Snapshots | snapshot save|list|restore <name> |
| Share link | share (encrypted upload → excalidraw.com URL) |
| Wipe canvas | clear --yes |
| Install / upgrade this skill | install-skill --dir <skills-root> (agent chooses project/global root) |
The CLI and MCP tools accept the same agent-friendly format and normalize it automatically:
"text": "My Label" on any shape — converted to Excalidraw's bound-label format for you."startElementId": "a" / "endElementId": "b" — arrows auto-route to element edges."helvetica", "cascadia", "excalifont", ...) or string number "1"–"8".[[x,y], ...] tuples and [{"x":..,"y":..}] objects are accepted.apply, update entries can use either direct fields ({"id":"a","x":120}) or a set object ({"id":"a","set":{"x":120}}). Do not mix both forms in one update entry.Raw REST is stricter: labels must be "label": {"text": "..."}, bindings must be "start": {"id": "..."} / "end": {"id": "..."}. Only worry about this when POSTing to the API directly.
The canvas uses a 2D coordinate grid: (0, 0) is the origin, x increases rightward, y increases downward. Plan your layout before writing any JSON.
General spacing guidelines:
max(160, labelCharCount * 12) to keep the label on one lineStyling for a professional look:
"fillStyle": "solid" on shapes gives crisp flat fills — the default is a sketchy hachure patternbackgroundColor fills with their darker strokeColor (palette in the cheatsheet)"strokeStyle": "dashed" on zone borders and async arrows reads as "boundary / background"These are the most common mistakes that produce unreadable diagrams. Avoid all of them.
label.text (or text) on large background zone rectanglesWhen you put a label on a background rectangle, Excalidraw creates a bound text element centered in the middle of that shape — right where your service boxes will be placed. The text overlaps everything inside the zone and cannot be repositioned.
Wrong:
{"id": "vpc-zone", "type": "rectangle", "x": 50, "y": 50, "width": 800, "height": 400, "text": "VPC (10.0.0.0/16)"}Right — use a free-standing text element anchored at the top of the zone:
{"id": "vpc-zone", "type": "rectangle", "x": 50, "y": 50, "width": 800, "height": 400, "backgroundColor": "#e3f2fd"},
{"id": "vpc-label", "type": "text", "x": 70, "y": 60, "width": 300, "height": 30, "text": "VPC (10.0.0.0/16)", "fontSize": 18}The free-standing text element sits at the top corner of the zone and doesn't interfere with elements placed inside.
An arrow from an element in one layout zone to an element in a distant zone will draw a long diagonal line crossing through everything in between. In a multi-zone infra diagram this produces an unreadable tangle of spaghetti.
Design rule: Keep arrows within the same zone or tier. To show cross-zone relationships, use annotation text or separate the zones so their edges are adjacent (no elements between them), and route the arrow along the edge.
If you must connect across zones, use an elbowed arrow that travels along the perimeter — never through the middle of another zone.
Arrow labels are placed at the midpoint of the arrow. On short arrows, they overlap the shapes at both ends. On crowded diagrams, they collide with nearby elements.
Excalidraw diagrams are visual communication. If text is cut off, elements overlap, or arrows cross through unrelated shapes, the diagram becomes confusing and unprofessional — it defeats the whole purpose of drawing it. So after every batch of elements, verify before adding more.
After each add / apply / batch_create_elements, take a screenshot and check:
width and/or height.text/label.text on a background zone rectangle, the zone label will be centered in the middle of the zone, overlapping everything inside. Fix: delete the bound text element and add a free-standing text element at the top of the zone instead (see Layout Anti-Patterns above).If you find any issue: stop, fix it, re-screenshot, then continue. Say "I see [issue], fixing it" rather than glossing over problems. Only proceed once all checks pass.
Use mermaid / create_from_mermaid when: the user already has a Mermaid diagram, or the structure maps cleanly to a flowchart/sequence/ER diagram with standard Mermaid syntax. It's fast and handles conversion automatically, though you get less control over exact layout.
Create elements directly when: you need precise layout control, the diagram type doesn't map to Mermaid well (e.g., custom architecture, annotated cloud diagrams), or you want elements positioned in a specific coordinate grid.
read_diagram_guide for colors/sizing; the same guidance lives in references/cheatsheet.md.)npx -y mcp-excalidraw-server clear --yesid fields (e.g. "id": "auth-svc") make later updates easy:
npx -y mcp-excalidraw-server add - <<'EOF'
[
{"id": "lb", "type": "rectangle", "x": 300, "y": 50, "width": 180, "height": 60, "text": "Load Balancer"},
{"id": "svc-a", "type": "rectangle", "x": 100, "y": 200, "width": 160, "height": 60, "text": "Web Server 1"},
{"id": "svc-b", "type": "rectangle", "x": 450, "y": 200, "width": 160, "height": 60, "text": "Web Server 2"},
{"id": "db", "type": "rectangle", "x": 275, "y": 350, "width": 210, "height": 60, "text": "PostgreSQL"},
{"type": "arrow", "x": 0, "y": 0, "startElementId": "lb", "endElementId": "svc-a"},
{"type": "arrow", "x": 0, "y": 0, "startElementId": "lb", "endElementId": "svc-b"},
{"type": "arrow", "x": 0, "y": 0, "startElementId": "svc-a", "endElementId": "db"},
{"type": "arrow", "x": 0, "y": 0, "startElementId": "svc-b", "endElementId": "db"}
]
EOF- positional is optional — with no file argument, add reads stdin.)max(160, labelLength * 12).screenshot → view the file → run the Quality Checklist → fix issues before the next batch.Straight arrows can cross through elements in complex diagrams. Use curved or elbowed arrows when needed:
Curved arrows (smooth arc over obstacles):
{
"type": "arrow", "x": 100, "y": 100,
"points": [[0, 0], [50, -40], [200, 0]],
"roundness": {"type": 2}
}The intermediate waypoint [50, -40] lifts the arrow upward. roundness: {type: 2} makes it smooth.
Elbowed arrows (right-angle / L-shaped routing):
{
"type": "arrow", "x": 100, "y": 100,
"points": [[0, 0], [0, -50], [200, -50], [200, 0]],
"elbowed": true
}When to use which:
Rule: If an arrow would pass through an unrelated shape, add a waypoint to route around it.
Pairing describe with screenshot is what makes this skill powerful.
describe (describe_scene in MCP) → structured text: element IDs, types, positions, labels, connections. Use it to know what's on the canvas before making programmatic updates (find IDs, understand bounding boxes).screenshot (get_canvas_screenshot in MCP) → PNG of the actual rendered canvas. Use it for visual quality verification — it shows exactly what the user sees, including truncation, overlap, and arrow routing. The CLI prints the saved file path as JSON; read/view that file.Feedback loop:
add elements
→ screenshot → view → "text truncated on auth-svc"
→ update auth-svc --set '{"width": 220}' → screenshot → "overlap between auth-svc and rate-limiter"
→ update rate-limiter --set '{"x": 520}' → screenshot → "all checks pass"
→ proceeddescribe to understand current state — note element IDs and positions.id or label text (not by x/y coordinates — they change).update <id> --set '{...}' to resize/recolor/move; delete <id> to remove; or bundle everything in one apply patch. Bound arrows re-route automatically when you move or resize their endpoints — no need to delete and recreate them.screenshot to confirm the change looks right.get <id>; unlock with arrange unlock --ids <id> if locked.echo 'graph TD
A[Client] --> B[API]
B --> C[(DB)]' | npx -y mcp-excalidraw-server mermaidRequires an open browser tab (conversion runs in the frontend; exit code 4 tells you to open the canvas URL). Afterwards screenshot to verify layout. If the auto-layout is poor (nodes crowded, edges crossing), find problem elements with describe and reposition them with update.
export --out diagram.excalidraw (no --out → JSON to stdout)import diagram.excalidraw (append) or import diagram.excalidraw --replacescreenshot --out diagram.png / screenshot --format svg --out diagram.svg (browser tab required)share — encrypts the scene and returns a shareable excalidraw.com URLThis is how diagrams live in a repo: commit the .excalidraw file, and re-import + edit + export it when the architecture changes.
.excalidraw.mdCheck the destination before writing: if any ancestor directory contains .obsidian/, it is an Obsidian vault. A raw .excalidraw file there opens in the Excalidraw plugin only in compatibility mode ("Convert to new format" warning), gets no block references or vault-wide search, and default Obsidian Sync skips non-.md files. Give the export a .excalidraw.md extension and the CLI writes the plugin's native format automatically:
npx -y mcp-excalidraw-server export --out "$VAULT/diagrams/system-map.excalidraw.md" # .md → Obsidian format (or force with --format obsidian)
npx -y mcp-excalidraw-server import "$VAULT/diagrams/system-map.excalidraw.md" --replace # reads both plain and compressed Drawing blocksRound-trips are safe: text-element block references follow the plugin's own id rules, so re-importing, editing, and re-exporting the same file keeps links from other notes intact.
snapshot save <name> before risky changes.describe / screenshot.snapshot restore <name> to roll back if needed. snapshot list shows what's saved.arrange duplicate --ids a,b --offset 40,40 (default offset 20,20). Useful for repeated patterns or copying layouts.
EXCALIDRAW_NO_AUTOSTART=1) or a non-loopback EXPRESS_SERVER_URL is set. Run start explicitly or fix the env.http://127.0.0.1:3000 in a browser, then retry — screenshots, image export, viewport, and mermaid conversion render in the frontend.describe — they may be off-screen. In MCP mode, use set_viewport with scrollToContent: true, or scrollToElementIds plus optional viewportZoomFactor to focus on a specific subgraph; in a browser, press the zoom-to-fit button.get <id>. Make sure startElementId/endElementId match existing element IDs.snapshot save first, then clear --yes and rebuild. Or snapshot restore to go back.arrange unlock --ids <id> first.query --type text to find elements with a containerId, delete the unwanted ones, wait a few seconds for auto-sync to settle. The safest prevention: never put labels on background zone rectangles — use free-standing text elements.references/cheatsheet.md: full CLI reference, the 26 MCP tools, REST API endpoints + payload shapes, and the diagram design guide (colors, sizing).ff42de9
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.