excalidraw-mcp
Enables AI agents to build, edit, organize, and export Excalidraw diagrams (architecture, flowcharts, etc.) entirely headless, producing .excalidraw files, SVG, and PNG renders.
README
excalidraw-mcp
An MCP (Model Context Protocol) server for Excalidraw. It lets an AI agent build, edit, organize, and export Excalidraw scenes — architecture diagrams, flowcharts, codebase maps, whiteboards — entirely headless, producing .excalidraw files you can open at excalidraw.com, plus SVG/PNG renders in Excalidraw's hand-drawn style.
<p align="center"><img src="examples/flowchart.png" width="420" alt="Flowchart generated by the smoke test" /></p>
Features
- Every element type: rectangles, ellipses, diamonds, text, lines, arrows, freedraw strokes, frames, embedded images, and embeddables (iframes)
- Real Excalidraw semantics: bound labels (text inside shapes / on arrows), arrow ↔ shape bindings that survive dragging in the UI, groups, frames, z-order, lock state, fractional indices
- One-shot diagrams:
create_flowchartlays out labeled nodes and bound edges automatically (layered layout,downorright) - Full editing surface: update, move, resize, duplicate (with binding remap), align, distribute, group, reorder, query
- Overlap-free by default: creation tools nudge new elements to free space (
avoidOverlap: falseto layer intentionally),resolve_overlapsspreads out colliding elements, and bound arrows re-route automatically after moves - Persistence & export:
.excalidrawfiles (v2),.excalidrawliblibraries, SVG and PNG rendering (roughjs + perfect-freehand, so it looks like Excalidraw) - All three MCP primitives: 42 tools, resources (
excalidraw://scenes,excalidraw://scene/{id},excalidraw://scene/{id}/svg), and prompts (architecture-diagram,flowchart,annotate-scene)
Setup
npm install
npm run build
Claude Code
claude mcp add excalidraw -- node /path/to/excalidraw-mcp/dist/index.js
(This repo also ships a project-scoped .mcp.json, so opening the repo in Claude Code registers the server automatically.)
Claude Desktop
// claude_desktop_config.json
{
"mcpServers": {
"excalidraw": {
"command": "node",
"args": ["/path/to/excalidraw-mcp/dist/index.js"]
}
}
}
Tools
| Group | Tools |
|---|---|
| Scenes | create_scene list_scenes switch_scene get_scene describe_scene clear_scene delete_scene set_app_state save_scene load_scene unlock_all |
| Create | add_shape add_text add_line add_arrow add_freedraw add_frame add_image add_embed add_elements |
| Edit | get_element find_elements update_element delete_elements duplicate_elements move_elements resize_element |
| Organize | connect_elements add_label group_elements ungroup_elements align_elements distribute_elements resolve_overlaps reorder_elements lock_elements add_to_frame |
| Export | export_svg export_png export_library import_library |
| Diagrams | create_flowchart |
Typical flow:
create_sceneadd_shape/add_text/create_flowchart, thenconnect_elementsto wire things updescribe_sceneto verifysave_scene→ open the.excalidrawfile at excalidraw.com, and/orexport_svg/export_pngfor a preview
Example — the whole auth flowchart above is one call:
{
"name": "create_flowchart",
"arguments": {
"nodes": [
{ "id": "start", "label": "Request", "shape": "ellipse", "backgroundColor": "#b2f2bb" },
{ "id": "auth", "label": "Authenticated?", "shape": "diamond", "backgroundColor": "#ffec99" },
{ "id": "handler", "label": "Route handler" },
{ "id": "reject", "label": "401 Unauthorized", "backgroundColor": "#ffc9c9" },
{ "id": "db", "label": "Database" }
],
"edges": [
{ "from": "start", "to": "auth" },
{ "from": "auth", "to": "handler", "label": "yes" },
{ "from": "auth", "to": "reject", "label": "no", "strokeStyle": "dashed" },
{ "from": "handler", "to": "db", "label": "query" }
]
}
}
Notes
- Coordinates: y grows downward; shapes are positioned by their top-left corner.
- PNG export uses the optional
@resvg/resvg-jsdependency; SVG export has no native dependencies. - Text sizing is estimated headlessly (~0.6em per character); Excalidraw re-measures precisely when a file is opened.
Development
npm run build # compile TypeScript
npm test # end-to-end smoke test (spawns the server with a real MCP client)
The smoke test writes example output (demo.excalidraw, flowchart.excalidraw, SVG/PNG renders, a .excalidrawlib) into examples/.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。