Excalidraw

io.github.debu-sinha由 GitHub 账号 debu-sinha 发布v1.0.2更新于 Oct 24, 2026

Security-hardened Excalidraw MCP server with auth, rate limiting, and 14 tools

已验证STDIO仅桌面开发者工具媒体与设计

概览

AI 生成的概览

本地运行的 Excalidraw MCP 服务器,让助手以 Excalidraw 元素绘制、编辑、排版并导出图表,并在对话中内联渲染。

可以做什么
创建、更新、删除和查询图表元素,如矩形、椭圆、菱形、箭头、文本、线条和手绘笔迹,单次可批量创建最多 100 个元素。对元素进行分组、取消分组、对齐、均匀分布、锁定和解锁。将 Mermaid 图表转换为 Excalidraw 元素。把元素渲染为带流式动画的内联 SVG 组件,并将画布导出为 SVG 或 PNG。读取元素类型、颜色和尺寸建议的速查表。可选地在多个浏览器客户端之间实时同步同一画布。
适用场景
适合让助手直接在对话中生成架构图、流程图或草图,而不是用文字描述;也适合多个客户端协作编辑同一实时画布。多数用户使用独立模式即可,无需额外配置。
运行要求
通过 stdio 在本地运行,从 npm 安装 excalidraw-mcp-server 或用 npx 启动,需要 Node.js。独立模式不需要密钥或服务器。连接模式需另行启动可选的画布服务器,并在 EXCALIDRAW_API_KEY 中提供至少 32 个字符的 API 密钥,在 CANVAS_SERVER_URL 中填写画布地址;CORS_ALLOWED_ORIGINS、速率限制和持久化等通过环境变量配置。
安装前请注意
工具会创建、修改和删除图表元素;连接模式下多个客户端共用同一画布,改动会影响所有连接者。连接模式需要 EXCALIDRAW_API_KEY 密钥,请勿放入共享配置。可选的持久化会把画布状态写入本地目录。图表可导出到 excalidraw.com,这会把绘图内容发送到本机之外。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Excalidraw,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

excalidraw-mcp-server

The only Excalidraw MCP server with security hardening, inline diagram rendering, and real-time canvas sync.

[CI] [npm] [npm downloads] [License: MIT] [Node]

[Demo: architecture diagram being drawn element-by-element in real-time through WebSocket 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.

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

[Architecture: MCP clients connect via stdio to the server, which operates in standalone mode with an in-process store and inline widget, or in connected mode with a canvas server, WebSocket browser frontend, and file persistence]

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_me tool

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 endpoint
  • Helmet.js security headers with CSP

Infrastructure

  • Real-time WebSocket sync across browser clients
  • Optional atomic-write file persistence
  • Structured pino audit logging

Install

bash
npm install -g excalidraw-mcp-server

Or run directly:

bash
npx excalidraw-mcp-server

Quick start

Standalone (recommended for most users)

Just point your MCP client at the server. No canvas server needed.

json
{  "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)

bash
# Generate an API keynode scripts/generate-api-key.cjs
# Start the canvas serverEXCALIDRAW_API_KEY=<your-key> npm run canvas
# Open http://localhost:3000 to see the live canvas

Point your MCP client at the server with the same API key:

json
{  "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

ToolDescription
create_viewRender elements as an inline SVG widget with streaming animations (MCP Apps)
read_meGet the element reference cheatsheet (types, colors, sizing tips)
create_elementCreate a single element (rectangle, ellipse, diamond, arrow, text, line, freedraw)
update_elementUpdate an existing element by ID
delete_elementDelete an element by ID
query_elementsSearch elements by type, locked status, or group ID
get_resourceGet scene state, all elements, theme, or library
batch_create_elementsCreate up to 100 elements in one call
group_elementsGroup multiple elements together
ungroup_elementsRemove elements from a group
align_elementsAlign elements (left, center, right, top, middle, bottom)
distribute_elementsDistribute elements evenly (horizontal or vertical)
lock_elementsLock elements to prevent modification
unlock_elementsUnlock elements
create_from_mermaidConvert a Mermaid diagram to Excalidraw elements
export_sceneExport the canvas as SVG or PNG

Security comparison

FeatureTypical MCP serversexcalidraw-mcp-server
AuthenticationNoneAPI key (constant-time compare)
CORS* wildcardOrigin allowlist
WebSocket authNoneToken + origin validation
Rate limitingNoneStandard + strict tiers
Input validationMinimalBounded Zod with .strict()
Security headersNoneHelmet.js + CSP
Request size limitNone512KB body, 1MB WebSocket
Audit loggingNoneStructured pino logs

Configuration

All settings via environment variables. Copy .env.example to .env and adjust as needed.

VariableDefaultDescription
STANDALONE_MODEtrueUse in-process store (no canvas server needed)
CANVAS_HOST127.0.0.1Canvas server bind address
CANVAS_PORT3000Canvas server port
EXCALIDRAW_API_KEYAuto-generatedAPI key for auth (min 32 chars)
CORS_ALLOWED_ORIGINShttp://localhost:3000,http://127.0.0.1:3000Comma-separated origin allowlist
RATE_LIMIT_WINDOW_MS60000Rate limit window in milliseconds
RATE_LIMIT_MAX_REQUESTS100Max requests per window (standard tier)
PERSISTENCE_ENABLEDfalseEnable file-based persistence
PERSISTENCE_DIR./dataDirectory for persistent storage
CANVAS_SERVER_URLhttp://127.0.0.1:3000URL the MCP server uses to reach the canvas
LOG_LEVELinfoLog level: debug, info, warn, error
AUDIT_LOG_ENABLEDtrueEnable audit logging
MAX_ELEMENTS10000Maximum elements on canvas
MAX_BATCH_SIZE100Maximum elements per batch create

MCP client configuration

Claude Desktop

Add to claude_desktop_config.json:

json
{  "mcpServers": {    "excalidraw": {      "command": "npx",      "args": ["excalidraw-mcp-server"]    }  }}

Cursor

Add to .cursor/mcp.json in your project root:

json
{  "mcpServers": {    "excalidraw": {      "command": "npx",      "args": ["excalidraw-mcp-server"]    }  }}

VS Code

Add to your MCP settings:

json
{  "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

bash
# Install dependenciesnpm ci
# Run in development mode (watch + Vite dev server)npm run dev
# Run testsnpm test
# Run tests with coveragenpm run test:coverage
# Lintnpm run lint
# Type checknpm run type-check
# Build (server + widget + frontend)npm run build

Project 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, loggingwidget/             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).

bash
npm install -g excalidraw-mcp-server@2

Existing MCP client configs (stdio transport, tool names) continue to work without changes.

License

MIT

来源:README.md,提交 89c019d

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.2最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分