excalidraw-mcp-server
Provides a comprehensive set of drawing tools to create, update, and manage diagrams in the Excalidraw format, including support for exporting scenes to excalidraw.com.
Enables the conversion of Mermaid diagram definitions into editable Excalidraw canvas elements.
excalidraw-mcp-server
The only Excalidraw MCP server with security hardening, inline diagram rendering, and real-time canvas sync.
What it does
Ask your AI to draw a diagram, and it appears right inside the chat. The MCP server gives Claude Desktop, ChatGPT, VS Code, and Cursor a full set of drawing tools backed by the Excalidraw format -- with API authentication, rate limiting, and input validation on every operation.
v2.0 adds MCP Apps support: diagrams stream inline as interactive SVG widgets with draw-on animations, and you can export any diagram to excalidraw.com with one click.
Related MCP server: sketchboard-excalidraw-mcp
Two modes, zero config
Standalone mode (default) -- just install and go. The server runs with an in-process element store. No canvas server, no API keys, no setup. Your MCP client calls the tools, and diagrams render inline.
Connected mode -- start the optional canvas server for real-time browser sync. Multiple clients can collaborate on the same canvas through authenticated WebSocket connections. File persistence keeps state across restarts.
The server auto-detects which mode to use: if a canvas server is reachable, it connects to it. Otherwise it falls back to standalone.
Architecture
Diagram created with excalidraw-mcp-server -- edit in Excalidraw
Features
MCP Apps (v2.0)
Inline diagram rendering in Claude Desktop, ChatGPT, and VS Code
Streaming SVG with draw-on animations as elements arrive
Export to excalidraw.com with one click
Element reference cheatsheet via
read_metool
16 MCP tools
Create, update, delete, and query elements (rectangle, ellipse, diamond, arrow, text, line, freedraw)
Batch create up to 100 elements at once
Group, ungroup, align, distribute, lock, unlock
Mermaid diagram conversion
SVG and PNG export
Security
API key authentication with constant-time comparison
Origin-restricted CORS (no wildcards)
WebSocket auth with token and origin validation
Standard and strict rate limiting tiers
Bounded Zod schemas with
.strict()on every endpointHelmet.js security headers with CSP
Infrastructure
Real-time WebSocket sync across browser clients
Optional atomic-write file persistence
Structured pino audit logging
Install
npm install -g excalidraw-mcp-serverOr run directly:
npx excalidraw-mcp-serverQuick start
Standalone (recommended for most users)
Just point your MCP client at the server. No canvas server needed.
{
"mcpServers": {
"excalidraw": {
"command": "npx",
"args": ["excalidraw-mcp-server"]
}
}
}Then ask your AI: "Draw an architecture diagram showing a load balancer, three app servers, and a database"
Connected mode (real-time browser sync)
# Generate an API key
node scripts/generate-api-key.cjs
# Start the canvas server
EXCALIDRAW_API_KEY=<your-key> npm run canvas
# Open http://localhost:3000 to see the live canvasPoint your MCP client at the server with the same API key:
{
"mcpServers": {
"excalidraw": {
"command": "npx",
"args": ["excalidraw-mcp-server"],
"env": {
"EXCALIDRAW_API_KEY": "<your-key>",
"CANVAS_SERVER_URL": "http://127.0.0.1:3000"
}
}
}
}MCP tools
Tool | Description |
| Render elements as an inline SVG widget with streaming animations (MCP Apps) |
| Get the element reference cheatsheet (types, colors, sizing tips) |
| Create a single element (rectangle, ellipse, diamond, arrow, text, line, freedraw) |
| Update an existing element by ID |
| Delete an element by ID |
| Search elements by type, locked status, or group ID |
| Get scene state, all elements, theme, or library |
| Create up to 100 elements in one call |
| Group multiple elements together |
| Remove elements from a group |
| Align elements (left, center, right, top, middle, bottom) |
| Distribute elements evenly (horizontal or vertical) |
| Lock elements to prevent modification |
| Unlock elements |
| Convert a Mermaid diagram to Excalidraw elements |
| Export the canvas as SVG or PNG |
Security comparison
Feature | Typical MCP servers | excalidraw-mcp-server |
Authentication | None | API key (constant-time compare) |
CORS |
| Origin allowlist |
WebSocket auth | None | Token + origin validation |
Rate limiting | None | Standard + strict tiers |
Input validation | Minimal | Bounded Zod with |
Security headers | None | Helmet.js + CSP |
Request size limit | None | 512KB body, 1MB WebSocket |
Audit logging | None | Structured pino logs |
Configuration
All settings via environment variables. Copy .env.example to .env and adjust as needed.
Variable | Default | Description |
|
| Use in-process store (no canvas server needed) |
|
| Canvas server bind address |
|
| Canvas server port |
| Auto-generated | API key for auth (min 32 chars) |
|
| Comma-separated origin allowlist |
|
| Rate limit window in milliseconds |
|
| Max requests per window (standard tier) |
|
| Enable file-based persistence |
|
| Directory for persistent storage |
|
| URL the MCP server uses to reach the canvas |
|
| Log level: debug, info, warn, error |
|
| Enable audit logging |
|
| Maximum elements on canvas |
|
| Maximum elements per batch create |
MCP client configuration
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"excalidraw": {
"command": "npx",
"args": ["excalidraw-mcp-server"]
}
}
}Cursor
Add to .cursor/mcp.json in your project root:
{
"mcpServers": {
"excalidraw": {
"command": "npx",
"args": ["excalidraw-mcp-server"]
}
}
}VS Code
Add to your MCP settings:
{
"mcpServers": {
"excalidraw": {
"command": "npx",
"args": ["excalidraw-mcp-server"]
}
}
}For connected mode, add "env": { "EXCALIDRAW_API_KEY": "<key>", "CANVAS_SERVER_URL": "http://127.0.0.1:3000" } to the config above. Replace <key> with the key from node scripts/generate-api-key.cjs.
Development
# Install dependencies
npm ci
# Run in development mode (watch + Vite dev server)
npm run dev
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Lint
npm run lint
# Type check
npm run type-check
# Build (server + widget + frontend)
npm run buildProject structure
src/
mcp/ MCP server (stdio transport)
tools/ 16 tool implementations
apps/ MCP Apps wiring, standalone store, cheatsheet
schemas/ Zod schemas and input limits
canvas-client.ts HTTP client for canvas server
index.ts MCP server entry point
canvas/ Canvas server (Express + WebSocket)
middleware/ Auth, CORS, rate limiting, audit, security headers
routes/ REST API routes + SVG export
ws/ WebSocket handler and protocol
store/ Element storage (memory + file)
index.ts Canvas server entry point
shared/ Shared config, types, logging
widget/ MCP Apps inline widget (Vite + singlefile build)
frontend/ Excalidraw React frontend (browser)
test/ Unit and integration tests (290 tests)Migrating from v1.x
Zero-config upgrade. All 14 original tools work identically -- create_view and read_me are additive. The canvas server is now optional (standalone mode activates automatically).
npm install -g excalidraw-mcp-server@2Existing MCP client configs (stdio transport, tool names) continue to work without changes.
License
Available Tools
16 toolsalign_elementsC
Align elements (left, center, right, top, middle, bottom)
Inputs: elementIds (required), alignment (required).
batch_create_elementsB
Create multiple elements at once (max 100)
Inputs: elements (required).
create_elementC
Create a single Excalidraw element on the canvas
Inputs: type (required), x (required), y (required), width, +13 more.
create_from_mermaidC
Convert a Mermaid diagram to Excalidraw elements
Inputs: mermaidDiagram (required), config.
create_viewCreate Excalidraw ViewA
Render Excalidraw elements as an interactive inline diagram. Pass an array of elements with type, x, y coordinates and optional styling. The diagram streams in progressively as elements are generated. Use read_me first to see available element types and color palettes.
Inputs: elements (required), title, background.
delete_elementC
Delete an Excalidraw element by ID
Inputs: id (required).
distribute_elementsC
Distribute elements evenly (horizontal or vertical)
Inputs: elementIds (required), direction (required).
export_sceneC
Export the canvas as PNG or SVG
Inputs: format (required), elementIds, background, padding.
get_resourceC
Get scene state, elements, theme, or library
Inputs: resource (required).
group_elementsC
Group multiple elements together
Inputs: elementIds (required).
lock_elementsC
Lock elements to prevent modification
Inputs: elementIds (required).
query_elementsC
Search for elements by type, locked status, or group ID
Inputs: type, locked, groupId.
read_meA
Get the Excalidraw element reference: types, colors, sizing, and tips. Call this before creating diagrams.
Inputs: no named parameters.
ungroup_elementsC
Remove elements from a group by group ID
Inputs: groupId (required).
unlock_elementsC
Unlock elements to allow modification
Inputs: elementIds (required).
update_elementC
Update an existing Excalidraw element by ID
Inputs: id (required), type, x, y, +14 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Most tools have distinct purposes, such as create_element vs. update_element vs. delete_element for element lifecycle, and align_elements vs. distribute_elements for layout. However, some overlap exists between lock_elements/unlock_elements and group_elements/ungroup_elements, which could cause minor confusion as they both manage element states, but descriptions clarify their specific actions.
Tool names follow a consistent verb_noun pattern throughout, such as create_element, delete_element, align_elements, and export_scene. All tools use snake_case, and verbs are clear and predictable, making the set easy to navigate and understand.
With 16 tools, the count is slightly high but reasonable for a diagramming server covering creation, manipulation, querying, and export. It includes core operations without being overly bloated, though it could be streamlined by merging some related tools like lock/unlock or group/ungroup.
The tool set provides comprehensive coverage for Excalidraw diagramming: full CRUD for elements (create, read via query_elements/get_resource, update, delete), layout tools (align, distribute), grouping and locking, import from Mermaid, export to PNG/SVG, and a reference guide. No obvious gaps exist for the domain.
Maintenance
Related MCP Connectors
Collaborative whiteboard MCP server — create objects, connectors, C4 diagrams, and manage boards
Zero-log MCP server with 49 tools for AI guardrails, secret scanning, MCP linting & EU compliance.
491Self-hosted MCP server: 26 deterministic dev, security, and EVM tools.
Cloud-hosted MCP server for durable AI memory
Related MCP Servers
- AlicenseBqualityBmaintenanceAn MCP server that generates beautiful Excalidraw architecture diagrams with perfect auto-layout, stateful editing, and architecture-aware component styling.226284 PyPI163MIT
- AlicenseAqualityCmaintenanceAn MCP server for Excalidraw diagram creation and headless rendering, enabling interactive canvas editing and automated SVG/PNG export via Playwright.41MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for live collaborative drawing on ExcaliDash, enabling diagram creation and editing with instant browser updates via Socket.IO.34 npmMIT
- AlicenseNot gradedqualityCmaintenanceMCP server for creating and managing Excalidraw diagrams, supporting elements, libraries, icons, import/export, and auto-layout flowcharts.3,392 npmMIT