mcp-excalidraw-server 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/README.md +383 -358
  2. package/dist/frontend/assets/Assistant-Bold-gm-uSS1B.woff2 +0 -0
  3. package/dist/frontend/assets/Assistant-Medium-DrcxCXg3.woff2 +0 -0
  4. package/dist/frontend/assets/Assistant-Regular-DVxZuzxb.woff2 +0 -0
  5. package/dist/frontend/assets/Assistant-SemiBold-SCI4bEL9.woff2 +0 -0
  6. package/dist/frontend/assets/Tableau10-B-NsZVaP.js +1 -0
  7. package/dist/frontend/assets/_commonjs-dynamic-modules-TDtrdbi3.js +1 -0
  8. package/dist/frontend/assets/advancedFormat-BB0p-EFm.js +1 -0
  9. package/dist/frontend/assets/ar-SA-G6X2FPQ2-DQjC7E2l.js +10 -0
  10. package/dist/frontend/assets/arc-DeeplnFI.js +1 -0
  11. package/dist/frontend/assets/array-BKyUJesY.js +1 -0
  12. package/dist/frontend/assets/az-AZ-76LH7QW2-i2mid_KF.js +1 -0
  13. package/dist/frontend/assets/band-dPffDWoQ.js +1 -0
  14. package/dist/frontend/assets/bg-BG-XCXSNQG7-DEeQGR6G.js +5 -0
  15. package/dist/frontend/assets/blockDiagram-38ab4fdb-ft3Qmbnk.js +118 -0
  16. package/dist/frontend/assets/blockDiagram-68f4deed-BhATEkwK.js +118 -0
  17. package/dist/frontend/assets/bn-BD-2XOGV67Q-Cyoi_9HX.js +5 -0
  18. package/dist/frontend/assets/c4Diagram-15b5d702-D9y4gbPI.js +10 -0
  19. package/dist/frontend/assets/c4Diagram-3d4e48cf-JFijLclV.js +10 -0
  20. package/dist/frontend/assets/ca-ES-6MX7JW3Y-BVVWU1rs.js +8 -0
  21. package/dist/frontend/assets/channel-Cb5NStnu.js +1 -0
  22. package/dist/frontend/assets/classDiagram-70f12bd4-Ca9Kd1Ds.js +2 -0
  23. package/dist/frontend/assets/classDiagram-d40c83e7-Bq3MDvmx.js +2 -0
  24. package/dist/frontend/assets/classDiagram-v2-d5a6b087-o29qZ8vi.js +2 -0
  25. package/dist/frontend/assets/classDiagram-v2-f2320105-C9ex7BCO.js +2 -0
  26. package/dist/frontend/assets/clone-90Lq8jWj.js +1 -0
  27. package/dist/frontend/assets/createText-2e5e7dd3-FTBPE3EK.js +5 -0
  28. package/dist/frontend/assets/createText-d213de94-5nVTf_jC.js +5 -0
  29. package/dist/frontend/assets/cs-CZ-2BRQDIVT-BhMjw9tI.js +11 -0
  30. package/dist/frontend/assets/cytoscape-cose-bilkent-D2omlyvD.js +331 -0
  31. package/dist/frontend/assets/da-DK-5WZEPLOC-MfLFmlD6.js +5 -0
  32. package/dist/frontend/assets/de-DE-XR44H4JA-JhYak0I3.js +8 -0
  33. package/dist/frontend/assets/directory-open-01563666-DWU9wJ6I.js +1 -0
  34. package/dist/frontend/assets/directory-open-4ed118d0-BzWybGaI.js +1 -0
  35. package/dist/frontend/assets/edges-332bd1c7-DRJZgTC2.js +4 -0
  36. package/dist/frontend/assets/edges-e0da2a9e-BDwG7z0K.js +4 -0
  37. package/dist/frontend/assets/el-GR-BZB4AONW-Cdt2Ptk6.js +10 -0
  38. package/dist/frontend/assets/elk.bundled-D6I4pvAp.js +26 -0
  39. package/dist/frontend/assets/erDiagram-880f2ed8-C8waXJ0r.js +51 -0
  40. package/dist/frontend/assets/erDiagram-9861fffd-F9WuyAYm.js +51 -0
  41. package/dist/frontend/assets/es-ES-U4NZUMDT-C2-CtGrr.js +9 -0
  42. package/dist/frontend/assets/eu-ES-A7QVB2H4-CU_zCaYP.js +11 -0
  43. package/dist/frontend/assets/fa-IR-HGAKTJCU-Ck3uNCF1.js +8 -0
  44. package/dist/frontend/assets/fi-FI-Z5N7JZ37-B095Plv2.js +6 -0
  45. package/dist/frontend/assets/file-open-002ab408-DIuFHtCF.js +1 -0
  46. package/dist/frontend/assets/file-open-7c801643-684qeFg4.js +1 -0
  47. package/dist/frontend/assets/file-save-3189631c-x92wctJd.js +1 -0
  48. package/dist/frontend/assets/file-save-745eba88-Bb9F9Kg7.js +1 -0
  49. package/dist/frontend/assets/flowDb-7c981674-DuBfksmG.js +10 -0
  50. package/dist/frontend/assets/flowDb-956e92f1-CeLnP8Y5.js +10 -0
  51. package/dist/frontend/assets/flowDiagram-66a62f08-Bm4RJknB.js +4 -0
  52. package/dist/frontend/assets/flowDiagram-cbd28bf7-DGIWJa28.js +4 -0
  53. package/dist/frontend/assets/flowDiagram-v2-96b9c2cf-FcyWkMPn.js +1 -0
  54. package/dist/frontend/assets/flowDiagram-v2-ffc7f31a-BpjLoFsq.js +1 -0
  55. package/dist/frontend/assets/flowchart-elk-definition-36e2d292-Dpo4AMxk.js +114 -0
  56. package/dist/frontend/assets/flowchart-elk-definition-4a651766-ChOn_l6T.js +114 -0
  57. package/dist/frontend/assets/fr-FR-RHASNOE6-BqyLXGYl.js +9 -0
  58. package/dist/frontend/assets/ganttDiagram-04f9e578-CkdnwMOW.js +257 -0
  59. package/dist/frontend/assets/ganttDiagram-c361ad54-CJzn5gXR.js +257 -0
  60. package/dist/frontend/assets/gitGraphDiagram-21fc4d3e-CIOFS-AG.js +70 -0
  61. package/dist/frontend/assets/gitGraphDiagram-72cf32ee-Bcto3HlW.js +70 -0
  62. package/dist/frontend/assets/gl-ES-HMX3MZ6V-B7bR1uHP.js +10 -0
  63. package/dist/frontend/assets/graph-BHaTz2pM.js +1 -0
  64. package/dist/frontend/assets/graph-DsUM2NHp.js +1 -0
  65. package/dist/frontend/assets/he-IL-6SHJWFNN-DwXoH57J.js +10 -0
  66. package/dist/frontend/assets/hi-IN-IWLTKZ5I-D7SfqhT6.js +4 -0
  67. package/dist/frontend/assets/hu-HU-A5ZG7DT2-GZMnh_86.js +7 -0
  68. package/dist/frontend/assets/id-ID-SAP4L64H-CKj2F_pf.js +10 -0
  69. package/dist/frontend/assets/image-blob-reduce.esm-B6b2_-a4.js +7 -0
  70. package/dist/frontend/assets/index-3862675e-Bsb9vcL0.js +1 -0
  71. package/dist/frontend/assets/index-6079d271-Bvcb58DE.js +1 -0
  72. package/dist/frontend/assets/index-B9Rh8YyQ.css +1 -0
  73. package/dist/frontend/assets/index-C1JelwHC.js +349 -0
  74. package/dist/frontend/assets/index-CkitXLJb.js +87 -0
  75. package/dist/frontend/assets/index-DGmpr33w.js +3 -0
  76. package/dist/frontend/assets/infoDiagram-4a4f5b27-DYMh8eXF.js +7 -0
  77. package/dist/frontend/assets/infoDiagram-f8f76790-B2YXmH0v.js +7 -0
  78. package/dist/frontend/assets/init-Gi6I4Gst.js +1 -0
  79. package/dist/frontend/assets/it-IT-JPQ66NNP-woTcXUdD.js +11 -0
  80. package/dist/frontend/assets/ja-JP-DBVTYXUO-CGJZIn_N.js +8 -0
  81. package/dist/frontend/assets/journeyDiagram-29694f62-20n3n2ey.js +139 -0
  82. package/dist/frontend/assets/journeyDiagram-49397b02-Df2fBEZG.js +139 -0
  83. package/dist/frontend/assets/kaa-6HZHGXH3-BtBBG4jh.js +1 -0
  84. package/dist/frontend/assets/kab-KAB-ZGHBKWFO-CbxAj5W8.js +8 -0
  85. package/dist/frontend/assets/katex-ChWnQ-fc.js +261 -0
  86. package/dist/frontend/assets/kk-KZ-P5N5QNE5-fS-Upvvh.js +1 -0
  87. package/dist/frontend/assets/km-KH-HSX4SM5Z-BA1j7Xmb.js +11 -0
  88. package/dist/frontend/assets/ko-KR-MTYHY66A-CFvLJngn.js +9 -0
  89. package/dist/frontend/assets/ku-TR-6OUDTVRD-BkE-_tGQ.js +9 -0
  90. package/dist/frontend/assets/layout-D3_N-32k.js +1 -0
  91. package/dist/frontend/assets/layout-D56ApGxy.js +1 -0
  92. package/dist/frontend/assets/line-Dq_sNFvr.js +1 -0
  93. package/dist/frontend/assets/linear-BaWzW4O4.js +1 -0
  94. package/dist/frontend/assets/lt-LT-XHIRWOB4-BSnb0UTH.js +3 -0
  95. package/dist/frontend/assets/lv-LV-5QDEKY6T-CLjiMRc2.js +7 -0
  96. package/dist/frontend/assets/mindmap-definition-ac74a2e8-BY3Tg6Pe.js +95 -0
  97. package/dist/frontend/assets/mindmap-definition-fc14e90a-CLKKSvyA.js +95 -0
  98. package/dist/frontend/assets/mr-IN-CRQNXWMA-D9DBZK36.js +13 -0
  99. package/dist/frontend/assets/my-MM-5M5IBNSE-DpU38Yme.js +1 -0
  100. package/dist/frontend/assets/nb-NO-T6EIAALU-C510_VhX.js +10 -0
  101. package/dist/frontend/assets/nl-NL-IS3SIHDZ-CTxHa7fQ.js +8 -0
  102. package/dist/frontend/assets/nn-NO-6E72VCQL-BrJEF_cT.js +8 -0
  103. package/dist/frontend/assets/oc-FR-POXYY2M6-BQ6jh9ah.js +8 -0
  104. package/dist/frontend/assets/ordinal-Cboi1Yqb.js +1 -0
  105. package/dist/frontend/assets/pa-IN-N4M65BXN-DHhO4NEC.js +4 -0
  106. package/dist/frontend/assets/path-CbwjOpE9.js +1 -0
  107. package/dist/frontend/assets/pica-CofPkJ36.js +7 -0
  108. package/dist/frontend/assets/pie-lyWsw7iq.js +1 -0
  109. package/dist/frontend/assets/pieDiagram-421022e6-CT-muZCn.js +35 -0
  110. package/dist/frontend/assets/pieDiagram-8a3498a8-DtYj6G3V.js +35 -0
  111. package/dist/frontend/assets/pl-PL-T2D74RX3-CwxEKsFG.js +9 -0
  112. package/dist/frontend/assets/pt-BR-5N22H2LF-MbElHXpG.js +9 -0
  113. package/dist/frontend/assets/pt-PT-UZXXM6DQ-DM4vWcwF.js +9 -0
  114. package/dist/frontend/assets/quadrantDiagram-0957ecba-CblbtN7K.js +7 -0
  115. package/dist/frontend/assets/quadrantDiagram-120e2f19-jzz3ehZq.js +7 -0
  116. package/dist/frontend/assets/requirementDiagram-23d650b8-C-JoH6A7.js +52 -0
  117. package/dist/frontend/assets/requirementDiagram-deff3bca-Ctl4rNQu.js +52 -0
  118. package/dist/frontend/assets/ro-RO-JPDTUUEW-DdMtPkP_.js +11 -0
  119. package/dist/frontend/assets/roundRect-0PYZxl1G.js +1 -0
  120. package/dist/frontend/assets/ru-RU-B4JR7IUQ-DFOiB9Jg.js +9 -0
  121. package/dist/frontend/assets/sankeyDiagram-04a897e0-CUAS8b8U.js +8 -0
  122. package/dist/frontend/assets/sankeyDiagram-23345273-CjwxDsME.js +8 -0
  123. package/dist/frontend/assets/sankeyLinkHorizontal-DgqkLiUE.js +1 -0
  124. package/dist/frontend/assets/selectAll-BMyQi_9w.js +1 -0
  125. package/dist/frontend/assets/sequenceDiagram-17ac3bff-BhnIexBX.js +122 -0
  126. package/dist/frontend/assets/sequenceDiagram-704730f1-DZhrMzp5.js +122 -0
  127. package/dist/frontend/assets/si-LK-N5RQ5JYF-CoNWh4qU.js +1 -0
  128. package/dist/frontend/assets/sk-SK-C5VTKIMK-Cv5NV02v.js +6 -0
  129. package/dist/frontend/assets/sl-SI-NN7IZMDC-C_vlgIOB.js +6 -0
  130. package/dist/frontend/assets/stateDiagram-587899a1-CACHP_Jt.js +1 -0
  131. package/dist/frontend/assets/stateDiagram-9c5f0230-DsuPkPjh.js +1 -0
  132. package/dist/frontend/assets/stateDiagram-v2-51a3dcff-B5h534aI.js +1 -0
  133. package/dist/frontend/assets/stateDiagram-v2-d93cdb3a-Dm93b3N0.js +1 -0
  134. package/dist/frontend/assets/styles-2ab5d517-DsYBO0WP.js +116 -0
  135. package/dist/frontend/assets/styles-5f03d8d2-LS13RtPA.js +160 -0
  136. package/dist/frontend/assets/styles-6aaf32cf-KUcsVvLX.js +207 -0
  137. package/dist/frontend/assets/styles-9a916d00-BjTkeUBK.js +160 -0
  138. package/dist/frontend/assets/styles-c10674c1-0477ds-x.js +116 -0
  139. package/dist/frontend/assets/styles-edf9a4b0-DxfsUCVO.js +207 -0
  140. package/dist/frontend/assets/subset-shared.chunk.js +84 -0
  141. package/dist/frontend/assets/subset-worker.chunk.js +1 -0
  142. package/dist/frontend/assets/sv-SE-XGPEYMSR-BILGi8-a.js +10 -0
  143. package/dist/frontend/assets/svgDrawCommon-08f97a94-DK3eIkMD.js +1 -0
  144. package/dist/frontend/assets/svgDrawCommon-3ba9043b-CnkFvHbE.js +1 -0
  145. package/dist/frontend/assets/ta-IN-2NMHFXQM-B2-G7tUs.js +9 -0
  146. package/dist/frontend/assets/th-TH-HPSO5L25-BaOUPhiZ.js +2 -0
  147. package/dist/frontend/assets/timeline-definition-7e6b55e7-ChAZUdsQ.js +61 -0
  148. package/dist/frontend/assets/timeline-definition-85554ec2-FT1qcwfh.js +61 -0
  149. package/dist/frontend/assets/tr-TR-DEFEU3FU-_3NLP7we.js +7 -0
  150. package/dist/frontend/assets/uk-UA-QMV73CPH-e9ZZsONo.js +6 -0
  151. package/dist/frontend/assets/union-j7EoioKl.js +1 -0
  152. package/dist/frontend/assets/vi-VN-M7AON7JQ-Bl1etnNc.js +5 -0
  153. package/dist/frontend/assets/xml-BOsq7VnW.js +1 -0
  154. package/dist/frontend/assets/xychartDiagram-b6496bcd-DpRHtxW2.js +7 -0
  155. package/dist/frontend/assets/xychartDiagram-e933f94c-CePJDM-w.js +7 -0
  156. package/dist/frontend/assets/zh-CN-LNUGB5OW-BVkMlvEs.js +10 -0
  157. package/dist/frontend/assets/zh-HK-E62DVLB3-BMvPopwA.js +1 -0
  158. package/dist/frontend/assets/zh-TW-RAJ6MFWO-D_Eu0QQx.js +9 -0
  159. package/dist/frontend/assets/zipObject-DKSN1jwq.js +1 -0
  160. package/dist/frontend/index.html +285 -0
  161. package/dist/index.d.ts +4 -0
  162. package/dist/index.d.ts.map +1 -0
  163. package/dist/index.js +2058 -0
  164. package/dist/index.js.map +1 -0
  165. package/dist/server.d.ts +3 -0
  166. package/dist/server.d.ts.map +1 -0
  167. package/dist/server.js +1122 -0
  168. package/dist/server.js.map +1 -0
  169. package/dist/types.d.ts +228 -0
  170. package/dist/types.d.ts.map +1 -0
  171. package/dist/types.js +53 -0
  172. package/dist/types.js.map +1 -0
  173. package/dist/utils/logger.d.ts +4 -0
  174. package/dist/utils/logger.d.ts.map +1 -0
  175. package/dist/utils/logger.js +23 -0
  176. package/dist/utils/logger.js.map +1 -0
  177. package/package.json +48 -14
  178. package/src/index.ts +2330 -0
  179. package/src/server.ts +1286 -0
  180. package/src/types.ts +338 -0
  181. package/src/utils/logger.ts +33 -0
  182. package/src/index.js +0 -1027
  183. package/src/types.js +0 -35
  184. package/src/utils/logger.js +0 -27
package/README.md CHANGED
@@ -1,479 +1,504 @@
1
- # MCP Excalidraw Server: Advanced Live Visual Diagramming with AI Integration
1
+ # Excalidraw MCP Server & Agent Skill
2
2
 
3
- A comprehensive system that combines **Excalidraw's powerful drawing capabilities** with **Model Context Protocol (MCP)** integration, enabling AI agents to create and manipulate diagrams in real-time on a live canvas.
3
+ [![CI](https://github.com/yctimlin/mcp_excalidraw/actions/workflows/ci.yml/badge.svg)](https://github.com/yctimlin/mcp_excalidraw/actions/workflows/ci.yml)
4
+ [![Docker Build & Push](https://github.com/yctimlin/mcp_excalidraw/actions/workflows/docker.yml/badge.svg)](https://github.com/yctimlin/mcp_excalidraw/actions/workflows/docker.yml)
5
+ [![NPM Version](https://img.shields.io/npm/v/mcp-excalidraw-server)](https://www.npmjs.com/package/mcp-excalidraw-server)
6
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
4
7
 
5
- ## 🏛️ Architecture Overview
8
+ Run a live Excalidraw canvas and control it from AI agents. This repo provides:
6
9
 
7
- This project is now structured as **two independent components**:
10
+ - **MCP Server**: Connect via Model Context Protocol (Claude Desktop, Cursor, Codex CLI, etc.)
11
+ - **Agent Skill**: Portable skill for Claude Code, Codex CLI, and other skill-enabled agents
8
12
 
9
- ### **1. MCP Server (Standalone)**
10
- - **Location**: Main directory (`src/index.js`, `src/types.js`)
11
- - **Purpose**: Standalone MCP server that can be published as an npm package
12
- - **Features**: Creates elements locally, optional canvas sync
13
- - **Dependencies**: Minimal (only MCP SDK, dotenv, node-fetch, winston, zod)
13
+ Keywords: Excalidraw agent skill, Excalidraw MCP server, AI diagramming, Claude Code skill, Codex CLI skill, Claude Desktop MCP, Cursor MCP, Mermaid to Excalidraw.
14
14
 
15
- ### **2. Frontend (Optional)**
16
- - **Location**: `frontend/` directory
17
- - **Purpose**: Real-time canvas interface with WebSocket synchronization
18
- - **Features**: Live canvas, WebSocket updates, RESTful API
19
- - **Dependencies**: React, Excalidraw, Express, WebSocket
15
+ ## Demo
20
16
 
21
- ```
22
- ┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
23
- │ AI Agent │───▶│ MCP Server │───▶│ Canvas Server │
24
- │ (Claude) │ │ (src/index.js) │ │ (frontend/) │
25
- └─────────────────┘ └──────────────────┘ └─────────────────┘
26
- │ │ │
27
- │ │ ▼
28
- │ │ ┌─────────────────┐
29
- │ │ │ Frontend │
30
- │ │ │ (React + WS) │
31
- │ │ └─────────────────┘
32
- │ │
33
- │ ▼
34
- │ ┌─────────────────┐
35
- │ │ Local Storage │
36
- │ │ (elements) │
37
- │ └─────────────────┘
38
-
39
- └─────────────────────────────────────────────────────────┘
40
- (Works standalone without frontend)
41
- ```
42
-
43
- ## 🚀 What This System Does
44
-
45
- - **🎨 Live Canvas**: Real-time Excalidraw canvas accessible via web browser (with frontend)
46
- - **🤖 AI Integration**: MCP server allows AI agents (like Claude) to create visual diagrams
47
- - **⚡ Real-time Sync**: Elements created via MCP API appear instantly on the canvas (with frontend)
48
- - **🔄 WebSocket Updates**: Live synchronization across multiple connected clients (with frontend)
49
- - **🏗️ Standalone Mode**: MCP server works independently for local element creation
50
-
51
- ## 🎥 Demo Video
17
+ ![MCP Excalidraw Demo](demo.gif)
52
18
 
53
- > **See MCP Excalidraw in Action!**
19
+ *AI agent creates a complete architecture diagram from a single prompt (4x speed). [Watch full video on YouTube](https://youtu.be/ufW78Amq5qA)*
54
20
 
55
- [![MCP Excalidraw Demo](https://img.youtube.com/vi/RRN7AF7QIew/maxresdefault.jpg)](https://youtu.be/RRN7AF7QIew)
21
+ ## Table of Contents
56
22
 
57
- *Watch how AI agents create and manipulate diagrams in real-time on the live canvas*
23
+ - [Demo](#demo)
24
+ - [What It Is](#what-it-is)
25
+ - [How We Differ from the Official Excalidraw MCP](#how-we-differ-from-the-official-excalidraw-mcp)
26
+ - [What's New](#whats-new)
27
+ - [Quick Start (Local)](#quick-start-local)
28
+ - [Quick Start (Docker)](#quick-start-docker)
29
+ - [Configure MCP Clients](#configure-mcp-clients)
30
+ - [Claude Desktop](#claude-desktop)
31
+ - [Claude Code](#claude-code)
32
+ - [Cursor](#cursor)
33
+ - [Codex CLI](#codex-cli)
34
+ - [OpenCode](#opencode)
35
+ - [Antigravity (Google)](#antigravity-google)
36
+ - [Agent Skill (Optional)](#agent-skill-optional)
37
+ - [MCP Tools (26 Total)](#mcp-tools-26-total)
38
+ - [Testing](#testing)
39
+ - [Troubleshooting](#troubleshooting)
40
+ - [Known Issues / TODO](#known-issues--todo)
41
+ - [Development](#development)
58
42
 
59
- ## 🌟 Key Features
43
+ ## What It Is
60
44
 
61
- ### **Standalone MCP Server**
62
- - Works independently without frontend dependencies
63
- - Creates and manages elements locally
64
- - Optional canvas synchronization when frontend is available
65
- - Can be published as an npm package
45
+ This repo contains two separate processes:
66
46
 
67
- ### **Real-time Canvas Integration** (with frontend)
68
- - Elements created via MCP appear instantly on the live canvas
69
- - WebSocket-based real-time synchronization
70
- - Multi-client support with live updates
47
+ - Canvas server: web UI + REST API + WebSocket updates (default `http://127.0.0.1:3000`)
48
+ - MCP server: exposes MCP tools over stdio; syncs to the canvas via `EXPRESS_SERVER_URL`
71
49
 
72
- ### **Production-Ready Interface** (with frontend)
73
- - Clean, minimal UI with connection status
74
- - Simple "Clear Canvas" functionality
75
- - No development clutter or debug information
50
+ ## How We Differ from the Official Excalidraw MCP
76
51
 
77
- ### **Comprehensive MCP API**
78
- - **Element Creation**: rectangles, ellipses, diamonds, arrows, text, lines
79
- - **Element Management**: update, delete, query with filters
80
- - **Batch Operations**: create multiple elements in one call
81
- - **Advanced Features**: grouping, alignment, distribution, locking
52
+ Excalidraw now has an [official MCP](https://github.com/excalidraw/excalidraw-mcp) — it's great for quick, prompt-to-diagram generation rendered inline in chat. We solve a different problem.
82
53
 
83
- ### **Robust Architecture**
84
- - Express.js backend with REST API + WebSocket (frontend)
85
- - React frontend with official Excalidraw package (frontend)
86
- - Dual-path element loading for reliability
87
- - Auto-reconnection and error handling
54
+ | | Official Excalidraw MCP | This Project |
55
+ |---|---|---|
56
+ | **Approach** | Prompt in, diagram out (one-shot) | Programmatic element-level control (26 tools) |
57
+ | **State** | Stateless each call is independent | Persistent live canvas with real-time sync |
58
+ | **Element CRUD** | No | Full create / read / update / delete per element |
59
+ | **AI sees the canvas** | No | `describe_scene` (structured text) + `get_canvas_screenshot` (image) |
60
+ | **Iterative refinement** | No — regenerate the whole diagram | Draw → look → adjust → look again, element by element |
61
+ | **Layout tools** | No | `align_elements`, `distribute_elements`, `group / ungroup` |
62
+ | **File I/O** | No | `export_scene` / `import_scene` (.excalidraw JSON) |
63
+ | **Snapshot & rollback** | No | `snapshot_scene` / `restore_snapshot` |
64
+ | **Mermaid conversion** | No | `create_from_mermaid` |
65
+ | **Shareable URLs** | Yes | Yes — `export_to_excalidraw_url` |
66
+ | **Design guide** | `read_me` cheat sheet | `read_diagram_guide` (colors, sizing, layout, anti-patterns) |
67
+ | **Viewport control** | Camera animations | `set_viewport` (zoom-to-fit, center on element, manual zoom) |
68
+ | **Live canvas UI** | Rendered inline in chat | Standalone Excalidraw app synced via WebSocket |
69
+ | **Multi-agent** | Single user | Multiple agents can draw on the same canvas concurrently |
70
+ | **Works without MCP** | No | Yes — REST API fallback via agent skill |
88
71
 
89
- ## 📦 Installation & Setup
72
+ **TL;DR** The official MCP generates diagrams. We give AI agents a full canvas toolkit to build, inspect, and iteratively refine diagrams — including the ability to see what they drew.
90
73
 
91
- ### **✅ Option 1: MCP Server Only (Standalone)**
74
+ ## What's New
92
75
 
93
- Use this if you only need the MCP server functionality without the visual canvas.
76
+ ### v2.0 Canvas Toolkit
94
77
 
95
- #### **1. Clone the Repository**
96
- ```bash
97
- git clone https://github.com/yctimlin/mcp_excalidraw.git
98
- cd mcp_excalidraw
99
- npm install
100
- ```
101
-
102
- #### **2. Start the MCP Server**
103
- ```bash
104
- npm start
105
- ```
78
+ - 13 new MCP tools (26 total): `get_element`, `clear_canvas`, `export_scene`, `import_scene`, `export_to_image`, `duplicate_elements`, `snapshot_scene`, `restore_snapshot`, `describe_scene`, `get_canvas_screenshot`, `read_diagram_guide`, `export_to_excalidraw_url`, `set_viewport`
79
+ - **Closed feedback loop**: AI can now inspect the canvas (`describe_scene`) and see it (`get_canvas_screenshot` returns an image) — enabling iterative refinement
80
+ - **Design guide**: `read_diagram_guide` returns best-practice color palettes, sizing rules, layout patterns, and anti-patterns — dramatically improves AI-generated diagram quality
81
+ - **Shareable URLs**: `export_to_excalidraw_url` encrypts and uploads the scene to excalidraw.com, returns a shareable link anyone can open
82
+ - **Viewport control**: `set_viewport` with `scrollToContent`, `scrollToElementId`, or manual zoom/offset — agents can auto-fit diagrams after creation
83
+ - **File I/O**: export/import full `.excalidraw` JSON files
84
+ - **Snapshots**: save and restore named canvas states
85
+ - **Skill fallback**: Agent skill auto-detects MCP vs REST API mode, gracefully falls back to HTTP endpoints when MCP server isn't configured
86
+ - Fixed all previously known issues: `align_elements` / `distribute_elements` fully implemented, points type normalization, removed invalid `label` type, removed HTTP transport dead code, `ungroup_elements` now errors on failure
106
87
 
107
- The MCP server will run and create elements locally. Set `ENABLE_CANVAS_SYNC=false` to disable canvas synchronization attempts.
88
+ ### v1.x
108
89
 
109
- ### **✅ Option 2: MCP Server + Frontend (Full System)**
90
+ - Agent skill: `skills/excalidraw-skill/` (portable instructions + helper scripts for export/import and repeatable CRUD)
91
+ - Better testing loop: MCP Inspector CLI examples + browser screenshot checks (`agent-browser`)
92
+ - Bugfixes: batch create now preserves element ids (fixes update/delete after batch); frontend entrypoint fixed (`main.tsx`)
110
93
 
111
- Use this for the complete system with live canvas visualization.
94
+ ## Quick Start (Local)
112
95
 
113
- #### **1. Clone and Setup Main Package**
114
- ```bash
115
- git clone https://github.com/yctimlin/mcp_excalidraw.git
116
- cd mcp_excalidraw
117
- npm install
118
- ```
96
+ Prereqs: Node >= 18, npm
119
97
 
120
- #### **2. Setup Frontend**
121
98
  ```bash
122
- cd frontend
123
- npm install
99
+ npm ci
124
100
  npm run build
125
101
  ```
126
102
 
127
- #### **3. Start the System**
128
-
129
- ##### **Option A: Production Mode (Recommended)**
103
+ Terminal 1: start the canvas
130
104
  ```bash
131
- # Terminal 1: Start frontend server
132
- cd frontend
133
- npm start
134
-
135
- # Terminal 2: Start MCP server (in main directory)
136
- cd ..
137
- npm start
105
+ PORT=3000 npm run canvas
138
106
  ```
139
107
 
140
- ##### **Option B: Development Mode**
141
- ```bash
142
- # Terminal 1: Start frontend in dev mode
143
- cd frontend
144
- npm run dev
108
+ > **Security note:** The server defaults to binding on `127.0.0.1` only. If you need to expose it on a network interface (e.g. Docker, remote access), set `HOST=0.0.0.0` — but ensure you have network-level access controls in place, as the API has no built-in authentication.
145
109
 
146
- # Terminal 2: Start MCP server (in main directory)
147
- cd ..
148
- npm start
149
- ```
110
+ Open `http://127.0.0.1:3000`.
150
111
 
151
- #### **4. Access the Canvas**
152
- Open your browser and navigate to:
153
- ```
154
- http://localhost:3000
112
+ Terminal 2: run the MCP server (stdio)
113
+ ```bash
114
+ EXPRESS_SERVER_URL=http://127.0.0.1:3000 node dist/index.js
155
115
  ```
156
116
 
157
- ### **🐳 Option 3: Docker (Full System)**
158
-
159
- Use Docker Compose to run both components:
117
+ ## Quick Start (Docker)
160
118
 
119
+ Canvas server:
161
120
  ```bash
162
- docker-compose up
121
+ docker run -d -p 3000:3000 --name mcp-excalidraw-canvas ghcr.io/yctimlin/mcp_excalidraw-canvas:latest
163
122
  ```
164
123
 
165
- This will start both the MCP server and frontend in containers.
124
+ MCP server (stdio) is typically launched by your MCP client (Claude Desktop/Cursor/etc.). If you want a local container for it, use the image `ghcr.io/yctimlin/mcp_excalidraw:latest` and set `EXPRESS_SERVER_URL` to point at the canvas.
125
+
126
+ ## Configure MCP Clients
166
127
 
167
- ## 🔧 Available Scripts
128
+ The MCP server runs over stdio and can be configured with any MCP-compatible client. Below are configurations for both **local** (requires cloning and building) and **Docker** (pull-and-run) setups.
168
129
 
169
- ### **Main Package (MCP Server)**
170
- | Script | Description |
171
- |--------|-------------|
172
- | `npm start` | Start MCP server (`src/index.js`) |
130
+ ### Environment Variables
173
131
 
174
- ### **Frontend Package**
175
- | Script | Description |
176
- |--------|-------------|
177
- | `npm start` | Start Express server (`server.js`) |
178
- | `npm run build` | Build React frontend for production |
179
- | `npm run dev` | Start Express + Vite dev server |
180
- | `npm run preview` | Preview built frontend |
132
+ | Variable | Description | Default |
133
+ |----------|-------------|---------|
134
+ | `EXPRESS_SERVER_URL` | URL of the canvas server | `http://127.0.0.1:3000` |
135
+ | `ENABLE_CANVAS_SYNC` | Enable real-time canvas sync | `true` |
181
136
 
182
- ## 🎯 Usage Guide
137
+ ---
183
138
 
184
- ### **For End Users**
185
- 1. Open the canvas at `http://localhost:3000` (if using frontend)
186
- 2. Check connection status (should show "Connected")
187
- 3. AI agents can now create diagrams that appear in real-time
188
- 4. Use "Clear Canvas" to remove all elements
139
+ ### Claude Desktop
189
140
 
190
- ### **For AI Agents (via MCP)**
191
- The MCP server provides these tools for creating visual diagrams:
141
+ Config location:
142
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
143
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
144
+ - Linux: `~/.config/Claude/claude_desktop_config.json`
192
145
 
193
- #### **Basic Element Creation**
194
- ```javascript
195
- // Create a rectangle
146
+ **Local (node)**
147
+ ```json
196
148
  {
197
- "type": "rectangle",
198
- "x": 100,
199
- "y": 100,
200
- "width": 200,
201
- "height": 100,
202
- "backgroundColor": "#e3f2fd",
203
- "strokeColor": "#1976d2",
204
- "strokeWidth": 2
149
+ "mcpServers": {
150
+ "excalidraw": {
151
+ "command": "node",
152
+ "args": ["/absolute/path/to/mcp_excalidraw/dist/index.js"],
153
+ "env": {
154
+ "EXPRESS_SERVER_URL": "http://127.0.0.1:3000",
155
+ "ENABLE_CANVAS_SYNC": "true"
156
+ }
157
+ }
158
+ }
205
159
  }
206
160
  ```
207
161
 
208
- #### **Create Text Elements**
209
- ```javascript
162
+ **Docker**
163
+ ```json
210
164
  {
211
- "type": "text",
212
- "x": 150,
213
- "y": 125,
214
- "text": "Process Step",
215
- "fontSize": 16,
216
- "strokeColor": "#333333"
165
+ "mcpServers": {
166
+ "excalidraw": {
167
+ "command": "docker",
168
+ "args": [
169
+ "run", "-i", "--rm",
170
+ "-e", "EXPRESS_SERVER_URL=http://host.docker.internal:3000",
171
+ "-e", "ENABLE_CANVAS_SYNC=true",
172
+ "ghcr.io/yctimlin/mcp_excalidraw:latest"
173
+ ]
174
+ }
175
+ }
217
176
  }
218
177
  ```
219
178
 
220
- #### **Create Arrows & Lines**
221
- ```javascript
222
- {
223
- "type": "arrow",
224
- "x": 300,
225
- "y": 130,
226
- "width": 100,
227
- "height": 0,
228
- "strokeColor": "#666666",
229
- "strokeWidth": 2
230
- }
179
+ ---
180
+
181
+ ### Claude Code
182
+
183
+ Use the `claude mcp add` command to register the MCP server.
184
+
185
+ **Local (node)** - User-level (available across all projects):
186
+ ```bash
187
+ claude mcp add excalidraw --scope user \
188
+ -e EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
189
+ -e ENABLE_CANVAS_SYNC=true \
190
+ -- node /absolute/path/to/mcp_excalidraw/dist/index.js
231
191
  ```
232
192
 
233
- #### **Batch Creation for Complex Diagrams**
234
- ```javascript
235
- {
236
- "elements": [
237
- {
238
- "type": "rectangle",
239
- "x": 100,
240
- "y": 100,
241
- "width": 120,
242
- "height": 60,
243
- "backgroundColor": "#fff3e0",
244
- "strokeColor": "#ff9800"
245
- },
246
- {
247
- "type": "text",
248
- "x": 130,
249
- "y": 125,
250
- "text": "Start",
251
- "fontSize": 16
252
- }
253
- ]
254
- }
193
+ **Local (node)** - Project-level (shared via `.mcp.json`):
194
+ ```bash
195
+ claude mcp add excalidraw --scope project \
196
+ -e EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
197
+ -e ENABLE_CANVAS_SYNC=true \
198
+ -- node /absolute/path/to/mcp_excalidraw/dist/index.js
255
199
  ```
256
200
 
257
- ## 🔌 Integration with Claude Desktop
201
+ **Docker**
202
+ ```bash
203
+ claude mcp add excalidraw --scope user \
204
+ -- docker run -i --rm \
205
+ -e EXPRESS_SERVER_URL=http://host.docker.internal:3000 \
206
+ -e ENABLE_CANVAS_SYNC=true \
207
+ ghcr.io/yctimlin/mcp_excalidraw:latest
208
+ ```
209
+
210
+ **Manage servers:**
211
+ ```bash
212
+ claude mcp list # List configured servers
213
+ claude mcp remove excalidraw # Remove a server
214
+ ```
258
215
 
259
- ### **✅ Recommended: Using Local Installation**
216
+ ---
260
217
 
261
- For the **local development version** (most stable), add this configuration to your `claude_desktop_config.json`:
218
+ ### Cursor
262
219
 
220
+ Config location: `.cursor/mcp.json` in your project root (or `~/.cursor/mcp.json` for global config)
221
+
222
+ **Local (node)**
263
223
  ```json
264
224
  {
265
225
  "mcpServers": {
266
226
  "excalidraw": {
267
227
  "command": "node",
268
- "args": ["/absolute/path/to/mcp_excalidraw/src/index.js"]
228
+ "args": ["/absolute/path/to/mcp_excalidraw/dist/index.js"],
229
+ "env": {
230
+ "EXPRESS_SERVER_URL": "http://127.0.0.1:3000",
231
+ "ENABLE_CANVAS_SYNC": "true"
232
+ }
233
+ }
234
+ }
235
+ }
236
+ ```
237
+
238
+ **Docker**
239
+ ```json
240
+ {
241
+ "mcpServers": {
242
+ "excalidraw": {
243
+ "command": "docker",
244
+ "args": [
245
+ "run", "-i", "--rm",
246
+ "-e", "EXPRESS_SERVER_URL=http://host.docker.internal:3000",
247
+ "-e", "ENABLE_CANVAS_SYNC=true",
248
+ "ghcr.io/yctimlin/mcp_excalidraw:latest"
249
+ ]
269
250
  }
270
251
  }
271
252
  }
272
253
  ```
273
254
 
274
- **Important**: Replace `/absolute/path/to/mcp_excalidraw` with the actual absolute path to your cloned repository.
255
+ ---
256
+
257
+ ### Codex CLI
275
258
 
276
- ### **🔧 Alternative Configurations (Beta)**
259
+ Use the `codex mcp add` command to register the MCP server.
277
260
 
278
- #### **NPM Package (Beta Testing)**
261
+ **Local (node)**
262
+ ```bash
263
+ codex mcp add excalidraw \
264
+ --env EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
265
+ --env ENABLE_CANVAS_SYNC=true \
266
+ -- node /absolute/path/to/mcp_excalidraw/dist/index.js
267
+ ```
268
+
269
+ **Docker**
270
+ ```bash
271
+ codex mcp add excalidraw \
272
+ -- docker run -i --rm \
273
+ -e EXPRESS_SERVER_URL=http://host.docker.internal:3000 \
274
+ -e ENABLE_CANVAS_SYNC=true \
275
+ ghcr.io/yctimlin/mcp_excalidraw:latest
276
+ ```
277
+
278
+ **Manage servers:**
279
+ ```bash
280
+ codex mcp list # List configured servers
281
+ codex mcp remove excalidraw # Remove a server
282
+ ```
283
+
284
+ ---
285
+
286
+ ### OpenCode
287
+
288
+ Config location: `~/.config/opencode/opencode.json` or project-level `opencode.json`
289
+
290
+ **Local (node)**
279
291
  ```json
280
292
  {
281
- "mcpServers": {
293
+ "$schema": "https://opencode.ai/config.json",
294
+ "mcp": {
282
295
  "excalidraw": {
283
- "command": "npx",
284
- "args": ["-y", "mcp-excalidraw-server"]
296
+ "type": "local",
297
+ "command": ["node", "/absolute/path/to/mcp_excalidraw/dist/index.js"],
298
+ "enabled": true,
299
+ "environment": {
300
+ "EXPRESS_SERVER_URL": "http://127.0.0.1:3000",
301
+ "ENABLE_CANVAS_SYNC": "true"
302
+ }
285
303
  }
286
304
  }
287
305
  }
288
306
  ```
289
- *Currently debugging tool registration - let us know if you encounter issues!*
290
307
 
291
- #### **Docker Version (Coming Soon)**
308
+ **Docker**
292
309
  ```json
293
310
  {
294
- "mcpServers": {
311
+ "$schema": "https://opencode.ai/config.json",
312
+ "mcp": {
295
313
  "excalidraw": {
296
- "command": "docker",
297
- "args": ["run", "-i", "--rm", "mcp-excalidraw-server"]
314
+ "type": "local",
315
+ "command": ["docker", "run", "-i", "--rm", "-e", "EXPRESS_SERVER_URL=http://host.docker.internal:3000", "-e", "ENABLE_CANVAS_SYNC=true", "ghcr.io/yctimlin/mcp_excalidraw:latest"],
316
+ "enabled": true
298
317
  }
299
318
  }
300
319
  }
301
320
  ```
302
- *Canvas sync improvements in progress.*
303
321
 
304
- ## 🔧 Integration with Other Tools
322
+ ---
305
323
 
306
- ### **Cursor IDE**
324
+ ### Antigravity (Google)
307
325
 
308
- Add to your `.cursor/mcp.json`:
326
+ Config location: `~/.gemini/antigravity/mcp_config.json`
309
327
 
328
+ **Local (node)**
310
329
  ```json
311
330
  {
312
331
  "mcpServers": {
313
332
  "excalidraw": {
314
333
  "command": "node",
315
- "args": ["/absolute/path/to/mcp_excalidraw/src/index.js"]
334
+ "args": ["/absolute/path/to/mcp_excalidraw/dist/index.js"],
335
+ "env": {
336
+ "EXPRESS_SERVER_URL": "http://127.0.0.1:3000",
337
+ "ENABLE_CANVAS_SYNC": "true"
338
+ }
316
339
  }
317
340
  }
318
341
  }
319
342
  ```
320
343
 
321
- ### **VS Code MCP Extension**
322
-
323
- For VS Code MCP extension, add to your settings:
324
-
344
+ **Docker**
325
345
  ```json
326
346
  {
327
- "mcp": {
328
- "servers": {
329
- "excalidraw": {
330
- "command": "node",
331
- "args": ["/absolute/path/to/mcp_excalidraw/src/index.js"]
332
- }
347
+ "mcpServers": {
348
+ "excalidraw": {
349
+ "command": "docker",
350
+ "args": [
351
+ "run", "-i", "--rm",
352
+ "-e", "EXPRESS_SERVER_URL=http://host.docker.internal:3000",
353
+ "-e", "ENABLE_CANVAS_SYNC=true",
354
+ "ghcr.io/yctimlin/mcp_excalidraw:latest"
355
+ ]
333
356
  }
334
357
  }
335
358
  }
336
359
  ```
337
360
 
338
- ## 🛠️ Environment Variables
339
-
340
- | Variable | Default | Description |
341
- |----------|---------|-------------|
342
- | `EXPRESS_SERVER_URL` | `http://localhost:3000` | Canvas server URL for MCP sync |
343
- | `ENABLE_CANVAS_SYNC` | `true` | Enable/disable canvas synchronization |
344
- | `DEBUG` | `false` | Enable debug logging |
345
- | `PORT` | `3000` | Canvas server port |
346
- | `HOST` | `localhost` | Canvas server host |
347
-
348
- ## 📊 API Endpoints
349
-
350
- The canvas server provides these REST endpoints:
351
-
352
- | Method | Endpoint | Description |
353
- |--------|----------|-------------|
354
- | `GET` | `/api/elements` | Get all elements |
355
- | `POST` | `/api/elements` | Create new element |
356
- | `PUT` | `/api/elements/:id` | Update element |
357
- | `DELETE` | `/api/elements/:id` | Delete element |
358
- | `POST` | `/api/elements/batch` | Create multiple elements |
359
- | `GET` | `/health` | Server health check |
360
-
361
- ## 🎨 MCP Tools Available
362
-
363
- ### **Element Management**
364
- - `create_element` - Create any type of Excalidraw element
365
- - `update_element` - Modify existing elements
366
- - `delete_element` - Remove elements
367
- - `query_elements` - Search elements with filters
368
-
369
- ### **Batch Operations**
370
- - `batch_create_elements` - Create complex diagrams in one call
371
-
372
- ### **Element Organization**
373
- - `group_elements` - Group multiple elements
374
- - `ungroup_elements` - Ungroup element groups
375
- - `align_elements` - Align elements (left, center, right, top, middle, bottom)
376
- - `distribute_elements` - Distribute elements evenly
377
- - `lock_elements` / `unlock_elements` - Lock/unlock elements
378
-
379
- ### **Resource Access**
380
- - `get_resource` - Access scene, library, theme, or elements data
381
-
382
- ## 🏗️ Development Architecture
383
-
384
- ### **Frontend** (`frontend/src/`)
385
- - **React + Vite**: Modern build system
386
- - **Official Excalidraw**: `@excalidraw/excalidraw` package
387
- - **WebSocket Client**: Real-time element sync
388
- - **Clean UI**: Production-ready interface
389
-
390
- ### **Canvas Server** (`src/server.js`)
391
- - **Express.js**: REST API + static file serving
392
- - **WebSocket**: Real-time client communication
393
- - **Element Storage**: In-memory with persistence options
394
- - **CORS**: Cross-origin support
395
-
396
- ### **MCP Server** (`src/index.js`)
397
- - **MCP Protocol**: Standard Model Context Protocol
398
- - **Canvas Sync**: HTTP requests to canvas server
399
- - **Element Management**: Full CRUD operations
400
- - **Batch Support**: Complex diagram creation
401
-
402
- ## 🐛 Troubleshooting
403
-
404
- ### **NPM Package Issues**
405
- - **Symptoms**: MCP tools not registering properly
406
- - **Temporary Solution**: Use local development setup
407
- - **Status**: Actively debugging - updates coming soon
408
-
409
- ### **Docker Version Notes**
410
- - **Symptoms**: Elements may not sync to canvas immediately
411
- - **Temporary Solution**: Use local development setup
412
- - **Status**: Improving synchronization reliability
413
-
414
- ### **Canvas Not Loading**
415
- - Ensure `npm run build` completed successfully
416
- - Check that `dist/index.html` exists
417
- - Verify canvas server is running on port 3000
418
-
419
- ### **Elements Not Syncing**
420
- - Confirm MCP server is running (`npm start`)
421
- - Check `ENABLE_CANVAS_SYNC=true` in environment
422
- - Verify canvas server is accessible at `EXPRESS_SERVER_URL`
423
-
424
- ### **WebSocket Connection Issues**
425
- - Check browser console for WebSocket errors
426
- - Ensure no firewall blocking WebSocket connections
427
- - Try refreshing the browser page
428
-
429
- ### **Build Errors**
430
- - Delete `node_modules` and run `npm install`
431
- - Check Node.js version (requires 16+)
432
- - Ensure all dependencies are installed
433
-
434
- ## 📋 Project Structure
361
+ ---
362
+
363
+ ### Notes
364
+
365
+ - **Docker networking**: Use `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`.
366
+ - **Canvas server**: Must be running before the MCP server connects. Start it with `npm run canvas` (local) or `docker run -d -p 3000:3000 ghcr.io/yctimlin/mcp_excalidraw-canvas:latest` (Docker).
367
+ - **Absolute paths**: When using local node setup, replace `/absolute/path/to/mcp_excalidraw` with the actual path where you cloned and built the repo.
368
+ - **In-memory storage**: The canvas server stores elements in memory. Restarting the server will clear all elements. Use the export/import scripts if you need persistence.
369
+
370
+ ## Agent Skill (Optional)
371
+
372
+ This repo includes a skill at `skills/excalidraw-skill/` that provides:
373
+
374
+ - **Workflow playbook** (`SKILL.md`): step-by-step guidance for drawing, refining, and exporting diagrams
375
+ - **Cheatsheet** (`references/cheatsheet.md`): MCP tool and REST API reference
376
+ - **Helper scripts** (`scripts/*.cjs`): export, import, clear, healthcheck, CRUD operations
377
+
378
+ The skill complements the MCP server by giving your AI agent structured workflows to follow.
379
+
380
+ ### Install The Skill (Codex CLI example)
381
+
382
+ ```bash
383
+ mkdir -p ~/.codex/skills
384
+ cp -R skills/excalidraw-skill ~/.codex/skills/excalidraw-skill
385
+ ```
386
+
387
+ To update an existing installation, remove the old folder first (`rm -rf ~/.codex/skills/excalidraw-skill`) then re-copy.
388
+
389
+ ### Install The Skill (Claude Code)
390
+
391
+ **User-level** (available across all your projects):
392
+ ```bash
393
+ mkdir -p ~/.claude/skills
394
+ cp -R skills/excalidraw-skill ~/.claude/skills/excalidraw-skill
395
+ ```
396
+
397
+ **Project-level** (scoped to a specific project, can be committed to the repo):
398
+ ```bash
399
+ mkdir -p /path/to/your/project/.claude/skills
400
+ cp -R skills/excalidraw-skill /path/to/your/project/.claude/skills/excalidraw-skill
401
+ ```
402
+
403
+ Then invoke the skill in Claude Code with `/excalidraw-skill`.
404
+
405
+ To update an existing installation, remove the old folder first then re-copy.
406
+
407
+ ### Use The Skill Scripts
408
+
409
+ All scripts respect `EXPRESS_SERVER_URL` (default `http://127.0.0.1:3000`) or accept `--url`.
410
+
411
+ ```bash
412
+ EXPRESS_SERVER_URL=http://127.0.0.1:3000 node skills/excalidraw-skill/scripts/healthcheck.cjs
413
+ EXPRESS_SERVER_URL=http://127.0.0.1:3000 node skills/excalidraw-skill/scripts/export-elements.cjs --out diagram.elements.json
414
+ EXPRESS_SERVER_URL=http://127.0.0.1:3000 node skills/excalidraw-skill/scripts/import-elements.cjs --in diagram.elements.json --mode batch
415
+ ```
416
+
417
+ ### When The Skill Is Useful
418
+
419
+ - Repository workflow: export elements as JSON, commit it, and re-import later.
420
+ - Reliable refactors: clear + re-import in `sync` mode to make canvas match a file.
421
+ - Automated smoke tests: create/update/delete a known element to validate a deployment.
422
+ - Repeatable diagrams: keep a library of element JSON snippets and import them.
423
+
424
+ See `skills/excalidraw-skill/SKILL.md` and `skills/excalidraw-skill/references/cheatsheet.md`.
425
+
426
+ ## MCP Tools (26 Total)
427
+
428
+ | Category | Tools |
429
+ |---|---|
430
+ | **Element CRUD** | `create_element`, `get_element`, `update_element`, `delete_element`, `query_elements`, `batch_create_elements`, `duplicate_elements` |
431
+ | **Layout** | `align_elements`, `distribute_elements`, `group_elements`, `ungroup_elements`, `lock_elements`, `unlock_elements` |
432
+ | **Scene Awareness** | `describe_scene`, `get_canvas_screenshot` |
433
+ | **File I/O** | `export_scene`, `import_scene`, `export_to_image`, `export_to_excalidraw_url`, `create_from_mermaid` |
434
+ | **State Management** | `clear_canvas`, `snapshot_scene`, `restore_snapshot` |
435
+ | **Viewport** | `set_viewport` |
436
+ | **Design Guide** | `read_diagram_guide` |
437
+ | **Resources** | `get_resource` |
438
+
439
+ Full schemas are discoverable via `tools/list` or in `skills/excalidraw-skill/references/cheatsheet.md`.
440
+
441
+ ## Testing
442
+
443
+ ### Canvas Smoke Test (HTTP)
435
444
 
445
+ ```bash
446
+ curl http://127.0.0.1:3000/health
436
447
  ```
437
- mcp_excalidraw/
438
- ├── frontend/
439
- │ ├── src/
440
- │ │ ├── App.jsx # Main React component
441
- │ │ └── main.jsx # React entry point
442
- │ └── index.html # HTML template
443
- ├── src/
444
- │ ├── index.js # MCP server
445
- │ ├── server.js # Canvas server (Express + WebSocket)
446
- │ ├── types.js # Shared types and utilities
447
- │ └── utils/
448
- │ └── logger.js # Logging utility
449
- ├── dist/ # Built frontend (generated)
450
- ├── vite.config.js # Vite build configuration
451
- ├── package.json # Dependencies and scripts
452
- └── README.md # This file
448
+
449
+ ### Local Bind Regression Test
450
+
451
+ ```bash
452
+ npm run test:bind
453
453
  ```
454
454
 
455
- ## 🔮 Development Roadmap
455
+ ### MCP Smoke Test (MCP Inspector)
456
456
 
457
- - **NPM Package**: Resolving MCP tool registration issues
458
- - **Docker Deployment**: Improving canvas synchronization
459
- - **Enhanced Features**: Additional MCP tools and capabilities
460
- - **Performance Optimization**: Real-time sync improvements
457
+ List tools:
458
+ ```bash
459
+ npx @modelcontextprotocol/inspector --cli \
460
+ -e EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
461
+ -e ENABLE_CANVAS_SYNC=true -- \
462
+ node dist/index.js --method tools/list
463
+ ```
461
464
 
462
- ## 🤝 Contributing
465
+ Create a rectangle:
466
+ ```bash
467
+ npx @modelcontextprotocol/inspector --cli \
468
+ -e EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
469
+ -e ENABLE_CANVAS_SYNC=true -- \
470
+ node dist/index.js --method tools/call --tool-name create_element \
471
+ --tool-arg type=rectangle --tool-arg x=100 --tool-arg y=100 \
472
+ --tool-arg width=300 --tool-arg height=200
473
+ ```
463
474
 
464
- We welcome contributions! If you're experiencing issues with the NPM package or Docker version, please:
475
+ ### Frontend Screenshots (agent-browser)
465
476
 
466
- 1. Fork the repository
467
- 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
468
- 3. Commit your changes (`git commit -m 'Add amazing feature'`)
469
- 4. Push to the branch (`git push origin feature/amazing-feature`)
470
- 5. Open a Pull Request
477
+ If you use `agent-browser` for UI checks:
478
+ ```bash
479
+ agent-browser install
480
+ agent-browser open http://127.0.0.1:3000
481
+ agent-browser wait --load networkidle
482
+ agent-browser screenshot /tmp/canvas.png
483
+ ```
484
+
485
+ ## Troubleshooting
486
+
487
+ - Canvas not updating: confirm `EXPRESS_SERVER_URL` points at the running canvas server.
488
+ - Updates/deletes fail after batch creation: ensure you are on a build that includes the batch id preservation fix (merged via PR #34).
489
+
490
+ ## Known Issues / TODO
471
491
 
472
- ## 📝 License
492
+ All previously listed bugs have been fixed in v2.0. Remaining items:
473
493
 
474
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
494
+ - [ ] **Persistent storage**: Elements are stored in-memory restarting the server clears everything. Use `export_scene` / snapshots as a workaround.
495
+ - [ ] **Image export requires a browser**: `export_to_image` and `get_canvas_screenshot` rely on the frontend doing the actual rendering. The canvas UI must be open in a browser.
475
496
 
476
- ## 🙏 Acknowledgments
497
+ Contributions welcome!
477
498
 
478
- - **Excalidraw Team** - For the amazing drawing library
479
- - **MCP Community** - For the Model Context Protocol specification
499
+ ## Development
500
+
501
+ ```bash
502
+ npm run type-check
503
+ npm run build
504
+ ```