excalidraw-mcp
Original:🇺🇸 English
Translated
7 scripts
Create, edit, and export live Excalidraw diagrams using mcp-excalidraw-server (MCP tools + canvas REST API). Use when an agent needs to draw/lay out diagrams, convert Mermaid to Excalidraw, query/update/delete elements, or export/import elements from a running canvas server (EXPRESS_SERVER_URL, default http://localhost:3000).
12installs
Sourceyctimlin/mcp_excalidraw
Added on
NPX Install
npx skill4agent add yctimlin/mcp_excalidraw excalidraw-mcpTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Excalidraw MCP
Overview
Create and refine diagrams on a live Excalidraw canvas via MCP tools, with helper scripts for export/import workflows.
Quick Start
- Ensure the canvas server is reachable at (default
EXPRESS_SERVER_URL).http://localhost:3000 - Use MCP tools for interactive diagram edits; use for file-ish workflows (export/import/clear/health).
scripts/*.cjs - For detailed endpoint/tool reference, read .
references/cheatsheet.md
Workflow: Draw A Diagram (From Empty Canvas)
- Confirm canvas is up:
- Run (or GET
node scripts/healthcheck.cjs)./health
- Run
- Optional: clear the canvas:
- Run .
node scripts/clear-canvas.cjs
- Run
- Create shapes first (rectangles/diamonds/ellipses), using .
create_element - Put text on shapes by setting the shape’s field (do not create a separate text element unless you need standalone text).
text - Create arrows/lines after both endpoints exist.
- Use /
align_elementsafter rough placement; group only after layout stabilizes.distribute_elements
Workflow: Refine An Existing Diagram
- Discover what’s already there:
- Prefer with
get_resourceorresource: "elements".query_elements
- Prefer
- Identify targets by stable signals (id, type, label text), not by exact x/y.
- Update with (move/resize/colors/text) or delete with
update_element.delete_element - If deletes/updates “don’t work”, check:
- You’re pointing to the right .
EXPRESS_SERVER_URL - The element id exists on the canvas (use /
get_resource).GET /api/elements/:id - The element isn’t locked (use first).
unlock_elements
- You’re pointing to the right
Workflow: Export / Import (Repository-Friendly)
- Export current elements to a JSON file:
node scripts/export-elements.cjs --out diagram.elements.json
- Import elements (append) using batch create:
node scripts/import-elements.cjs --in diagram.elements.json --mode batch
- Import elements (overwrite canvas) using sync:
node scripts/import-elements.cjs --in diagram.elements.json --mode sync
Notes:
- clears the canvas and then writes the provided elements (good for “make canvas match this file”).
--mode sync - If you want stable ids across updates, keep ids in the exported JSON; if you want fresh ids, regenerate before importing.
Workflow: CRUD Smoke Test (Create → Update → Delete)
- Clear:
node scripts/clear-canvas.cjs
- Create a large visible rectangle + label:
- Use twice (rectangle + text).
node scripts/create-element.cjs
- Use
- Update:
- Move the rectangle with .
node scripts/update-element.cjs
- Move the rectangle with
- Delete:
- Remove both with .
node scripts/delete-element.cjs
- Remove both with
References
- : MCP tool list + REST API endpoints + payload shapes
references/cheatsheet.md