The Mcp_excalidraw server enables AI agents to create and interactively control live Excalidraw diagrams through a persistent canvas with real-time synchronization, offering 26 MCP tools for element-level CRUD operations, canvas inspection via `describe_scene` and `get_canvas_screenshot`, and iterative diagram refinement. It solves the problem of enabling programmatic, element-by-element diagram creation and adjustment by agents, contrasting with one-shot prompt-to-diagram approaches by maintaining state and allowing agents to view, analyze, and modify canvas contents dynamically. The server integrates with Claude Desktop, Cursor, Claude Code, Codex CLI, and other MCP-compatible clients through both an MCP server interface and portable agent skill.
mcp-excalidraw-server gives AI agents a live Excalidraw canvas they can draw on, look at, refine, and save into your repo. Your agent creates architecture diagrams and flowcharts programmatically, sees its own work via screenshots, fixes layout problems, and exports .excalidraw files you can commit next to your code.
One canvas, three ways to drive it:
npx -y mcp-excalidraw-server <command>. Zero config, auto-starts the canvas, composable JSON in/out.Core drawing runs fully local (Node ≥ 18, MIT licensed) — no API keys. Mermaid conversion runs in the local browser canvas; share is optional and uploads an encrypted scene to excalidraw.com.

AI agent creates a complete architecture diagram from a single prompt (4x speed). Watch full video on YouTube
Ask your agent to "draw the architecture of this service" and it produces a real, editable Excalidraw diagram — not a one-shot image. Because the agent can query, screenshot, and update individual elements, it iterates until labels fit, nothing overlaps, and arrows route cleanly; then it exports the result as a .excalidraw file that lives in your repo and gets updated when the code changes.
Under the hood there are two processes, one product:
http://127.0.0.1:3000)Since v1.1 the canvas server starts itself: canvas-driving CLI commands (and the MCP server on launch) auto-spawn it if nothing is listening. status only inspects the current server state. Set EXCALIDRAW_NO_AUTOSTART=1 to opt out.
Excalidraw has an official MCP — a chat widget that streams a diagram inline from a single prompt (the model gets two tools: a format reference and create_view). It's great for "draw me a cat" in Claude or ChatGPT. We solve a different problem: giving coding agents a persistent canvas workbench.
| Official Excalidraw MCP | This Project | |
|---|---|---|
| Approach | Prompt in, diagram out (one-shot widget) | Programmatic element-level control (CLI + 26 MCP tools) |
| State | Checkpoints inside the chat widget | Persistent live canvas with real-time sync |
| Element CRUD | Declarative re-send with delete markers | Full create / read / update / delete per element |
| AI sees the canvas | No | describe (structured text) + screenshot (image) |
| Iterative refinement | Regenerate from checkpoint | Draw → look → adjust → look again, element by element |
| Layout tools | No | align, distribute, group / ungroup, lock, duplicate |
| File I/O | No model-facing export | .excalidraw export/import — diagrams as repo artifacts |
| Snapshot & rollback | Widget-side checkpoints | Named server-side snapshots |
| Mermaid conversion | No | mermaid / create_from_mermaid |
| Shareable URLs | Widget-only | share / export_to_excalidraw_url |
| Viewport control | Camera animations | set_viewport (zoom-to-fit all or selected elements, center on one element, manual zoom) |
| Works without MCP | No | Yes — CLI + agent skill + REST API |
| Multi-agent | Single chat | Multiple agents on the same canvas concurrently |
TL;DR — The official MCP shows Excalidraw diagrams in your chat. This project gives your coding agent a full Excalidraw workbench: a canvas it can draw on, inspect, refine, and commit to your repo.
Current package version: 1.1.0. The current release line is v1.1 — CLI-First.
npx -y mcp-excalidraw-server add|query|describe|screenshot|export|import|mermaid|snapshot|arrange|share|... — JSON on stdout, meaningful exit codes. Also installed as the excalidraw-canvas alias.EXCALIDRAW_NO_AUTOSTART=1.apply: multi-op patches ({"create":[...],"update":[{"id":"a","set":{...}}],"delete":[...]}) in a single invocation.install-skill: npx -y mcp-excalidraw-server install-skill --dir <skills-root> copies the portable agent skill into the directory your agent chooses (project or global), cleanly replacing older versions.query --filter locked=true --filter label.text=API — booleans, numbers, and nested keys work.src/core/) behind both the CLI and MCP server; canvas groupIds are the source of truth for grouping (ungroup now works across restarts); node-fetch dropped; MCP version metadata derived from package.json; canvas server writes a pidfile and shuts down cleanly.The only prerequisite is Node.js ≥ 18.
Copy this into your coding agent — it installs the portable skill into the project/global skill directory that agent already knows how to use, then verifies it by drawing a test diagram:
Install the Excalidraw canvas toolkit so you can draw diagrams for me:
1. Choose the right skill directory for this agent and scope (project or global).
2. Run: npx -y mcp-excalidraw-server install-skill --dir <that-skills-directory>
3. Read the installed excalidraw-skill/SKILL.md so you know the drawing workflow.
4. Start the canvas with: npx -y mcp-excalidraw-server start
then tell me to open http://127.0.0.1:3000 in my browser (screenshots need an open tab).
5. Draw a small test diagram — two labeled boxes connected by an arrow — take a
screenshot, and show me the result to confirm everything works.
| You are... | Install with | Then |
|---|---|---|
| Modern coding agent | npx -y mcp-excalidraw-server install-skill --dir <skills-root> | Let the agent choose project/global scope and its skill root |
| Claude Code shortcut | npx -y mcp-excalidraw-server install-skill | Installs to ~/.claude/skills for backward compatibility |
| Codex shortcut | npx -y mcp-excalidraw-server install-skill --target codex | Installs to ~/.codex/skills for backward compatibility |
| MCP client user (Claude Desktop, Cursor, ...) | Add the npx config below | See Configure MCP Clients |
| CLI user / scripting | Nothing — npx -y mcp-excalidraw-server <command> | See CLI Reference |
| Contributor / from source | git clone + npm ci + npm run build | See Quick Start (From Source / Docker) |
There is no separate server setup: any drawing command auto-starts the local canvas server on http://127.0.0.1:3000.
No clone, no config:
# start the canvas (drawing commands auto-start it too) and open it
npx -y mcp-excalidraw-server start
open http://127.0.0.1:3000 # browser tab enables screenshots & mermaid
# draw something
echo '[
{"id":"api","type":"rectangle","x":100,"y":100,"width":160,"height":80,"text":"API Server","backgroundColor":"#a5d8ff"},
{"id":"db","type":"rectangle","x":400,"y":100,"width":160,"height":80,"text":"Database","backgroundColor":"#99e9f2"},
{"type":"arrow","x":0,"y":0,"startElementId":"api","endElementId":"db","text":"SQL"}
]' | npx -y mcp-excalidraw-server add
# let your agent see its work
npx -y mcp-excalidraw-server describe
npx -y mcp-excalidraw-server screenshot --out diagram.png
# diagrams as repo artifacts
mkdir -p docs
npx -y mcp-excalidraw-server export --out docs/architecture.excalidraw
# or straight into an Obsidian vault (.md extension → Obsidian Excalidraw plugin format)
npx -y mcp-excalidraw-server export --out ~/vault/diagrams/architecture.excalidraw.md
Give your agent the full playbook:
npx -y mcp-excalidraw-server install-skill --dir <skills-root>
npx -y mcp-excalidraw-server install-skill --print-source # inspect bundled source path
Security note: The canvas server binds
127.0.0.1only by default. If you expose it on a network interface (HOST=0.0.0.0), put network-level access controls in front — the API has no built-in authentication.
The skill at skills/excalidraw-skill/ teaches agents the full workflow — layout planning, the screenshot-verify-fix quality loop, arrow routing, anti-patterns, snapshots, and file I/O. It works through the CLI (preferred, zero setup), MCP tools (if configured), or raw REST — in that order.
npx -y mcp-excalidraw-server install-skill --dir <skills-root>
The command copies the bundled excalidraw-skill/ directory into <skills-root>/excalidraw-skill. Let your agent choose whether that root should be project-level or global. Re-running install-skill upgrades in place — it replaces the target directory, so files removed upstream don't linger.
Where the skill shines:
.excalidraw files into the repo, commit them, re-import + refine when the architecture changes..excalidraw.md extension and the file opens natively in the Obsidian Excalidraw plugin — no compatibility-mode warning, block references and sync work; import reads both plain and lz-string-compressed vault files back.npx -y mcp-excalidraw-server <command> or (after npm i -g mcp-excalidraw-server) excalidraw-canvas <command>.
Conventions: JSON results on stdout — except describe (plain text by design) and raw-content output when --out is omitted (export prints the scene JSON, screenshot --format svg prints SVG). Diagnostics on stderr. Exit codes: 0 ok, 1 error, 2 usage, 3 canvas unreachable, 4 browser tab required. Canvas URL from EXPRESS_SERVER_URL or --url. Canvas-driving commands auto-start the server; status only reports current state. Explicit start overrides the EXCALIDRAW_NO_AUTOSTART=1 opt-out (it's user intent, not auto-start).
| Command | Description |
|---|---|
start / stop / status | Manage the canvas server (detached; stop identity-checks the live server via /health before signaling) |
add [file|-] | Batch-create elements from a JSON array (file or stdin); --one '{...}' for a single element |
apply [file|-] | One-call multi-op patch: {"create":[...],"update":[{"id":"a","set":{...}}],"delete":["id"]} |
get <id> / delete <id...> | Read / remove elements |
update <id> --set '{...}' | Update an element |
query | --type, --bbox x0,y0,x1,y1, --filter k=v (typed, nested keys), --filter-json '{...}' |
describe | AI-readable scene summary (plain text) |
screenshot | --out f.png, --format png|svg, --no-background (browser tab required) |
export [--out f.excalidraw] [--format json|obsidian] / import [file|-] [--replace] | Scene file I/O — a .md out path writes Obsidian's .excalidraw.md format; import reads it back |
mermaid [file|-] | Mermaid → canvas (browser tab required) |
snapshot save|list|restore <name> | Named snapshots |
arrange align|distribute|group|ungroup|lock|unlock|duplicate | Layout ops (--ids a,b,c, --to left|horizontal|...) |
share | Encrypted upload → shareable excalidraw.com URL |
clear --yes | Wipe the canvas |
install-skill [--dir <skills-root>] | Install the portable agent skill |
Labels and arrow bindings use the agent-friendly format everywhere in the CLI: "text" on any shape, "startElementId"/"endElementId" on arrows — normalization is automatic.
The MCP server runs over stdio. Since v1.1 the simplest config is npx — no clone, no absolute paths, and the canvas auto-starts:
| Variable | Description | Default |
|---|---|---|
EXPRESS_SERVER_URL | URL of the canvas server | http://127.0.0.1:3000 |
ENABLE_CANVAS_SYNC | Enable real-time canvas sync | true |
EXCALIDRAW_NO_AUTOSTART | Set 1 to disable canvas auto-start | (unset) |
EXCALIDRAW_EXPORT_DIR | Base directory MCP file exports may write to | current working dir |
PORT / HOST | Canvas server bind address | 3000 / 127.0.0.1 |
Config location:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonnpx (recommended)
{
"mcpServers": {
"excalidraw": {
"command": "npx",
"args": ["-y", "mcp-excalidraw-server"]
}
}
}
Local (node)
{
"mcpServers": {
"excalidraw": {
"command": "node",
"args": ["/absolute/path/to/mcp_excalidraw/dist/index.js"],
"env": {
"EXPRESS_SERVER_URL": "http://127.0.0.1:3000",
"ENABLE_CANVAS_SYNC": "true"
}
}
}
}
Docker
{
"mcpServers": {
"excalidraw": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "EXPRESS_SERVER_URL=http://host.docker.internal:3000",
"-e", "ENABLE_CANVAS_SYNC=true",
"ghcr.io/yctimlin/mcp_excalidraw:latest"
]
}
}
}
npx (recommended)
claude mcp add excalidraw --scope user -- npx -y mcp-excalidraw-server
Tip: for coding agents, the skill + CLI often beats MCP config entirely — let the agent pick its skill root, then run
npx -y mcp-excalidraw-server install-skill --dir <skills-root>.
Local (node) - User-level (available across all projects):
claude mcp add excalidraw --scope user \
-e EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
-e ENABLE_CANVAS_SYNC=true \
-- node /absolute/path/to/mcp_excalidraw/dist/index.js
Docker
claude mcp add excalidraw --scope user \
-- docker run -i --rm \
-e EXPRESS_SERVER_URL=http://host.docker.internal:3000 \
-e ENABLE_CANVAS_SYNC=true \
ghcr.io/yctimlin/mcp_excalidraw:latest
Manage servers:
claude mcp list # List configured servers
claude mcp remove excalidraw # Remove a server
Config location: .cursor/mcp.json in your project root (or ~/.cursor/mcp.json for global config)
npx (recommended)
{
"mcpServers": {
"excalidraw": {
"command": "npx",
"args": ["-y", "mcp-excalidraw-server"]
}
}
}
Docker
{
"mcpServers": {
"excalidraw": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "EXPRESS_SERVER_URL=http://host.docker.internal:3000",
"-e", "ENABLE_CANVAS_SYNC=true",
"ghcr.io/yctimlin/mcp_excalidraw:latest"
]
}
}
}
npx (recommended)
codex mcp add excalidraw -- npx -y mcp-excalidraw-server
Docker
codex mcp add excalidraw \
-- docker run -i --rm \
-e EXPRESS_SERVER_URL=http://host.docker.internal:3000 \
-e ENABLE_CANVAS_SYNC=true \
ghcr.io/yctimlin/mcp_excalidraw:latest
Manage servers:
codex mcp list # List configured servers
codex mcp remove excalidraw # Remove a server
Config location: ~/.config/opencode/opencode.json or project-level opencode.json
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"excalidraw": {
"type": "local",
"command": ["npx", "-y", "mcp-excalidraw-server"],
"enabled": true
}
}
}
Config location: ~/.gemini/antigravity/mcp_config.json
{
"mcpServers": {
"excalidraw": {
"command": "npx",
"args": ["-y", "mcp-excalidraw-server"]
}
}
}
host.docker.internal to reach the canvas server running on your host machine. On Linux, you may need --add-host=host.docker.internal:host-gateway or use 172.17.0.1. The Docker MCP image sets EXCALIDRAW_NO_AUTOSTART=1 (it has no frontend build) — run the canvas as its own container.export / snapshot for persistence.| Category | Tools |
|---|---|
| Element CRUD | create_element, get_element, update_element, delete_element, query_elements, batch_create_elements, duplicate_elements |
| Layout | align_elements, distribute_elements, group_elements, ungroup_elements, lock_elements, unlock_elements |
| Scene Awareness | describe_scene, get_canvas_screenshot |
| File I/O | export_scene, import_scene, export_to_image, export_to_excalidraw_url, create_from_mermaid |
| State Management | clear_canvas, snapshot_scene, restore_snapshot |
| Viewport | set_viewport |
| Design Guide | read_diagram_guide |
| Resources | get_resource |
Full schemas are discoverable via tools/list or in skills/excalidraw-skill/references/cheatsheet.md.
Viewport group focus can tune framing with viewportZoomFactor:
{
"scrollToElementIds": ["id1", "id2", "id3"],
"viewportZoomFactor": 0.85
}
scrollToElementIds zooms to fit every requested element, while scrollToElementId centers one element without changing the current zoom. Specify only one viewport mode per request. viewportZoomFactor accepts values greater than 0 and at most 1.
From source (Node >= 18):
npm ci
npm run build
PORT=3000 npm run canvas # canvas server (terminal 1)
node dist/index.js # MCP server over stdio (terminal 2, usually launched by your MCP client)
node dist/bin.js status # or drive the CLI straight from the build
Docker canvas server:
docker run -d -p 3000:3000 --name mcp-excalidraw-canvas ghcr.io/yctimlin/mcp_excalidraw-canvas:latest
MCP server image: ghcr.io/yctimlin/mcp_excalidraw:latest (stdio; point EXPRESS_SERVER_URL at the canvas container).
npx -y mcp-excalidraw-server start
npx -y mcp-excalidraw-server status
npx -y mcp-excalidraw-server add --one '{"type":"rectangle","x":100,"y":100,"width":300,"height":200}'
npx -y mcp-excalidraw-server describe
curl http://127.0.0.1:3000/health
npm run test:bind
List tools:
npx @modelcontextprotocol/inspector --cli \
-e EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
-e ENABLE_CANVAS_SYNC=true -- \
node dist/index.js --method tools/list
Create a rectangle:
npx @modelcontextprotocol/inspector --cli \
-e EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
-e ENABLE_CANVAS_SYNC=true -- \
node dist/index.js --method tools/call --tool-name create_element \
--tool-arg type=rectangle --tool-arg x=100 --tool-arg y=100 \
--tool-arg width=300 --tool-arg height=200
If you use agent-browser for UI checks:
agent-browser install
agent-browser open http://127.0.0.1:3000
agent-browser wait --load networkidle
agent-browser screenshot /tmp/canvas.png
The official Excalidraw MCP is a chat widget: you prompt, it streams a diagram into the conversation (the model gets two tools). This project is a workbench for coding agents: a persistent local canvas with element-level create/read/update/delete, layout tools, screenshots the model can see, snapshots, and .excalidraw file I/O — driveable via CLI, MCP, or REST. See the full comparison table.
Claude Code, Claude Desktop, Cursor, Codex CLI, OpenCode, and Google Antigravity are documented below — but any agent that can run shell commands can use the CLI, any MCP client can use the MCP server, and anything else (LangChain, custom apps) can use the REST API.
Yes — that's the core feature. describe returns a structured text summary (ids, positions, labels, connections) and screenshot returns a rendered PNG. Agents use both to catch truncated labels, overlaps, and bad arrow routing, then fix them element by element.
Only for rendering-dependent features: screenshots, PNG/SVG export, viewport control, and Mermaid conversion (they render in the Excalidraw frontend). Creating, querying, updating elements and exporting .excalidraw JSON all work headless. The CLI exits with code 4 and tells you when a browser tab is needed.
The canvas is in-memory by design (restart = blank canvas). Persist by exporting .excalidraw files into your repo (export --out docs/architecture.excalidraw) or with named snapshots while working. Re-import a file to keep refining it later.
share encrypts the scene locally with AES-GCM before uploading; the decryption key is only in the URL fragment, which excalidraw.com's server never sees. Anyone you give the full link to can view the diagram.
No API key is required. Core drawing runs locally under MIT license. The only outbound call is the optional share upload to excalidraw.com.
Yes — that's the recommended path for coding agents: npx -y mcp-excalidraw-server install-skill --dir <skills-root> and the agent drives everything through the CLI. MCP configuration is only needed for chat clients like Claude Desktop.
status, auto-start is disabled (EXCALIDRAW_NO_AUTOSTART=1), or EXPRESS_SERVER_URL points at a non-loopback host. Run start explicitly or fix the env.http://127.0.0.1:3000 in a browser and retry.EXPRESS_SERVER_URL points at the running canvas server (status shows the URL in use).export / snapshots as a workaround.Contributions welcome!
npm run type-check
npm run build
npm run cli -- status # run the CLI from the local build
npm run sync:skills # after editing skills/excalidraw-skill, sync the repo-local agent copy
Bug reports and pull requests are welcome on GitHub issues. If this project helps you, a ⭐ helps others find it.
MIT © yctimlin — not affiliated with the Excalidraw team. Excalidraw is its own MIT-licensed project; this toolkit builds on it with love.
Links: npm package · GitHub · Issues · Demo video
miapre/html-to-figma-design-system
ie3jp/illustrator-mcp-server
coding-solo/godot-mcp
ivanmurzak/unity-mcp
figma/mcp-server-guide
abhiemj/manim-mcp-server