daigram 0.0.0-stage → 0.1.0

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 (581) hide show
  1. package/LICENSE +661 -0
  2. package/LICENSE-MIT +21 -0
  3. package/NOTICE +11 -0
  4. package/README.md +788 -2
  5. package/assets/fonts/CascadiaCode-Regular.ttf +0 -0
  6. package/assets/fonts/Excalifont-Regular.ttf +0 -0
  7. package/assets/fonts/LICENSES.md +63 -0
  8. package/assets/fonts/LiberationSans-Regular.ttf +0 -0
  9. package/assets/fonts/Virgil-Regular.ttf +0 -0
  10. package/dist/ai/config.d.ts +11 -0
  11. package/dist/ai/config.d.ts.map +1 -0
  12. package/dist/ai/config.js +59 -0
  13. package/dist/ai/config.js.map +1 -0
  14. package/dist/ai/providers/anthropic.d.ts +3 -0
  15. package/dist/ai/providers/anthropic.d.ts.map +1 -0
  16. package/dist/ai/providers/anthropic.js +71 -0
  17. package/dist/ai/providers/anthropic.js.map +1 -0
  18. package/dist/ai/providers/openai-compatible.d.ts +3 -0
  19. package/dist/ai/providers/openai-compatible.d.ts.map +1 -0
  20. package/dist/ai/providers/openai-compatible.js +95 -0
  21. package/dist/ai/providers/openai-compatible.js.map +1 -0
  22. package/dist/ai/request-settings.d.ts +9 -0
  23. package/dist/ai/request-settings.d.ts.map +1 -0
  24. package/dist/ai/request-settings.js +56 -0
  25. package/dist/ai/request-settings.js.map +1 -0
  26. package/dist/ai/routes.d.ts +7 -0
  27. package/dist/ai/routes.d.ts.map +1 -0
  28. package/dist/ai/routes.js +192 -0
  29. package/dist/ai/routes.js.map +1 -0
  30. package/dist/ai/runner.d.ts +19 -0
  31. package/dist/ai/runner.d.ts.map +1 -0
  32. package/dist/ai/runner.js +77 -0
  33. package/dist/ai/runner.js.map +1 -0
  34. package/dist/ai/sse.d.ts +4 -0
  35. package/dist/ai/sse.d.ts.map +1 -0
  36. package/dist/ai/sse.js +53 -0
  37. package/dist/ai/sse.js.map +1 -0
  38. package/dist/ai/system.d.ts +2 -0
  39. package/dist/ai/system.d.ts.map +1 -0
  40. package/dist/ai/system.js +17 -0
  41. package/dist/ai/system.js.map +1 -0
  42. package/dist/ai/tools.d.ts +10 -0
  43. package/dist/ai/tools.d.ts.map +1 -0
  44. package/dist/ai/tools.js +134 -0
  45. package/dist/ai/tools.js.map +1 -0
  46. package/dist/ai/types.d.ts +72 -0
  47. package/dist/ai/types.d.ts.map +1 -0
  48. package/dist/ai/types.js +2 -0
  49. package/dist/ai/types.js.map +1 -0
  50. package/dist/bin.d.ts +3 -0
  51. package/dist/bin.d.ts.map +1 -0
  52. package/dist/bin.js +52 -0
  53. package/dist/bin.js.map +1 -0
  54. package/dist/cli/args.d.ts +15 -0
  55. package/dist/cli/args.d.ts.map +1 -0
  56. package/dist/cli/args.js +78 -0
  57. package/dist/cli/args.js.map +1 -0
  58. package/dist/cli/commands/ai.d.ts +2 -0
  59. package/dist/cli/commands/ai.d.ts.map +1 -0
  60. package/dist/cli/commands/ai.js +45 -0
  61. package/dist/cli/commands/ai.js.map +1 -0
  62. package/dist/cli/commands/arrange.d.ts +2 -0
  63. package/dist/cli/commands/arrange.d.ts.map +1 -0
  64. package/dist/cli/commands/arrange.js +103 -0
  65. package/dist/cli/commands/arrange.js.map +1 -0
  66. package/dist/cli/commands/canvases.d.ts +2 -0
  67. package/dist/cli/commands/canvases.d.ts.map +1 -0
  68. package/dist/cli/commands/canvases.js +38 -0
  69. package/dist/cli/commands/canvases.js.map +1 -0
  70. package/dist/cli/commands/check.d.ts +2 -0
  71. package/dist/cli/commands/check.d.ts.map +1 -0
  72. package/dist/cli/commands/check.js +15 -0
  73. package/dist/cli/commands/check.js.map +1 -0
  74. package/dist/cli/commands/comment.d.ts +2 -0
  75. package/dist/cli/commands/comment.d.ts.map +1 -0
  76. package/dist/cli/commands/comment.js +76 -0
  77. package/dist/cli/commands/comment.js.map +1 -0
  78. package/dist/cli/commands/elements.d.ts +8 -0
  79. package/dist/cli/commands/elements.d.ts.map +1 -0
  80. package/dist/cli/commands/elements.js +285 -0
  81. package/dist/cli/commands/elements.js.map +1 -0
  82. package/dist/cli/commands/frame.d.ts +2 -0
  83. package/dist/cli/commands/frame.d.ts.map +1 -0
  84. package/dist/cli/commands/frame.js +58 -0
  85. package/dist/cli/commands/frame.js.map +1 -0
  86. package/dist/cli/commands/install-skill.d.ts +2 -0
  87. package/dist/cli/commands/install-skill.d.ts.map +1 -0
  88. package/dist/cli/commands/install-skill.js +108 -0
  89. package/dist/cli/commands/install-skill.js.map +1 -0
  90. package/dist/cli/commands/layout.d.ts +2 -0
  91. package/dist/cli/commands/layout.d.ts.map +1 -0
  92. package/dist/cli/commands/layout.js +15 -0
  93. package/dist/cli/commands/layout.js.map +1 -0
  94. package/dist/cli/commands/render.d.ts +2 -0
  95. package/dist/cli/commands/render.d.ts.map +1 -0
  96. package/dist/cli/commands/render.js +64 -0
  97. package/dist/cli/commands/render.js.map +1 -0
  98. package/dist/cli/commands/scene.d.ts +8 -0
  99. package/dist/cli/commands/scene.d.ts.map +1 -0
  100. package/dist/cli/commands/scene.js +147 -0
  101. package/dist/cli/commands/scene.js.map +1 -0
  102. package/dist/cli/commands/server.d.ts +4 -0
  103. package/dist/cli/commands/server.d.ts.map +1 -0
  104. package/dist/cli/commands/server.js +66 -0
  105. package/dist/cli/commands/server.js.map +1 -0
  106. package/dist/cli/commands/snapshot.d.ts +2 -0
  107. package/dist/cli/commands/snapshot.d.ts.map +1 -0
  108. package/dist/cli/commands/snapshot.js +41 -0
  109. package/dist/cli/commands/snapshot.js.map +1 -0
  110. package/dist/cli/image-options.d.ts +43 -0
  111. package/dist/cli/image-options.d.ts.map +1 -0
  112. package/dist/cli/image-options.js +71 -0
  113. package/dist/cli/image-options.js.map +1 -0
  114. package/dist/cli/run.d.ts +2 -0
  115. package/dist/cli/run.d.ts.map +1 -0
  116. package/dist/cli/run.js +115 -0
  117. package/dist/cli/run.js.map +1 -0
  118. package/dist/cli/util.d.ts +5 -0
  119. package/dist/cli/util.d.ts.map +1 -0
  120. package/dist/cli/util.js +35 -0
  121. package/dist/cli/util.js.map +1 -0
  122. package/dist/core/arrow-routing.d.ts +31 -0
  123. package/dist/core/arrow-routing.d.ts.map +1 -0
  124. package/dist/core/arrow-routing.js +244 -0
  125. package/dist/core/arrow-routing.js.map +1 -0
  126. package/dist/core/bulk-ops.d.ts +55 -0
  127. package/dist/core/bulk-ops.d.ts.map +1 -0
  128. package/dist/core/bulk-ops.js +181 -0
  129. package/dist/core/bulk-ops.js.map +1 -0
  130. package/dist/core/canvas-client.d.ts +110 -0
  131. package/dist/core/canvas-client.d.ts.map +1 -0
  132. package/dist/core/canvas-client.js +416 -0
  133. package/dist/core/canvas-client.js.map +1 -0
  134. package/dist/core/canvas-id.d.ts +4 -0
  135. package/dist/core/canvas-id.d.ts.map +1 -0
  136. package/dist/core/canvas-id.js +5 -0
  137. package/dist/core/canvas-id.js.map +1 -0
  138. package/dist/core/canvas-persistence.d.ts +30 -0
  139. package/dist/core/canvas-persistence.d.ts.map +1 -0
  140. package/dist/core/canvas-persistence.js +854 -0
  141. package/dist/core/canvas-persistence.js.map +1 -0
  142. package/dist/core/canvas-registry.d.ts +36 -0
  143. package/dist/core/canvas-registry.d.ts.map +1 -0
  144. package/dist/core/canvas-registry.js +161 -0
  145. package/dist/core/canvas-registry.js.map +1 -0
  146. package/dist/core/canvas-routes.d.ts +5 -0
  147. package/dist/core/canvas-routes.d.ts.map +1 -0
  148. package/dist/core/canvas-routes.js +29 -0
  149. package/dist/core/canvas-routes.js.map +1 -0
  150. package/dist/core/canvas-state.d.ts +14 -0
  151. package/dist/core/canvas-state.d.ts.map +1 -0
  152. package/dist/core/canvas-state.js +20 -0
  153. package/dist/core/canvas-state.js.map +1 -0
  154. package/dist/core/canvas.d.ts +13 -0
  155. package/dist/core/canvas.d.ts.map +1 -0
  156. package/dist/core/canvas.js +4 -0
  157. package/dist/core/canvas.js.map +1 -0
  158. package/dist/core/comment-ops.d.ts +3 -0
  159. package/dist/core/comment-ops.d.ts.map +1 -0
  160. package/dist/core/comment-ops.js +36 -0
  161. package/dist/core/comment-ops.js.map +1 -0
  162. package/dist/core/comments.d.ts +5 -0
  163. package/dist/core/comments.d.ts.map +1 -0
  164. package/dist/core/comments.js +137 -0
  165. package/dist/core/comments.js.map +1 -0
  166. package/dist/core/compact.d.ts +13 -0
  167. package/dist/core/compact.d.ts.map +1 -0
  168. package/dist/core/compact.js +20 -0
  169. package/dist/core/compact.js.map +1 -0
  170. package/dist/core/config.d.ts +8 -0
  171. package/dist/core/config.d.ts.map +1 -0
  172. package/dist/core/config.js +18 -0
  173. package/dist/core/config.js.map +1 -0
  174. package/dist/core/describe.d.ts +3 -0
  175. package/dist/core/describe.d.ts.map +1 -0
  176. package/dist/core/describe.js +94 -0
  177. package/dist/core/describe.js.map +1 -0
  178. package/dist/core/design-guide.d.ts +2 -0
  179. package/dist/core/design-guide.d.ts.map +1 -0
  180. package/dist/core/design-guide.js +115 -0
  181. package/dist/core/design-guide.js.map +1 -0
  182. package/dist/core/diagram-layout.d.ts +64 -0
  183. package/dist/core/diagram-layout.d.ts.map +1 -0
  184. package/dist/core/diagram-layout.js +238 -0
  185. package/dist/core/diagram-layout.js.map +1 -0
  186. package/dist/core/diagram-ops.d.ts +165 -0
  187. package/dist/core/diagram-ops.d.ts.map +1 -0
  188. package/dist/core/diagram-ops.js +46 -0
  189. package/dist/core/diagram-ops.js.map +1 -0
  190. package/dist/core/entry.d.ts +3 -0
  191. package/dist/core/entry.d.ts.map +1 -0
  192. package/dist/core/entry.js +35 -0
  193. package/dist/core/entry.js.map +1 -0
  194. package/dist/core/expand-elements.d.ts +9 -0
  195. package/dist/core/expand-elements.d.ts.map +1 -0
  196. package/dist/core/expand-elements.js +277 -0
  197. package/dist/core/expand-elements.js.map +1 -0
  198. package/dist/core/frame-ops.d.ts +60 -0
  199. package/dist/core/frame-ops.d.ts.map +1 -0
  200. package/dist/core/frame-ops.js +90 -0
  201. package/dist/core/frame-ops.js.map +1 -0
  202. package/dist/core/frames.d.ts +31 -0
  203. package/dist/core/frames.d.ts.map +1 -0
  204. package/dist/core/frames.js +95 -0
  205. package/dist/core/frames.js.map +1 -0
  206. package/dist/core/geometry.d.ts +30 -0
  207. package/dist/core/geometry.d.ts.map +1 -0
  208. package/dist/core/geometry.js +167 -0
  209. package/dist/core/geometry.js.map +1 -0
  210. package/dist/core/layout-check.d.ts +30 -0
  211. package/dist/core/layout-check.d.ts.map +1 -0
  212. package/dist/core/layout-check.js +181 -0
  213. package/dist/core/layout-check.js.map +1 -0
  214. package/dist/core/local-origin.d.ts +4 -0
  215. package/dist/core/local-origin.d.ts.map +1 -0
  216. package/dist/core/local-origin.js +27 -0
  217. package/dist/core/local-origin.js.map +1 -0
  218. package/dist/core/mcp-dispatch.d.ts +9 -0
  219. package/dist/core/mcp-dispatch.d.ts.map +1 -0
  220. package/dist/core/mcp-dispatch.js +741 -0
  221. package/dist/core/mcp-dispatch.js.map +1 -0
  222. package/dist/core/mcp-http.d.ts +3 -0
  223. package/dist/core/mcp-http.d.ts.map +1 -0
  224. package/dist/core/mcp-http.js +38 -0
  225. package/dist/core/mcp-http.js.map +1 -0
  226. package/dist/core/mcp-server.d.ts +19 -0
  227. package/dist/core/mcp-server.d.ts.map +1 -0
  228. package/dist/core/mcp-server.js +57 -0
  229. package/dist/core/mcp-server.js.map +1 -0
  230. package/dist/core/mcp-tools.d.ts +3 -0
  231. package/dist/core/mcp-tools.d.ts.map +1 -0
  232. package/dist/core/mcp-tools.js +723 -0
  233. package/dist/core/mcp-tools.js.map +1 -0
  234. package/dist/core/normalize.d.ts +26 -0
  235. package/dist/core/normalize.d.ts.map +1 -0
  236. package/dist/core/normalize.js +134 -0
  237. package/dist/core/normalize.js.map +1 -0
  238. package/dist/core/obsidian-md.d.ts +4 -0
  239. package/dist/core/obsidian-md.d.ts.map +1 -0
  240. package/dist/core/obsidian-md.js +227 -0
  241. package/dist/core/obsidian-md.js.map +1 -0
  242. package/dist/core/pidfile.d.ts +5 -0
  243. package/dist/core/pidfile.d.ts.map +1 -0
  244. package/dist/core/pidfile.js +51 -0
  245. package/dist/core/pidfile.js.map +1 -0
  246. package/dist/core/png-scene.d.ts +4 -0
  247. package/dist/core/png-scene.d.ts.map +1 -0
  248. package/dist/core/png-scene.js +176 -0
  249. package/dist/core/png-scene.js.map +1 -0
  250. package/dist/core/render/excalidraw-node/dom.d.ts +29 -0
  251. package/dist/core/render/excalidraw-node/dom.d.ts.map +1 -0
  252. package/dist/core/render/excalidraw-node/dom.js +132 -0
  253. package/dist/core/render/excalidraw-node/dom.js.map +1 -0
  254. package/dist/core/render/excalidraw-node/index.d.ts +11 -0
  255. package/dist/core/render/excalidraw-node/index.d.ts.map +1 -0
  256. package/dist/core/render/excalidraw-node/index.js +77 -0
  257. package/dist/core/render/excalidraw-node/index.js.map +1 -0
  258. package/dist/core/render/fonts.d.ts +34 -0
  259. package/dist/core/render/fonts.d.ts.map +1 -0
  260. package/dist/core/render/fonts.js +133 -0
  261. package/dist/core/render/fonts.js.map +1 -0
  262. package/dist/core/render/index.d.ts +40 -0
  263. package/dist/core/render/index.d.ts.map +1 -0
  264. package/dist/core/render/index.js +135 -0
  265. package/dist/core/render/index.js.map +1 -0
  266. package/dist/core/render/png-worker.d.ts +2 -0
  267. package/dist/core/render/png-worker.d.ts.map +1 -0
  268. package/dist/core/render/png-worker.js +65 -0
  269. package/dist/core/render/png-worker.js.map +1 -0
  270. package/dist/core/render/png.d.ts +15 -0
  271. package/dist/core/render/png.d.ts.map +1 -0
  272. package/dist/core/render/png.js +128 -0
  273. package/dist/core/render/png.js.map +1 -0
  274. package/dist/core/render/text-metrics.d.ts +2 -0
  275. package/dist/core/render/text-metrics.d.ts.map +1 -0
  276. package/dist/core/render/text-metrics.js +136 -0
  277. package/dist/core/render/text-metrics.js.map +1 -0
  278. package/dist/core/request-canvas.d.ts +9 -0
  279. package/dist/core/request-canvas.d.ts.map +1 -0
  280. package/dist/core/request-canvas.js +2 -0
  281. package/dist/core/request-canvas.js.map +1 -0
  282. package/dist/core/request-headers.d.ts +5 -0
  283. package/dist/core/request-headers.d.ts.map +1 -0
  284. package/dist/core/request-headers.js +80 -0
  285. package/dist/core/request-headers.js.map +1 -0
  286. package/dist/core/scene-input.d.ts +2 -0
  287. package/dist/core/scene-input.d.ts.map +1 -0
  288. package/dist/core/scene-input.js +11 -0
  289. package/dist/core/scene-input.js.map +1 -0
  290. package/dist/core/scene-io.d.ts +16 -0
  291. package/dist/core/scene-io.d.ts.map +1 -0
  292. package/dist/core/scene-io.js +95 -0
  293. package/dist/core/scene-io.js.map +1 -0
  294. package/dist/core/share-url.d.ts +3 -0
  295. package/dist/core/share-url.d.ts.map +1 -0
  296. package/dist/core/share-url.js +77 -0
  297. package/dist/core/share-url.js.map +1 -0
  298. package/dist/core/spawn.d.ts +41 -0
  299. package/dist/core/spawn.d.ts.map +1 -0
  300. package/dist/core/spawn.js +153 -0
  301. package/dist/core/spawn.js.map +1 -0
  302. package/dist/core/version.d.ts +2 -0
  303. package/dist/core/version.d.ts.map +1 -0
  304. package/dist/core/version.js +14 -0
  305. package/dist/core/version.js.map +1 -0
  306. package/dist/frontend/assets/Assistant-Bold-gm-uSS1B.woff2 +0 -0
  307. package/dist/frontend/assets/Assistant-Medium-DrcxCXg3.woff2 +0 -0
  308. package/dist/frontend/assets/Assistant-Regular-DVxZuzxb.woff2 +0 -0
  309. package/dist/frontend/assets/Assistant-SemiBold-SCI4bEL9.woff2 +0 -0
  310. package/dist/frontend/assets/Tableau10-CvOaoHrI.js +1 -0
  311. package/dist/frontend/assets/_commonjs-dynamic-modules-TDtrdbi3.js +1 -0
  312. package/dist/frontend/assets/abnfDiagram-VCTEODGH-CO_aNPe5.js +1 -0
  313. package/dist/frontend/assets/advancedFormat-DE2dNp0u.js +1 -0
  314. package/dist/frontend/assets/ar-SA-G6X2FPQ2-Bq4yiKbc.js +10 -0
  315. package/dist/frontend/assets/arc--vhPzIZC.js +1 -0
  316. package/dist/frontend/assets/architectureDiagram-5GKGNRK7-aHYJQElw.js +36 -0
  317. package/dist/frontend/assets/array-BKyUJesY.js +1 -0
  318. package/dist/frontend/assets/az-AZ-76LH7QW2-BB3yat67.js +1 -0
  319. package/dist/frontend/assets/band-dPffDWoQ.js +1 -0
  320. package/dist/frontend/assets/bg-BG-XCXSNQG7-DmC2FjQc.js +5 -0
  321. package/dist/frontend/assets/blockDiagram-68f4deed-Bn83vchM.js +118 -0
  322. package/dist/frontend/assets/blockDiagram-NRAW4CY4-CxaW-TzC.js +129 -0
  323. package/dist/frontend/assets/bn-BD-2XOGV67Q-DpCbZMS6.js +5 -0
  324. package/dist/frontend/assets/c4Diagram-15b5d702-Bq7Ko0Vs.js +10 -0
  325. package/dist/frontend/assets/c4Diagram-UCG6FXSJ-Dh883fAO.js +38 -0
  326. package/dist/frontend/assets/ca-ES-6MX7JW3Y-CBOshpbV.js +8 -0
  327. package/dist/frontend/assets/channel-DYvM7vRx.js +1 -0
  328. package/dist/frontend/assets/chunk-2Q5K7J3B-DaFhLtFc.js +1 -0
  329. package/dist/frontend/assets/chunk-5VM5RSS4-CyLfaWw7.js +15 -0
  330. package/dist/frontend/assets/chunk-F27PBJKO-BHNc-edD.js +1 -0
  331. package/dist/frontend/assets/chunk-G27WJ6UU-BBKiZxqf.js +231 -0
  332. package/dist/frontend/assets/chunk-JWPE2WC7-7twsn51D.js +1 -0
  333. package/dist/frontend/assets/chunk-LCL6LL3I-BTwZuXJ6.js +206 -0
  334. package/dist/frontend/assets/chunk-POPQ4Y6H-CaHDxqyV.js +1 -0
  335. package/dist/frontend/assets/chunk-SVP7TREG-B8-zByXy.js +88 -0
  336. package/dist/frontend/assets/chunk-XXDRQBXY-DQLro-7R.js +1 -0
  337. package/dist/frontend/assets/classDiagram-DTDB5LWJ-Dpwx6IJK.js +1 -0
  338. package/dist/frontend/assets/classDiagram-d40c83e7-BPxlcZuc.js +2 -0
  339. package/dist/frontend/assets/classDiagram-v2-JRS7N3AN-Dpwx6IJK.js +1 -0
  340. package/dist/frontend/assets/classDiagram-v2-d5a6b087-Cyz34qAK.js +2 -0
  341. package/dist/frontend/assets/clone-Iw0eB1Cb.js +1 -0
  342. package/dist/frontend/assets/cose-bilkent-JH36ORCC-C4ZX1Xvi.js +1 -0
  343. package/dist/frontend/assets/createText-d213de94-CDH1rzxH.js +7 -0
  344. package/dist/frontend/assets/cs-CZ-2BRQDIVT-CGAN69M4.js +11 -0
  345. package/dist/frontend/assets/cynefin-OW5HDTMX-B8XT9png.js +178 -0
  346. package/dist/frontend/assets/cynefinDiagram-5FMLGOSQ-COTZjqlj.js +62 -0
  347. package/dist/frontend/assets/cytoscape-cose-bilkent-D4yGolDn.js +1 -0
  348. package/dist/frontend/assets/cytoscape.esm-BjAbmLdb.js +331 -0
  349. package/dist/frontend/assets/da-DK-5WZEPLOC-FIDoeOAn.js +5 -0
  350. package/dist/frontend/assets/dagre-3AP2YEHR-v8EtxNwx.js +4 -0
  351. package/dist/frontend/assets/de-DE-XR44H4JA-Hquyrt1G.js +8 -0
  352. package/dist/frontend/assets/defaultLocale-C4B-KCzX.js +1 -0
  353. package/dist/frontend/assets/diagram-S7CK7UJ4-BiwOlZBI.js +30 -0
  354. package/dist/frontend/assets/diagram-UQ7AKVKN-DIfzNs7s.js +41 -0
  355. package/dist/frontend/assets/diagram-VSXAHHWV-kKkEHy5z.js +3 -0
  356. package/dist/frontend/assets/diagram-VX7I27RA-zTp2qGKo.js +24 -0
  357. package/dist/frontend/assets/diagram-Z3DM3KII-hUxSr-QT.js +24 -0
  358. package/dist/frontend/assets/directory-open-01563666-DWU9wJ6I.js +1 -0
  359. package/dist/frontend/assets/directory-open-4ed118d0-CunoC1EB.js +1 -0
  360. package/dist/frontend/assets/ebnfDiagram-PWID7BFC-CRwXBVzS.js +1 -0
  361. package/dist/frontend/assets/edges-332bd1c7-CbPhghy3.js +4 -0
  362. package/dist/frontend/assets/el-GR-BZB4AONW-CWRJJANX.js +10 -0
  363. package/dist/frontend/assets/erDiagram-880f2ed8-CY1dU-f9.js +51 -0
  364. package/dist/frontend/assets/erDiagram-SSCWMZ5O-BfDW8Lxf.js +99 -0
  365. package/dist/frontend/assets/es-ES-U4NZUMDT-BwZWIjT5.js +9 -0
  366. package/dist/frontend/assets/eu-ES-A7QVB2H4-B9suQ9BE.js +11 -0
  367. package/dist/frontend/assets/fa-IR-HGAKTJCU-tgrKvE4J.js +8 -0
  368. package/dist/frontend/assets/fi-FI-Z5N7JZ37-Ddoc7R-q.js +6 -0
  369. package/dist/frontend/assets/file-open-002ab408-DIuFHtCF.js +1 -0
  370. package/dist/frontend/assets/file-open-7c801643-684qeFg4.js +1 -0
  371. package/dist/frontend/assets/file-save-3189631c-C1wFhQhH.js +1 -0
  372. package/dist/frontend/assets/file-save-745eba88-Bb9F9Kg7.js +1 -0
  373. package/dist/frontend/assets/flowDb-7c981674-DkYacLUz.js +10 -0
  374. package/dist/frontend/assets/flowDiagram-A5DVABFB-CCBuG42p.js +168 -0
  375. package/dist/frontend/assets/flowDiagram-cbd28bf7-DhhBmCsw.js +4 -0
  376. package/dist/frontend/assets/flowDiagram-v2-ffc7f31a-BICbZ5-w.js +1 -0
  377. package/dist/frontend/assets/flowchart-elk-definition-36e2d292-BsyTsM2Q.js +139 -0
  378. package/dist/frontend/assets/fr-FR-RHASNOE6-Bzn_6dcd.js +9 -0
  379. package/dist/frontend/assets/ganttDiagram-04f9e578-CCKAlfpJ.js +257 -0
  380. package/dist/frontend/assets/ganttDiagram-EL5Y4UJY-B8CXkutd.js +292 -0
  381. package/dist/frontend/assets/gitGraphDiagram-21fc4d3e-DBAYEQql.js +70 -0
  382. package/dist/frontend/assets/gitGraphDiagram-WWUBYQGX-Ge5QWjv2.js +106 -0
  383. package/dist/frontend/assets/gl-ES-HMX3MZ6V-vcZHbFum.js +10 -0
  384. package/dist/frontend/assets/graph-87dI2d0Q.js +1 -0
  385. package/dist/frontend/assets/has-D7z5cd7K.js +1 -0
  386. package/dist/frontend/assets/he-IL-6SHJWFNN-CK07fY3l.js +10 -0
  387. package/dist/frontend/assets/hi-IN-IWLTKZ5I-CDZ0p7Jv.js +4 -0
  388. package/dist/frontend/assets/hu-HU-A5ZG7DT2-FH5SLnWy.js +7 -0
  389. package/dist/frontend/assets/id-ID-SAP4L64H-MjXIXb2f.js +10 -0
  390. package/dist/frontend/assets/image-blob-reduce.esm-HwCm7IZ0.js +7 -0
  391. package/dist/frontend/assets/index-6079d271-DiB2AL6F.js +1 -0
  392. package/dist/frontend/assets/index-BcAUh2Nm.css +1 -0
  393. package/dist/frontend/assets/index-Biw8Vgb3.js +320 -0
  394. package/dist/frontend/assets/index-fTyH8AV3.js +354 -0
  395. package/dist/frontend/assets/infoDiagram-4a4f5b27-BOdJmCUU.js +7 -0
  396. package/dist/frontend/assets/infoDiagram-RXCK75RN-CNm06Rxs.js +2 -0
  397. package/dist/frontend/assets/init-Gi6I4Gst.js +1 -0
  398. package/dist/frontend/assets/ishikawaDiagram-5VMMS53U-DoLWy3n2.js +70 -0
  399. package/dist/frontend/assets/it-IT-JPQ66NNP-D3n0iaPa.js +11 -0
  400. package/dist/frontend/assets/ja-JP-DBVTYXUO-ejSNO7M9.js +8 -0
  401. package/dist/frontend/assets/journeyDiagram-29694f62-Cm6qVjA9.js +139 -0
  402. package/dist/frontend/assets/journeyDiagram-EYS64GPL-ByZmvOcj.js +139 -0
  403. package/dist/frontend/assets/kaa-6HZHGXH3-D8l_gwno.js +1 -0
  404. package/dist/frontend/assets/kab-KAB-ZGHBKWFO-CCdAUgdW.js +8 -0
  405. package/dist/frontend/assets/kanban-definition-3QL26DDD-Y5ylzca9.js +89 -0
  406. package/dist/frontend/assets/katex-C5jXJg4s.js +257 -0
  407. package/dist/frontend/assets/kk-KZ-P5N5QNE5-DeuZqHeo.js +1 -0
  408. package/dist/frontend/assets/km-KH-HSX4SM5Z-CiG2k5fk.js +11 -0
  409. package/dist/frontend/assets/ko-KR-MTYHY66A-KQOGYf_l.js +9 -0
  410. package/dist/frontend/assets/ku-TR-6OUDTVRD-iPec9Wpx.js +9 -0
  411. package/dist/frontend/assets/layout-ChryVliD.js +1 -0
  412. package/dist/frontend/assets/layout-chXYHUIV.js +1 -0
  413. package/dist/frontend/assets/line-V0o6yOnB.js +1 -0
  414. package/dist/frontend/assets/linear-BvV3B0Vg.js +1 -0
  415. package/dist/frontend/assets/lt-LT-XHIRWOB4-CATjC2gQ.js +3 -0
  416. package/dist/frontend/assets/lv-LV-5QDEKY6T-BsDP-7Dd.js +7 -0
  417. package/dist/frontend/assets/mindmap-definition-FBJOCRG2-z4KcwRlx.js +96 -0
  418. package/dist/frontend/assets/mindmap-definition-ac74a2e8-C1QU2vBv.js +95 -0
  419. package/dist/frontend/assets/mr-IN-CRQNXWMA-DWJhwvxv.js +13 -0
  420. package/dist/frontend/assets/my-MM-5M5IBNSE-DckXEMN8.js +1 -0
  421. package/dist/frontend/assets/nb-NO-T6EIAALU-HaOR9ZeX.js +10 -0
  422. package/dist/frontend/assets/nl-NL-IS3SIHDZ-ef_ywpFu.js +8 -0
  423. package/dist/frontend/assets/nn-NO-6E72VCQL-Bg7QdVqf.js +8 -0
  424. package/dist/frontend/assets/oc-FR-POXYY2M6-D5HmBPnC.js +8 -0
  425. package/dist/frontend/assets/ordinal-Cboi1Yqb.js +1 -0
  426. package/dist/frontend/assets/pa-IN-N4M65BXN-BHYM0tZp.js +4 -0
  427. package/dist/frontend/assets/path-CbwjOpE9.js +1 -0
  428. package/dist/frontend/assets/pegDiagram-XKGWAZYB-BL0-JiYs.js +1 -0
  429. package/dist/frontend/assets/pica-CHpl3DYP.js +7 -0
  430. package/dist/frontend/assets/pie-b97pL0mM.js +1 -0
  431. package/dist/frontend/assets/pieDiagram-421022e6-DiRybrxD.js +35 -0
  432. package/dist/frontend/assets/pieDiagram-E7YTZNPT-VybkpWmu.js +39 -0
  433. package/dist/frontend/assets/pl-PL-T2D74RX3-uZIVDHgu.js +9 -0
  434. package/dist/frontend/assets/pt-BR-5N22H2LF-dJVfhAeV.js +9 -0
  435. package/dist/frontend/assets/pt-PT-UZXXM6DQ-DjJzcznP.js +9 -0
  436. package/dist/frontend/assets/quadrantDiagram-0957ecba-BHJpECv1.js +7 -0
  437. package/dist/frontend/assets/quadrantDiagram-AXDQQJYC-RAG8nSkZ.js +7 -0
  438. package/dist/frontend/assets/railroadDiagram-O6MQD6OU-lCMtporN.js +1 -0
  439. package/dist/frontend/assets/requirementDiagram-23d650b8-mSFTWSrD.js +52 -0
  440. package/dist/frontend/assets/requirementDiagram-EFPCY7ZU-B8YnTqPO.js +84 -0
  441. package/dist/frontend/assets/ro-RO-JPDTUUEW-B5X8VOmp.js +11 -0
  442. package/dist/frontend/assets/roundRect-0PYZxl1G.js +1 -0
  443. package/dist/frontend/assets/ru-RU-B4JR7IUQ-Czv9kfuz.js +9 -0
  444. package/dist/frontend/assets/sankeyDiagram-23345273-B3g3P-D1.js +8 -0
  445. package/dist/frontend/assets/sankeyDiagram-P5KCCOFB-DRm9HHoQ.js +40 -0
  446. package/dist/frontend/assets/sankeyLinkHorizontal-CgO6js3K.js +1 -0
  447. package/dist/frontend/assets/sequenceDiagram-17ac3bff-DzZiSttS.js +122 -0
  448. package/dist/frontend/assets/sequenceDiagram-WJ2MYXX4-BrSDYDx-.js +162 -0
  449. package/dist/frontend/assets/si-LK-N5RQ5JYF-DFWOZdgD.js +1 -0
  450. package/dist/frontend/assets/sizeCapture-X5ZJPWSS-CbaN7yeQ.js +1 -0
  451. package/dist/frontend/assets/sk-SK-C5VTKIMK-B8VlFn2Z.js +6 -0
  452. package/dist/frontend/assets/sl-SI-NN7IZMDC-CJeSgLEg.js +6 -0
  453. package/dist/frontend/assets/stateDiagram-9c5f0230-Dzm1fyzw.js +1 -0
  454. package/dist/frontend/assets/stateDiagram-HBIQ2CUA-B5Nv-PBX.js +1 -0
  455. package/dist/frontend/assets/stateDiagram-v2-4QOOHH4V-B72hUL6s.js +1 -0
  456. package/dist/frontend/assets/stateDiagram-v2-51a3dcff-DvLAYBjA.js +1 -0
  457. package/dist/frontend/assets/styles-2ab5d517-D6473lhT.js +116 -0
  458. package/dist/frontend/assets/styles-5f03d8d2-CZ5U9u1n.js +160 -0
  459. package/dist/frontend/assets/styles-edf9a4b0-DzQC88FF.js +207 -0
  460. package/dist/frontend/assets/subset-shared.chunk.js +84 -0
  461. package/dist/frontend/assets/subset-worker.chunk.js +1 -0
  462. package/dist/frontend/assets/sv-SE-XGPEYMSR-BKMKxZWF.js +10 -0
  463. package/dist/frontend/assets/svgDrawCommon-3ba9043b-CQsuw6x4.js +1 -0
  464. package/dist/frontend/assets/swimlanes-XN3QIQJK-D6c81JTS.js +1 -0
  465. package/dist/frontend/assets/swimlanesDiagram-VK2B7HYN-SMIGSMWR.js +8 -0
  466. package/dist/frontend/assets/ta-IN-2NMHFXQM-BtPPl3RQ.js +9 -0
  467. package/dist/frontend/assets/th-TH-HPSO5L25-CSjFGi1j.js +2 -0
  468. package/dist/frontend/assets/timeline-definition-24CTP7MA-DTBgPsOR.js +120 -0
  469. package/dist/frontend/assets/timeline-definition-7e6b55e7-D44e8lHF.js +61 -0
  470. package/dist/frontend/assets/tr-TR-DEFEU3FU-BS1kZ0-G.js +7 -0
  471. package/dist/frontend/assets/uk-UA-QMV73CPH--ucRdDwc.js +6 -0
  472. package/dist/frontend/assets/union-DI_iry4-.js +1 -0
  473. package/dist/frontend/assets/vennDiagram-4TSXK5OY-DDIUJU_f.js +34 -0
  474. package/dist/frontend/assets/vi-VN-M7AON7JQ-BcGYkPOn.js +5 -0
  475. package/dist/frontend/assets/wardleyDiagram-VM6X3IG4-TfvrOirV.js +78 -0
  476. package/dist/frontend/assets/xychartDiagram-S5SC5T6Z-DaSdOJbv.js +7 -0
  477. package/dist/frontend/assets/xychartDiagram-b6496bcd-VIsyqEG1.js +7 -0
  478. package/dist/frontend/assets/zh-CN-LNUGB5OW-RL4CyEYU.js +10 -0
  479. package/dist/frontend/assets/zh-HK-E62DVLB3-DKGVR3J1.js +1 -0
  480. package/dist/frontend/assets/zh-TW-RAJ6MFWO-C7djgh-M.js +9 -0
  481. package/dist/frontend/assets/zipObject-Bl99JdSU.js +1 -0
  482. package/dist/frontend/index.html +569 -0
  483. package/dist/index.d.ts +7 -0
  484. package/dist/index.d.ts.map +1 -0
  485. package/dist/index.js +74 -0
  486. package/dist/index.js.map +1 -0
  487. package/dist/render/excalidraw-node.mjs +540 -0
  488. package/dist/server.d.ts +5 -0
  489. package/dist/server.d.ts.map +1 -0
  490. package/dist/server.js +1684 -0
  491. package/dist/server.js.map +1 -0
  492. package/dist/types.d.ts +263 -0
  493. package/dist/types.d.ts.map +1 -0
  494. package/dist/types.js +49 -0
  495. package/dist/types.js.map +1 -0
  496. package/dist/utils/logger.d.ts +4 -0
  497. package/dist/utils/logger.d.ts.map +1 -0
  498. package/dist/utils/logger.js +63 -0
  499. package/dist/utils/logger.js.map +1 -0
  500. package/package.json +127 -4
  501. package/skills/excalidraw-skill/SKILL.md +331 -0
  502. package/skills/excalidraw-skill/evals/evals.json +35 -0
  503. package/skills/excalidraw-skill/references/cheatsheet.md +217 -0
  504. package/src/ai/config.ts +58 -0
  505. package/src/ai/providers/anthropic.ts +62 -0
  506. package/src/ai/providers/openai-compatible.ts +84 -0
  507. package/src/ai/request-settings.ts +50 -0
  508. package/src/ai/routes.ts +157 -0
  509. package/src/ai/runner.ts +80 -0
  510. package/src/ai/sse.ts +40 -0
  511. package/src/ai/system.ts +16 -0
  512. package/src/ai/tools.ts +130 -0
  513. package/src/ai/types.ts +48 -0
  514. package/src/bin.ts +56 -0
  515. package/src/cli/args.ts +97 -0
  516. package/src/cli/commands/ai.ts +40 -0
  517. package/src/cli/commands/arrange.ts +112 -0
  518. package/src/cli/commands/canvases.ts +37 -0
  519. package/src/cli/commands/check.ts +15 -0
  520. package/src/cli/commands/comment.ts +72 -0
  521. package/src/cli/commands/elements.ts +299 -0
  522. package/src/cli/commands/frame.ts +55 -0
  523. package/src/cli/commands/install-skill.ts +116 -0
  524. package/src/cli/commands/layout.ts +14 -0
  525. package/src/cli/commands/render.ts +68 -0
  526. package/src/cli/commands/scene.ts +168 -0
  527. package/src/cli/commands/server.ts +71 -0
  528. package/src/cli/commands/snapshot.ts +45 -0
  529. package/src/cli/image-options.ts +77 -0
  530. package/src/cli/run.ts +123 -0
  531. package/src/cli/util.ts +39 -0
  532. package/src/core/arrow-routing.ts +256 -0
  533. package/src/core/bulk-ops.ts +183 -0
  534. package/src/core/canvas-client.ts +525 -0
  535. package/src/core/canvas-id.ts +8 -0
  536. package/src/core/canvas-persistence.ts +1067 -0
  537. package/src/core/canvas-registry.ts +180 -0
  538. package/src/core/canvas-routes.ts +34 -0
  539. package/src/core/canvas-state.ts +37 -0
  540. package/src/core/canvas.ts +18 -0
  541. package/src/core/comment-ops.ts +36 -0
  542. package/src/core/comments.ts +142 -0
  543. package/src/core/compact.ts +21 -0
  544. package/src/core/config.ts +24 -0
  545. package/src/core/describe.ts +100 -0
  546. package/src/core/design-guide.ts +114 -0
  547. package/src/core/diagram-layout.ts +278 -0
  548. package/src/core/diagram-ops.ts +48 -0
  549. package/src/core/entry.ts +37 -0
  550. package/src/core/expand-elements.ts +316 -0
  551. package/src/core/frame-ops.ts +112 -0
  552. package/src/core/frames.ts +113 -0
  553. package/src/core/geometry.ts +213 -0
  554. package/src/core/layout-check.ts +200 -0
  555. package/src/core/local-origin.ts +27 -0
  556. package/src/core/mcp-dispatch.ts +858 -0
  557. package/src/core/mcp-http.ts +38 -0
  558. package/src/core/mcp-server.ts +72 -0
  559. package/src/core/mcp-tools.ts +725 -0
  560. package/src/core/normalize.ts +158 -0
  561. package/src/core/obsidian-md.ts +231 -0
  562. package/src/core/pidfile.ts +52 -0
  563. package/src/core/png-scene.ts +177 -0
  564. package/src/core/render/excalidraw-node/dom.ts +159 -0
  565. package/src/core/render/excalidraw-node/index.ts +100 -0
  566. package/src/core/render/fonts.ts +173 -0
  567. package/src/core/render/index.ts +198 -0
  568. package/src/core/render/png-worker.ts +75 -0
  569. package/src/core/render/png.ts +148 -0
  570. package/src/core/render/text-metrics.ts +141 -0
  571. package/src/core/request-canvas.ts +10 -0
  572. package/src/core/request-headers.ts +79 -0
  573. package/src/core/scene-input.ts +11 -0
  574. package/src/core/scene-io.ts +125 -0
  575. package/src/core/share-url.ts +99 -0
  576. package/src/core/spawn.ts +186 -0
  577. package/src/core/version.ts +13 -0
  578. package/src/index.ts +86 -0
  579. package/src/server.ts +1873 -0
  580. package/src/types.ts +384 -0
  581. package/src/utils/logger.ts +77 -0
package/README.md CHANGED
@@ -1,3 +1,789 @@
1
- # Temporary Holding Version
1
+ # daigram
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![NPM Version](https://img.shields.io/npm/v/daigram)](https://www.npmjs.com/package/daigram)
4
+ [![License](https://img.shields.io/badge/license-AGPL--3.0--only%20AND%20MIT-blue.svg)](LICENSE)
5
+
6
+ **daigram** (/ˈdaɪ.ɡræm/, "diagram" without the middle syllable) is a whiteboard for humans and AI agents, drawing on the same live [Excalidraw](https://excalidraw.com) canvas: each sees, comments on and refines the other's work. 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; you edit, comment and chat on the same canvas.
7
+
8
+ One canvas, three ways to drive it:
9
+
10
+ - **Agent Skill + CLI** — recommended for coding agents (Claude Code, Codex CLI, Cursor, OpenCode): `npx -y daigram <command>`. Zero config, auto-starts the canvas, composable JSON in/out.
11
+ - **MCP Server** — tools over stdio for any Model Context Protocol client (Claude Desktop, Cursor, Codex CLI, Antigravity, ...). Speaks MCP `2026-07-28` (`server/discover`, per-request `_meta` envelope, tool calls without a handshake) and stays compatible with 2025-era clients that open with `initialize`.
12
+ - **REST API** — plain HTTP for LangChain and custom frameworks.
13
+
14
+ Core drawing runs locally (Node ≥ 20, AGPL-3.0) — no API keys or accounts. Mermaid conversion runs in the local browser canvas; `share` is optional and uploads an encrypted scene to excalidraw.com by default (or your own instance).
15
+
16
+ ## What makes it different
17
+
18
+ - **Describe a diagram, don't position it.** `layout_diagram` takes nodes, edges and groups and places, sizes and joins them with right-angled arrows (layered layout, up to 100 nodes).
19
+ - **Agents check their own work.** `check_layout` reports labels that do not fit, overlaps, arrows through shapes and clipped frames; `fit_to_text`, `route_arrows` and the bulk tools fix them.
20
+ - **An AI chat on the canvas.** Provider-agnostic, with your own key or the server's model, and it can be confined to a single frame.
21
+ - **Many canvases, frames and comments.** Each canvas has its own address (`/c/<id>`); comments pin to elements, and the agent reads them and resolves them.
22
+ - **Usable on a phone.** View, comment and chat; editing stays locked until you choose Edit.
23
+ - **Local and self-hostable.** Opt-in durable state, headless rendering, MCP over stdio or HTTP, Docker.
24
+
25
+ ## Demo
26
+
27
+ ![AI agent drawing an architecture diagram on a live Excalidraw canvas via MCP](demo.gif)
28
+
29
+ *AI agent creates a complete architecture diagram from a single prompt (4x speed).*
30
+
31
+ ## Table of Contents
32
+
33
+ - [What makes it different](#what-makes-it-different)
34
+ - [Demo](#demo)
35
+ - [What It Is](#what-it-is)
36
+ - [How We Differ from the Official Excalidraw MCP](#how-we-differ-from-the-official-excalidraw-mcp)
37
+ - [History](#history)
38
+ - [Installation](#installation)
39
+ - [Agent Skill](#agent-skill)
40
+ - [CLI Reference](#cli-reference)
41
+ - [Headless Rendering](#headless-rendering)
42
+ - [Frames](#frames)
43
+ - [Comments](#comments)
44
+ - [On a phone](#on-a-phone)
45
+ - [Multiple canvases](#multiple-canvases)
46
+ - [Built-in AI](#built-in-ai)
47
+ - [Configure MCP Clients](#configure-mcp-clients)
48
+ - [Remote Canvas and HTTP-Only MCP Clients](#remote-canvas-and-http-only-mcp-clients)
49
+ - [Claude Desktop](#claude-desktop)
50
+ - [Claude Code](#claude-code)
51
+ - [Cursor](#cursor)
52
+ - [Codex CLI](#codex-cli)
53
+ - [OpenCode](#opencode)
54
+ - [Antigravity (Google)](#antigravity-google)
55
+ - [MCP Tools](#mcp-tools)
56
+ - [Quick Start (From Source / Docker)](#quick-start-from-source--docker)
57
+ - [Testing](#testing)
58
+ - [FAQ](#faq)
59
+ - [Troubleshooting](#troubleshooting)
60
+ - [Known Issues / TODO](#known-issues--todo)
61
+ - [Development](#development)
62
+ - [License](#license)
63
+
64
+ ## What It Is
65
+
66
+ 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.
67
+
68
+ Under the hood there are two processes, one product:
69
+
70
+ - **Canvas server**: Excalidraw web UI + REST API + WebSocket real-time sync (default `http://127.0.0.1:3000`)
71
+ - **A thin front-end of your choice**: the CLI, the MCP stdio server, or raw HTTP — all drive the same canvas
72
+
73
+ 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.
74
+
75
+ ## How We Differ from the Official Excalidraw MCP
76
+
77
+ Excalidraw has an [official MCP](https://github.com/excalidraw/excalidraw-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.
78
+
79
+ | | Official Excalidraw MCP | This Project |
80
+ |---|---|---|
81
+ | **Approach** | Prompt in, diagram out (one-shot widget) | Programmatic element-level control (CLI + MCP tools) |
82
+ | **State** | Checkpoints inside the chat widget | Live canvas with real-time sync and optional restart-safe checkpoints |
83
+ | **Diagrams** | `layout_diagram`: describe nodes, edges and groups and it places, sizes and joins them with right-angled arrows (ELK layered layout; up to 100 nodes, 200 edges) |
84
+ | **Element CRUD** | Declarative re-send with delete markers | Full create / read / update / delete per element |
85
+ | **AI sees the canvas** | No | `describe` (structured text) + `screenshot` (image) |
86
+ | **Iterative refinement** | Regenerate from checkpoint | Draw → look → adjust → look again, element by element |
87
+ | **Layout tools** | No | align, distribute, group / ungroup, lock, duplicate |
88
+ | **File I/O** | No model-facing export | `.excalidraw` export/import — diagrams as repo artifacts |
89
+ | **Snapshot & rollback** | Widget-side checkpoints | Named server-side snapshots |
90
+ | **Mermaid conversion** | No | `mermaid` / `create_from_mermaid` |
91
+ | **Shareable URLs** | Widget-only | `share` / `export_to_excalidraw_url` |
92
+ | **Viewport control** | Camera animations | `set_viewport` (zoom-to-fit all or selected elements, center on one element, manual zoom) |
93
+ | **Works without MCP** | No | Yes — CLI + agent skill + REST API |
94
+ | **Multi-agent** | Single chat | Multiple agents on the same canvas concurrently |
95
+
96
+ **TL;DR** — The official MCP shows Excalidraw diagrams in your chat. This project gives you and your coding agent a full Excalidraw workbench: a shared canvas you can both draw on, inspect, refine, and commit to your repo.
97
+
98
+ ## History
99
+
100
+ daigram started as a fork of [mcp_excalidraw](https://github.com/yctimlin/mcp_excalidraw) 2.2.0 and has since added the features above. Version 0.1.0 is the first release under the daigram name, so the numbering starts again here. The release notes of the original project (v1.1 to v2.2: the CLI, headless rendering, MCP 2026-07-28, durable state) are on its [releases page](https://github.com/yctimlin/mcp_excalidraw/releases).
101
+
102
+ ## Installation
103
+
104
+ The only prerequisite is **Node.js ≥ 20**.
105
+
106
+ ### Easiest: let your agent install it
107
+
108
+ 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:
109
+
110
+ ```text
111
+ Install the Excalidraw canvas toolkit so you can draw diagrams for me:
112
+
113
+ 1. Choose the right skill directory for this agent and scope (project or global).
114
+ 2. Run: npx -y daigram install-skill --dir <that-skills-directory>
115
+ 3. Read the installed excalidraw-skill/SKILL.md so you know the drawing workflow.
116
+ 4. Start the canvas with: npx -y daigram start
117
+ then tell me I can open http://127.0.0.1:3000 to watch you draw (optional).
118
+ 5. Draw a small test diagram — two labeled boxes connected by an arrow — take a
119
+ screenshot, and show me the result to confirm everything works.
120
+ ```
121
+
122
+ ### Manual install
123
+
124
+ | You are... | Install with | Then |
125
+ |---|---|---|
126
+ | **Modern coding agent** | `npx -y daigram install-skill --dir <skills-root>` | Let the agent choose project/global scope and its skill root |
127
+ | **Claude Code shortcut** | `npx -y daigram install-skill` | Installs to `~/.claude/skills` for backward compatibility |
128
+ | **Codex shortcut** | `npx -y daigram install-skill --target codex` | Installs to `~/.codex/skills` for backward compatibility |
129
+ | **MCP client user** (Claude Desktop, Cursor, ...) | Add the npx config below | See [Configure MCP Clients](#configure-mcp-clients) |
130
+ | **CLI user / scripting** | Nothing — `npx -y daigram <command>` | See [CLI Reference](#cli-reference) |
131
+ | **Contributor / from source** | `git clone` + `npm ci` + `npm run build` | See [Quick Start (From Source / Docker)](#quick-start-from-source--docker) |
132
+
133
+ There is no separate server setup: any drawing command auto-starts the local canvas server on `http://127.0.0.1:3000`.
134
+
135
+ ### 60-Second Quick Start (CLI)
136
+
137
+ No clone, no config:
138
+
139
+ ```bash
140
+ # start the canvas (drawing commands auto-start it too) and open it
141
+ npx -y daigram start
142
+ open http://127.0.0.1:3000 # optional: watch live (only mermaid needs the tab)
143
+
144
+ # draw something
145
+ echo '[
146
+ {"id":"api","type":"rectangle","x":100,"y":100,"width":160,"height":80,"text":"API Server","backgroundColor":"#a5d8ff"},
147
+ {"id":"db","type":"rectangle","x":400,"y":100,"width":160,"height":80,"text":"Database","backgroundColor":"#99e9f2"},
148
+ {"type":"arrow","x":0,"y":0,"startElementId":"api","endElementId":"db","text":"SQL"}
149
+ ]' | npx -y daigram add
150
+
151
+ # let your agent see its work
152
+ npx -y daigram describe
153
+ npx -y daigram screenshot --out diagram.png
154
+
155
+ # diagrams as repo artifacts
156
+ mkdir -p docs
157
+ npx -y daigram export --out docs/architecture.excalidraw
158
+
159
+ # or straight into an Obsidian vault (.md extension → Obsidian Excalidraw plugin format)
160
+ npx -y daigram export --out ~/vault/diagrams/architecture.excalidraw.md
161
+ ```
162
+
163
+ Give your agent the full playbook:
164
+
165
+ ```bash
166
+ npx -y daigram install-skill --dir <skills-root>
167
+ npx -y daigram install-skill --print-source # inspect bundled source path
168
+ ```
169
+
170
+ > **Security note:** The canvas server binds `127.0.0.1` only 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.
171
+
172
+ ### Cross-site protection
173
+
174
+ Any website you visit can send requests to `localhost`, and a WebSocket ignores CORS. The `/api` routes and the WebSocket therefore refuse browser requests that come from another site (`Sec-Fetch-Site`), carry a foreign `Origin`, or, on a loopback bind, use a Host name other than `localhost`, `127.0.0.1` or `[::1]` (DNS rebinding). The canvas page, the CLI and curl are unaffected. To let another web app call the API, list its origin in `ALLOWED_ORIGINS`. On a non-loopback bind (`HOST=0.0.0.0`, Docker) the Host name check is skipped, so put authentication in front. For `npm run dev`, no setting is needed: the Vite proxy keeps the page's own origin.
175
+
176
+ Updates from the CLI or an agent are held while you drag, draw or edit text, and applied in order when you finish. An unfinished multi-point line or an open text box holds them until you finish it, with no time limit; only queued viewport and export requests are dropped after 10 seconds.
177
+
178
+ ## Frames
179
+
180
+ Every top-level frame gets a tab along the bottom. A tab scrolls and zooms to its frame on click and follows the view as you pan. Drag a tab to reorder it: the order is stored on the frames and has nothing to do with where they sit, so moving a frame moves no tab and moving a tab moves no frame. **+ Frame** adds a 1600x1000 frame after the last one, in free space; **Make frame from selection** wraps the selected shapes in a frame; double-click a tab to rename it; its menu fits the frame to its shapes or deletes it with its shapes after a confirmation (Excalidraw's own Delete key removes only the frame). A tab shows how many open comments are inside its frame, and **Focus** dims everything outside the current frame. Selecting a tab or adding a frame sets the page's `#frame=<name>` link, and opening a link with `#frame=<name or id>` scrolls to that frame once the scene has loaded. A link to a frame that was renamed or deleted is ignored.
181
+
182
+ Agents work one frame at a time: `frame list`, `describe`, `add`, `apply`, `update`, `get` and `query` with `--frame <name>`, `screenshot --frame <name>` and `frame reorder <name> <position>` (tab order only). With `--frame`, every position the agent reads or writes is relative to the frame's top-left corner, which is (0, 0) and never negative; `add`, `apply` and `update` grow the frame right and down to hold shapes you add, move or resize, because a frame clips what lies outside it. (Stored coordinates are still canvas coordinates, as in Excalidraw.) Shapes may also sit on no frame. Frames sync, undo and export like any other shape; only the tab order is stored beyond them.
183
+
184
+ ## Comments
185
+
186
+ Right-click the canvas to leave a comment on that point, or on the element under it; the pin follows the element when it moves. Shift+right-click keeps Excalidraw's own menu. Click a pin for its thread, where you reply, resolve, reopen or delete. The Comments button lists them all and copies a ready prompt for your agent.
187
+
188
+ The agent works through `daigram comment list --open`, which gives each thread with the element it is on, then `comment resolve <id>... --note "<what changed>"`. It can also `add` a question and `reply`. Resolving several at once is one call.
189
+
190
+ Comments sit beside the scene: not in exports, snapshots or undo, and Clear Canvas leaves them. They persist with `EXCALIDRAW_DATA_DIR`. REST is `/api/comments`, and the MCP tools above do the same as the CLI (except `delete`, which stays in the UI and CLI); touch devices cannot add one from the canvas.
191
+
192
+ ## On a phone
193
+
194
+ Below 700 px wide the header is one slim row (☰ canvases, connection dot, Edit, Comments, Chat, ⋯ for Sync, Clear canvas and site links). The canvases panel slides over the canvas, and Chat and Comments rise from the bottom and leave the top of the canvas in view. On a touch screen the canvas starts **locked**: you can pan, zoom, read, comment and chat, and a stray touch cannot move a shape, and tapping does not select one. **Edit** unlocks the drawing tools and **Done** locks it again; the choice is kept while you switch canvases. Touch devices are locked in either orientation (a phone turned sideways gets the wide header with the same Edit/Done button), and Clear Canvas is off while locked.
195
+
196
+ ## Multiple canvases
197
+
198
+ One server holds several canvases, each with its own scene, comments, snapshots and tabs. The page for a canvas is `/c/<id>`, its API is `/c/<id>/api/...` and its WebSocket is `/c/<id>`; without the prefix you get the canvas `main`. `GET /api/canvases` lists them, `POST /api/canvases {name}` creates one (the id is a slug of the name), `PUT /api/canvases/<id> {name}` renames, `POST /api/canvases/<id>/duplicate {name?}` copies the scene and comments (not snapshots), and `DELETE /api/canvases/<id>` removes one. A removed canvas is moved to `canvases/.trash/` in the data directory, not deleted; `main` cannot be removed. With `EXCALIDRAW_DATA_DIR`, `main` stays in the directory itself and the others sit in `canvases/<id>/`. In the page, **Canvases** in the header opens a side panel to switch (without reloading the page; Back and Forward work), create, rename, duplicate and delete canvases. The CLI and the MCP server work on one canvas at a time: `--canvas <id>` or `CANVAS_ID`. A host in front of the server can answer `GET /api/nav` with `{links:[{label,href}]}` (site-relative links); the header shows them next to the title. The server itself returns none.
199
+
200
+ ## Built-in AI
201
+
202
+ `daigram ai ask "<message>" [--frame <name>]` asks a model to edit the canvas, so no local coding agent is needed. It is off until you set the provider. The key is read from the environment of the process that calls the model, and never reaches the browser, the scene or the model; a canvas server started for you by `ai ask` is not given `AI_*` variables.
203
+
204
+ | Variable | Meaning |
205
+ |---|---|
206
+ | `AI_PROVIDER` | `anthropic` or `openai-compatible` (OpenAI, OpenRouter, Ollama, LM Studio, vLLM) |
207
+ | `AI_MODEL` | Model name |
208
+ | `AI_API_KEY` | API key (optional for local `openai-compatible` endpoints) |
209
+ | `AI_BASE_URL` | Required for `openai-compatible`, for example `https://api.openai.com/v1`; optional for `anthropic` |
210
+ | `AI_MAX_STEPS`, `AI_MAX_OUTPUT_TOKENS` | Limits per run (default 12 and 8192; lower the second for a model that caps replies below that). A reasoning model spends output tokens on thinking, so raise `AI_MAX_OUTPUT_TOKENS` for it |
211
+ | `AI_REQUEST_EXTRA` | A JSON object added to every model request, for provider-specific fields, for example `{"reasoning_effort":"low"}` for GLM (its default effort is max); a field only helps if the model honours it; it cannot override the runner's own fields |
212
+
213
+ The model gets canvas tools only: describe, query, create, update and delete shapes, frames and comments. It has no shell, files or network, and cannot clear the canvas, delete a frame or import and export scenes. Canvas text and comments are treated as data, not instructions. `--frame` holds it to one frame, in that frame's own coordinates: tool arguments are checked, so it cannot delete elements or touch comments outside the frame, and it cannot add frames or comments. Each tool call it makes is its own undo step.
214
+
215
+ In the browser, **Chat** in the header opens a drawer: type a request and the reply, the tool steps it runs and the changes to the canvas appear as it works, with **Stop** to cancel. It offers to keep the model to the frame you are looking at (on by default). The chat keeps what was said, not the tool steps (the model looks at the canvas again each message), and it is kept in the browser, per canvas, across reloads until 12 hours without a message, or **New chat**. Closing the drawer does not stop a run; leaving the page does.
216
+
217
+ The canvas server also exposes it over HTTP, for a chat UI or another client: `GET /api/ai/status`, `POST /api/ai/runs {message, frame?, history?}` (`history` is earlier `{role, text}` turns; 202 with a `runId`, 409 while another run is active, 503 when AI is not configured), `GET /api/ai/runs/:id/events` (server-sent events: `text`, `tool`, `done`, `error`; a late subscriber replays them) and `POST /api/ai/runs/:id/stop`. A request can bring its own model instead of the server's: `X-AI-Provider` (`anthropic` or `openai-compatible`), `X-AI-Model`, `X-AI-Key` and, for openai-compatible, `X-AI-Base-Url`, on `GET /api/ai/status` and `POST /api/ai/runs` (all or none; an incomplete set is a 400, never a run on the server's model; the server's `AI_REQUEST_EXTRA` is not applied to it). Headers, not the body, so a key is never in the saved chat. The chat's **Connect** panel uses this: pick the server's model or your own key (kept in this browser's storage only) and see how to connect an agent over MCP, which works alongside the chat. `AI_REQUEST_HOSTS` (comma-separated host names, https only; `none` allows no request model) limits where such a model may live. Unset, any URL is accepted, which suits a server only you reach; where others can, set it, because the server calls that URL itself. One run at a time per canvas (the routes also work under `/c/<id>/api/ai/...`, and a run draws on its own canvas); it keeps going if the subscriber disconnects, until it finishes or is stopped, so a UI should call stop when it is closed. These routes use your API key and, like the rest of `/api`, have no login of their own: on a non-loopback bind (`HOST=0.0.0.0`, Docker) put authentication in front before setting `AI_*`. These routes sit behind the same cross-site guard as the rest of `/api`. Runs call the canvas over HTTP, so `EXPRESS_SERVER_URL` must point at the server itself (the default does, on the default port); the server warns at startup when it does not.
218
+
219
+ ## Agent Skill
220
+
221
+ 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.
222
+
223
+ ```bash
224
+ npx -y daigram install-skill --dir <skills-root>
225
+ ```
226
+
227
+ 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.
228
+
229
+ Where the skill shines:
230
+
231
+ - **Diagrams as code artifacts**: export `.excalidraw` files into the repo, commit them, re-import + refine when the architecture changes.
232
+ - **Obsidian vaults**: export with a `.excalidraw.md` extension and the file opens natively in the [Obsidian Excalidraw plugin](https://github.com/zsviczian/obsidian-excalidraw-plugin) — no compatibility-mode warning, block references and sync work; `import` reads both plain and lz-string-compressed vault files back.
233
+ - **Self-verifying diagrams**: the agent screenshots its own work and fixes truncation/overlap before calling it done.
234
+ - **No-MCP environments**: CI jobs, plain shells, and frameworks get the same capabilities through the CLI.
235
+
236
+ ## CLI Reference
237
+
238
+ `npx -y daigram <command>` or (after `npm i -g daigram`) `daigram <command>`.
239
+
240
+ 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 (only `mermaid` and `screenshot --renderer browser`). Canvas URL from `EXPRESS_SERVER_URL` or `--url`; `--canvas <id>` (or `CANVAS_ID`) picks the canvas, `main` by default. 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).
241
+
242
+ | Command | Description |
243
+ |---------|-------------|
244
+ | `start` / `stop` / `status` | Manage the canvas server (detached; `stop` identity-checks the live server via `/health` before signaling) |
245
+ | `add [file\|-]` | Batch-create elements from a JSON array (file or stdin); `--one '{...}'` for a single element |
246
+ | `apply [file\|-]` | One-call multi-op patch: `{"create":[...],"update":[{"id":"a","set":{...}}],"delete":["id"]}` |
247
+ | `get <id>` / `delete <id...>` | Read / remove elements |
248
+ | `update <id> --set '{...}'` | Update an element |
249
+ | `query` | `--type`, `--bbox x0,y0,x1,y1`, `--filter k=v` (typed, nested keys), `--filter-json '{...}'` |
250
+ | `selection` | Current canvas selection: `selectedElementIds` and `count` |
251
+ | `describe` | AI-readable scene summary (plain text) |
252
+ | `screenshot` | Render the canvas headless (no browser tab): `--out f.png\|f.svg`, `--format png\|svg`, `--scale 1-4`, `--dark`, `--padding N`, `--no-background`, `--ids a,b`, `--frame <id>`, `--no-embed-fonts`, `--embed-scene` (editable PNG); `--renderer browser` uses an open tab instead |
253
+ | `render [file\|-]` | Render a `.excalidraw` / `.excalidraw.md` / embedded-scene PNG file to PNG/SVG offline — no canvas server, same flags as `screenshot` |
254
+ | `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` also reads PNGs with embedded scenes |
255
+ | `mermaid [file\|-]` | Mermaid → canvas (browser tab required) |
256
+ | `canvases list\|create\|rename\|duplicate\|delete` | Manage canvases (see Multiple canvases) |
257
+ | `snapshot save\|list\|restore <name>` | Named snapshots; Clear Canvas and a replace also keep the last three scenes they discarded as `auto-…` snapshots |
258
+ | `comment list\|add\|reply\|resolve\|reopen\|delete` | Read and answer comments pinned on the canvas |
259
+ | `ai ask <message> [--frame <name>]` | Ask a model to edit the canvas (see [Built-in AI](#built-in-ai)) |
260
+ | `frame list\|add\|reorder\|delete` | The canvas's frames. `reorder <name\|id> <position>` changes tab order only (1 = first tab) and moves nothing. `list` and `add` report `canvasX`/`canvasY` in canvas coordinates; `--frame <name\|id>` on `add`, `apply`, `update`, `get`, `query`, `describe`, `screenshot` and `comment list` is relative to the frame's top-left corner, which is (0, 0) |
261
+ | `arrange align\|distribute\|group\|ungroup\|lock\|unlock\|duplicate` | Layout ops (`--ids a,b,c`, `--to left\|horizontal\|...`) |
262
+ | `share` | Encrypted upload → shareable URL (excalidraw.com by default; configurable self-hosted target) |
263
+ | `clear --yes` | Wipe the canvas |
264
+ | `install-skill [--dir <skills-root>]` | Install the portable agent skill |
265
+
266
+ Labels and arrow bindings use the agent-friendly format everywhere in the CLI: `"text"` on any shape, `"startElementId"`/`"endElementId"` on arrows — normalization is automatic. For a native frame, add a `"type":"frame"` element with a `"name"` and set `"frameId"` on its children.
267
+
268
+ ## Headless Rendering
269
+
270
+ `screenshot`, `export_to_image` and `get_canvas_screenshot` render without a browser. Inside the canvas server, the scene is prepared with the canvas tab's own code (label sizing, wrapping and centering, defaults) and Excalidraw's own `exportToSvg` draws it under Node (a small jsdom shim supplies the DOM it expects, and text is measured with the bundled fonts' real glyph widths); [resvg](https://github.com/thx/resvg-js) rasterizes the SVG to PNG. The output is what the Excalidraw canvas draws — same SVG structure as a browser export, text within half a pixel — and it is deterministic: an unchanged scene renders to byte-identical SVG and PNG, so committed images stay diff-clean.
271
+
272
+ - **Fonts**: Excalifont, Virgil, Cascadia Code and Liberation Sans ship as TTFs in `assets/fonts` (all SIL OFL 1.1; see `assets/fonts/LICENSES.md`). SVGs embed the faces they use, so they look right in browsers, GitHub and editors. Nunito, Lilita One and Comic Shanns render with the closest bundled face for now. Text in other scripts (CJK, emoji) falls back to the machine's fonts, with a warning.
273
+ - **Options** (CLI flags / REST body / MCP params): `background`, `dark`, `scale` 1–4 (PNG), `padding`, `elementIds` or `frameId` to render a subset, `embedFonts` (CLI/REST only), `embedScene` (PNG only, default false). `EXCALIDRAW_RENDER_MAX_DIM` (default 8192) caps the PNG's largest side.
274
+ - **`--renderer browser`** asks an open canvas tab to render instead (the pre-2.1 path). Useful for a second opinion; it is slower and the tab's unsynced edits are discarded first.
275
+ - **Offline**: `render docs/arch.excalidraw --out docs/arch.png` needs no canvas server at all — a natural fit for CI jobs that keep images next to committed diagrams.
276
+ - **Still browser-bound**: Mermaid conversion (`mermaid`, `create_from_mermaid`) and `set_viewport`.
277
+
278
+ The renderer bundle is built by `npm run build:server` (`dist/render/excalidraw-node.mjs`); `npm run test:render` exercises it without a browser.
279
+
280
+ ## Configure MCP Clients
281
+
282
+ The MCP server runs over stdio (or over HTTP at `/mcp`, see below). The simplest config is `npx` — no clone, no absolute paths, and the canvas auto-starts. If your MCP client and canvas are on different machines, start with [Remote Canvas and HTTP-Only MCP Clients](#remote-canvas-and-http-only-mcp-clients).
283
+
284
+ ### Environment Variables
285
+
286
+ | Variable | Description | Default |
287
+ |----------|-------------|---------|
288
+ | `EXPRESS_SERVER_URL` | URL of the canvas server | `http://127.0.0.1:3000` |
289
+ | `CANVAS_ID` | Canvas the CLI and the MCP server work on (`--canvas` for the CLI) | `main` |
290
+ | `ENABLE_CANVAS_SYNC` | Enable real-time canvas sync | `true` |
291
+ | `EXCALIDRAW_NO_AUTOSTART` | Set `1` to disable canvas auto-start | (unset) |
292
+ | `EXCALIDRAW_HEADERS` | JSON object of extra HTTP headers sent on every request to the canvas server, e.g. `{"Authorization":"Bearer <secret>"}`. For a canvas behind a reverse proxy that expects a header. See [Extra Request Headers](#extra-request-headers) | (unset) |
293
+ | `EXCALIDRAW_EXPORT_DIR` | Directory MCP file tools may read and write (symlinks resolved; `.excalidraw`, `.json`, `.md`, `.png`, `.svg` files only) | current working dir |
294
+ | `EXCALIDRAW_RENDER_MAX_DIM` | Largest side of a headless PNG, in pixels | `8192` |
295
+ | `EXCALIDRAW_PNG_WORKER_TIMEOUT_MS` | Timeout for the isolated PNG rasterizer, in milliseconds | `120000` |
296
+ | `EXCALIDRAW_DATA_DIR` | Optional local durable-state directory | (unset; in-memory) |
297
+ | `EXCALIDRAW_SHARE_UPLOAD_URL` | Where `share` uploads the encrypted scene (an excalidraw-json `POST` endpoint) | `https://json.excalidraw.com/api/v2/post/` |
298
+ | `EXCALIDRAW_SHARE_BASE_URL` | Excalidraw app that share links open in | `https://excalidraw.com` |
299
+ | `PORT` / `HOST` | Canvas server bind address | `3000` / `127.0.0.1` |
300
+ | `ALLOWED_ORIGINS` | Comma-separated extra origins allowed to call the canvas API from a browser | none |
301
+ | `LOG_LEVEL` | Log verbosity (`error`, `warn`, `info`, `debug`) | `info` |
302
+ | `LOG_FILE_PATH` | Log file location | `~/Library/Logs/excalidraw-mcp.log` (macOS), `$XDG_STATE_HOME/excalidraw-mcp/excalidraw.log` (Linux), `%LOCALAPPDATA%\Excalidraw-MCP\excalidraw.log` (Windows) |
303
+
304
+ ### Extra Request Headers
305
+
306
+ If the canvas sits behind a reverse proxy that expects a header, set `EXCALIDRAW_HEADERS` to a JSON object. The CLI and MCP server add these headers to every canvas API request:
307
+
308
+ ```bash
309
+ export EXPRESS_SERVER_URL=https://canvas.example.com
310
+ export EXCALIDRAW_HEADERS='{"Authorization":"Bearer <secret>"}'
311
+ ```
312
+
313
+ - The headers are **not** sent on the `/health` identity probe, so the proxy must serve `/health` without requiring them; otherwise the CLI reports a foreign service.
314
+ - They are refused over plain `http://` to a non-local host (set `EXCALIDRAW_ALLOW_INSECURE_HEADERS=1` on a trusted network, e.g. `http://host.docker.internal`).
315
+ - Redirects are not followed while they are set, so the headers cannot leak to another host. Point `EXPRESS_SERVER_URL` at the final URL.
316
+ - Hop-by-hop headers (`Host`, `Content-Length`, `Connection`, ...) cannot be set. Invalid configuration fails at once (the MCP server exits at startup) with a message that never echoes header values.
317
+
318
+ ### Remote Canvas and HTTP-Only MCP Clients
319
+
320
+ There are two separate connections:
321
+
322
+ - **MCP client ↔ MCP process:** an MCP client that supports local commands launches the stdio MCP process and owns its stdin/stdout.
323
+ - **MCP process ↔ canvas:** `EXPRESS_SERVER_URL` points to the canvas server's REST API. The browser UI uses a WebSocket on that same server and port.
324
+
325
+ The canvas server also serves MCP over HTTP (stateless Streamable HTTP, no `/sse`), so a client that connects by URL needs no local process: `/mcp` works on the main canvas and `/c/<id>/mcp` on that canvas. For example `claude mcp add --transport http excalidraw http://127.0.0.1:3000/mcp`. The endpoint has the same cross-site protection as `/api`, and the tools call the canvas server at `EXPRESS_SERVER_URL`, so that must point at the server itself (the default does, on the default port).
326
+
327
+ To keep a remote canvas on its default loopback-only binding, run the MCP process on your workstation and tunnel the canvas port to that machine:
328
+
329
+ ```bash
330
+ # Keep this running. The remote canvas remains bound to remote 127.0.0.1:3000.
331
+ ssh -N -L 13000:127.0.0.1:3000 user@canvas-host
332
+ ```
333
+
334
+ Then configure the local MCP process against the local end of the tunnel. The URL port must match the first port in the SSH command:
335
+
336
+ ```json
337
+ {
338
+ "mcpServers": {
339
+ "excalidraw": {
340
+ "command": "npx",
341
+ "args": ["-y", "daigram"],
342
+ "env": {
343
+ "EXPRESS_SERVER_URL": "http://127.0.0.1:13000",
344
+ "EXCALIDRAW_NO_AUTOSTART": "1"
345
+ }
346
+ }
347
+ }
348
+ }
349
+ ```
350
+
351
+ Start the tunnel before the MCP client and leave it open while tools run. In this example the MCP process and browser run on the workstation, so both can use `http://127.0.0.1:13000`; the WebSocket also follows the page's host and port. `127.0.0.1` always means the machine or container running that process. If the MCP process runs in a container, the workstation's loopback tunnel is not that container's loopback: run the tunnel in the same network namespace as the MCP process, or configure a canvas address that is reachable from the container and protect any listener exposed beyond loopback.
352
+
353
+ If an Open WebUI, LM Studio, or other MCP client setup accepts only HTTP-based MCP connections, it cannot use the canvas URL in place of MCP. It needs a separately configured stdio-to-HTTP MCP bridge in front of this stdio server; bridge setup and client transport support are outside this project.
354
+
355
+ As a direct-LAN alternative, run the canvas process with an explicit non-loopback bind, for example from a built source checkout: `HOST=0.0.0.0 PORT=3000 node dist/server.js`. Then set the MCP process's `EXPRESS_SERVER_URL` to `http://canvas-host:3000`. The canvas container already binds `HOST=0.0.0.0`, and Compose publishes `3000:3000`; scope that port mapping or bind it to a trusted interface when possible. The CLI `start` command only auto-starts a loopback canvas, so it is not the way to create this LAN listener. The source default remains `HOST=127.0.0.1`.
356
+
357
+ Direct LAN access exposes the canvas REST and WebSocket APIs without authentication; the cross-site check does not replace it. Restrict that port to a trusted network/VPN with firewall or network-level access controls; do not expose it to the public internet.
358
+
359
+ #### Durable canvas state
360
+
361
+ Set `EXCALIDRAW_DATA_DIR` to recover elements, server-known image files, and named snapshots after a canvas-server restart. From a source checkout after `npm run build`:
362
+
363
+ ```bash
364
+ EXCALIDRAW_DATA_DIR=/absolute/private/canvas-data \
365
+ node dist/bin.js start
366
+ ```
367
+
368
+ When the variable is unset, behavior and API semantics remain in-memory and no durable-state directory is created. When enabled, the directory contains a versioned `canvas-state-v1.json` checkpoint, a `blobs/` directory, and a runtime `canvas-state.lock/` ownership directory. Image payloads are stored once as immutable file-id blobs at a path-safe SHA-256 of each file ID; checkpoints record a separate content SHA-256 and contain references only. A new blob is flushed and atomically published before any checkpoint is allowed to reference it. Each accepted mutation flushes a temporary checkpoint and atomically renames it before the server broadcasts or acknowledges the mutation. Serialization recursively sorts object keys, preserves scene stacking order, and stores file and named-snapshot metadata in stable ID/name order. Invalid JSON, unsupported schemas, non-regular checkpoint paths, missing blobs, and blob-integrity failures stop startup rather than replacing recoverable state with an empty scene.
369
+
370
+ Two REST rules are stricter in durable mode, and both return `409`: upload an image's file (`POST /api/files`) before the element that references it, and never re-upload a file ID with different content. The canvas tab and `import` already work this way.
371
+
372
+ If the checkpoint has already been renamed into place but the final directory flush fails, the request fails without a success broadcast and further mutations are refused until restart. The published scene stays in memory so it agrees with the file on disk; the failed request may appear in the recovered scene. On Windows, Node.js does not provide directory fsync, so the store flushes file contents and uses atomic publication without claiming the same directory durability barrier.
373
+
374
+ The data-directory lock grants one process exclusive ownership of that durable state, including when servers use different ports. It stores one token-specific owner file so stale-lock reclamation cannot delete a newer owner's evidence. The existing pidfile has a separate job: it identifies a listening process for `start` / `stop` lifecycle commands. Local filesystems and one writer are supported; network filesystems, shared multi-writer access, automatic blob garbage collection, databases, and cloud persistence are out of scope.
375
+
376
+ > **Privacy:** durable state contains the diagram and embedded image payloads. Keep the directory outside repositories and shared folders, restrict its permissions, and mount it as a private writable volume when using containers.
377
+
378
+ ---
379
+
380
+ ### Claude Desktop
381
+
382
+ Config location:
383
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
384
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
385
+ - Linux: `~/.config/Claude/claude_desktop_config.json`
386
+
387
+ **npx (recommended)**
388
+ ```json
389
+ {
390
+ "mcpServers": {
391
+ "excalidraw": {
392
+ "command": "npx",
393
+ "args": ["-y", "daigram"]
394
+ }
395
+ }
396
+ }
397
+ ```
398
+
399
+ **Local (node)**
400
+ ```json
401
+ {
402
+ "mcpServers": {
403
+ "excalidraw": {
404
+ "command": "node",
405
+ "args": ["/absolute/path/to/daigram/dist/index.js"],
406
+ "env": {
407
+ "EXPRESS_SERVER_URL": "http://127.0.0.1:3000",
408
+ "ENABLE_CANVAS_SYNC": "true"
409
+ }
410
+ }
411
+ }
412
+ }
413
+ ```
414
+
415
+ **Docker**
416
+ ```json
417
+ {
418
+ "mcpServers": {
419
+ "excalidraw": {
420
+ "command": "docker",
421
+ "args": [
422
+ "run", "-i", "--rm",
423
+ "-e", "EXPRESS_SERVER_URL=http://host.docker.internal:3000",
424
+ "-e", "ENABLE_CANVAS_SYNC=true",
425
+ "daigram-mcp:latest"
426
+ ]
427
+ }
428
+ }
429
+ }
430
+ ```
431
+
432
+ ---
433
+
434
+ ### Claude Code
435
+
436
+ **npx (recommended)**
437
+ ```bash
438
+ claude mcp add excalidraw --scope user -- npx -y daigram
439
+ ```
440
+
441
+ > Tip: for coding agents, the skill + CLI often beats MCP config entirely — let the agent pick its skill root, then run `npx -y daigram install-skill --dir <skills-root>`.
442
+
443
+ **Local (node)** - User-level (available across all projects):
444
+ ```bash
445
+ claude mcp add excalidraw --scope user \
446
+ -e EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
447
+ -e ENABLE_CANVAS_SYNC=true \
448
+ -- node /absolute/path/to/daigram/dist/index.js
449
+ ```
450
+
451
+ **Docker**
452
+ ```bash
453
+ claude mcp add excalidraw --scope user \
454
+ -- docker run -i --rm \
455
+ -e EXPRESS_SERVER_URL=http://host.docker.internal:3000 \
456
+ -e ENABLE_CANVAS_SYNC=true \
457
+ daigram-mcp:latest
458
+ ```
459
+
460
+ **Manage servers:**
461
+ ```bash
462
+ claude mcp list # List configured servers
463
+ claude mcp remove excalidraw # Remove a server
464
+ ```
465
+
466
+ ---
467
+
468
+ ### Cursor
469
+
470
+ Config location: `.cursor/mcp.json` in your project root (or `~/.cursor/mcp.json` for global config)
471
+
472
+ **npx (recommended)**
473
+ ```json
474
+ {
475
+ "mcpServers": {
476
+ "excalidraw": {
477
+ "command": "npx",
478
+ "args": ["-y", "daigram"]
479
+ }
480
+ }
481
+ }
482
+ ```
483
+
484
+ **Docker**
485
+ ```json
486
+ {
487
+ "mcpServers": {
488
+ "excalidraw": {
489
+ "command": "docker",
490
+ "args": [
491
+ "run", "-i", "--rm",
492
+ "-e", "EXPRESS_SERVER_URL=http://host.docker.internal:3000",
493
+ "-e", "ENABLE_CANVAS_SYNC=true",
494
+ "daigram-mcp:latest"
495
+ ]
496
+ }
497
+ }
498
+ }
499
+ ```
500
+
501
+ ---
502
+
503
+ ### Codex CLI
504
+
505
+ **npx (recommended)**
506
+ ```bash
507
+ codex mcp add excalidraw -- npx -y daigram
508
+ ```
509
+
510
+ **Docker**
511
+ ```bash
512
+ codex mcp add excalidraw \
513
+ -- docker run -i --rm \
514
+ -e EXPRESS_SERVER_URL=http://host.docker.internal:3000 \
515
+ -e ENABLE_CANVAS_SYNC=true \
516
+ daigram-mcp:latest
517
+ ```
518
+
519
+ **Manage servers:**
520
+ ```bash
521
+ codex mcp list # List configured servers
522
+ codex mcp remove excalidraw # Remove a server
523
+ ```
524
+
525
+ ---
526
+
527
+ ### OpenCode
528
+
529
+ Config location: `~/.config/opencode/opencode.json` or project-level `opencode.json`
530
+
531
+ ```json
532
+ {
533
+ "$schema": "https://opencode.ai/config.json",
534
+ "mcp": {
535
+ "excalidraw": {
536
+ "type": "local",
537
+ "command": ["npx", "-y", "daigram"],
538
+ "enabled": true
539
+ }
540
+ }
541
+ }
542
+ ```
543
+
544
+ ---
545
+
546
+ ### Antigravity (Google)
547
+
548
+ Config location: `~/.gemini/antigravity/mcp_config.json`
549
+
550
+ ```json
551
+ {
552
+ "mcpServers": {
553
+ "excalidraw": {
554
+ "command": "npx",
555
+ "args": ["-y", "daigram"]
556
+ }
557
+ }
558
+ }
559
+ ```
560
+
561
+ ---
562
+
563
+ ### Notes
564
+
565
+ - **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`. The Docker MCP image sets `EXCALIDRAW_NO_AUTOSTART=1` (it has no frontend build) — run the canvas as its own container.
566
+ - **Canvas persistence**: By default, elements and named snapshots are held in memory and are lost on server restart. Set `EXCALIDRAW_DATA_DIR` for restart recovery of elements, server-known image files, and named snapshots (see [Durable canvas state](#durable-canvas-state)). Use `export` to save a standalone `.excalidraw` file; taking a snapshot alone does not provide restart recovery in the default in-memory mode.
567
+
568
+ ## MCP Tools
569
+
570
+ | Category | Tools |
571
+ |---|---|
572
+ | **Element CRUD** | `create_element`, `get_element`, `update_element`, `delete_element`, `delete_elements`, `query_elements` (`limit`, `offset`, `fields` to page), `batch_create_elements`, `duplicate_elements` (true copy: labels, groups and links between the copies) |
573
+ | **Layout** | `align_elements`, `distribute_elements`, `move_elements`, `reorder_elements` (stacking order), `fit_to_text` (grow shapes to their labels), `route_arrows` (right-angled connectors round other shapes), `group_elements`, `ungroup_elements`, `lock_elements`, `unlock_elements` |
574
+ | **Scene Awareness** | `describe_scene`, `check_layout` (labels that do not fit, overlaps, arrows through shapes, cramped or oversized shapes, clipping), `get_canvas_screenshot`, `get_selection` |
575
+ | **File I/O** | `export_scene`, `import_scene`, `export_to_image`, `export_to_excalidraw_url`, `create_from_mermaid` |
576
+ | **State Management** | `clear_canvas`, `snapshot_scene`, `restore_snapshot` |
577
+ | **Frames** | `list_frames`, `add_frame` (`around` wraps existing elements), `move_elements_to_frame`, `reorder_frame`; `frame` on `describe_scene`, `batch_create_elements`, `update_element`, `get_element` and `query_elements` |
578
+ | **Comments** | `list_comments`, `add_comment`, `reply_to_comment`, `resolve_comments`, `reopen_comment` |
579
+ | **Viewport** | `set_viewport` |
580
+ | **Design Guide** | `read_diagram_guide` |
581
+ | **Resources** | `get_resource` |
582
+
583
+ `get_selection` / CLI `selection` return `selectedElementIds` and `count`. Select elements in an open canvas tab first; among connected tabs, the last selection change wins. With no selection, the list is empty. Selection is not persisted, even in durable mode.
584
+
585
+ MCP file paths must stay inside `EXCALIDRAW_EXPORT_DIR` after symlink resolution; broken symlinks are refused. `export_scene` accepts `.excalidraw`, `.json` and `.md`; `import_scene` also accepts embedded-scene `.png`; `export_to_image` accepts `.png` or `.svg` matching its format. These restrictions do not apply to CLI file I/O.
586
+
587
+ Full schemas are discoverable via `tools/list` or in `skills/excalidraw-skill/references/cheatsheet.md`.
588
+
589
+ Viewport group focus can tune framing with `viewportZoomFactor`:
590
+
591
+ ```json
592
+ {
593
+ "scrollToElementIds": ["id1", "id2", "id3"],
594
+ "viewportZoomFactor": 0.85
595
+ }
596
+ ```
597
+
598
+ `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.
599
+
600
+ ## Quick Start (From Source / Docker)
601
+
602
+ From source (Node >= 20):
603
+
604
+ ```bash
605
+ npm ci
606
+ npm run build
607
+ PORT=3000 npm run canvas # canvas server (terminal 1)
608
+ node dist/index.js # MCP server over stdio (terminal 2, usually launched by your MCP client)
609
+ node dist/bin.js status # or drive the CLI straight from the build
610
+ ```
611
+
612
+ Docker canvas server (run these from `packages/core`):
613
+ ```bash
614
+ docker build -f Dockerfile.canvas -t daigram-canvas .
615
+ docker run -d -p 3000:3000 --name daigram-canvas daigram-canvas:latest
616
+ ```
617
+
618
+ MCP server image: build it with `docker build -t daigram-mcp .`, then use `daigram-mcp:latest` (stdio; point `EXPRESS_SERVER_URL` at the canvas container).
619
+
620
+ ## Testing
621
+
622
+ ### CLI Smoke Test
623
+
624
+ ```bash
625
+ npx -y daigram start
626
+ npx -y daigram status
627
+ npx -y daigram add --one '{"type":"rectangle","x":100,"y":100,"width":300,"height":200}'
628
+ npx -y daigram describe
629
+ ```
630
+
631
+ ### Canvas Smoke Test (HTTP)
632
+
633
+ ```bash
634
+ curl http://127.0.0.1:3000/health
635
+ ```
636
+
637
+ ### Regression Checks
638
+
639
+ `npm test` builds the server and runs seven suites, each also available on its own:
640
+
641
+ ```bash
642
+ npm test
643
+ npm run test:mcp # MCP stdio wire protocol (see below)
644
+ npm run test:bind # default loopback bind, duplicate-start refusal
645
+ npm run test:render # headless renderer, export order keys, scene-prep stability
646
+ npm run test:state # atomic import and snapshot restore, sync validation
647
+ npm run test:durable # restart recovery, checkpoint failures, directory ownership
648
+ npm run test:share # default and self-hosted share targets
649
+ npm run test:paths # MCP file containment, symlinks, allowed file types
650
+ ```
651
+
652
+ ### Canvas Browser Regression Tests
653
+
654
+ These Chromium tests build the app and start an isolated localhost server. They
655
+ cover frame reload/reconnect, mixed scenes, failed-load sync protection, stale
656
+ responses, clearing/deletion, Mermaid imports, SVG export, dropped images, and
657
+ text measurement after fonts load. They refuse to reuse an existing server; set
658
+ `CANVAS_TEST_PORT` if port 51910 is occupied.
659
+
660
+ ```bash
661
+ npx playwright install chromium
662
+ npm run type-check:frontend
663
+ npm run test:canvas
664
+ ```
665
+
666
+ ### MCP Stdio Wire Test
667
+
668
+ Drives `dist/index.js` with raw JSON-RPC frames and checks both protocol eras:
669
+ `server/discover`, tool calls sent without any handshake, refusal of unsupported
670
+ protocol revisions and malformed `_meta` envelopes, and the legacy `initialize`
671
+ path.
672
+
673
+ ```bash
674
+ npm run test:mcp
675
+ ```
676
+
677
+ ### MCP Smoke Test (MCP Inspector)
678
+
679
+ List tools:
680
+ ```bash
681
+ npx @modelcontextprotocol/inspector --cli \
682
+ -e EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
683
+ -e ENABLE_CANVAS_SYNC=true -- \
684
+ node dist/index.js --method tools/list
685
+ ```
686
+
687
+ Create a rectangle:
688
+ ```bash
689
+ npx @modelcontextprotocol/inspector --cli \
690
+ -e EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
691
+ -e ENABLE_CANVAS_SYNC=true -- \
692
+ node dist/index.js --method tools/call --tool-name create_element \
693
+ --tool-arg type=rectangle --tool-arg x=100 --tool-arg y=100 \
694
+ --tool-arg width=300 --tool-arg height=200
695
+ ```
696
+
697
+ ### Frontend Screenshots (agent-browser)
698
+
699
+ If you use `agent-browser` for UI checks:
700
+ ```bash
701
+ agent-browser install
702
+ agent-browser open http://127.0.0.1:3000
703
+ agent-browser wait --load networkidle
704
+ agent-browser screenshot /tmp/canvas.png
705
+ ```
706
+
707
+ ## FAQ
708
+
709
+ ### How is this different from the official Excalidraw MCP?
710
+
711
+ The [official Excalidraw MCP](https://github.com/excalidraw/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 you and your 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](#how-we-differ-from-the-official-excalidraw-mcp).
712
+
713
+ ### Which AI tools does it work with?
714
+
715
+ 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.
716
+
717
+ ### Can the AI actually see the diagram it drew?
718
+
719
+ 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.
720
+
721
+ ### Do I need a browser open?
722
+
723
+ No. Screenshots and PNG/SVG exports render headless inside the canvas server (see [Headless Rendering](#headless-rendering)), and everything else — creating, querying, updating elements, `.excalidraw` files — never needed one. Only two things still need an open tab: Mermaid conversion (it lays out in the browser) and viewport control (it moves a camera). The CLI exits with code `4` and tells you when that is the case. Opening the URL is still the way for a human to watch the agent draw.
724
+
725
+ ### Are my diagrams persistent?
726
+
727
+ By default the canvas is in-memory (restart = blank canvas). Set `EXCALIDRAW_DATA_DIR` for automatic local restart recovery of elements, server-known image files, and named snapshots. Portable, reviewable artifacts should still be exported as `.excalidraw` files and committed to your repo when appropriate.
728
+
729
+ ### Are excalidraw.com share links private?
730
+
731
+ `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.
732
+
733
+ ### Can share links point at a self-hosted Excalidraw?
734
+
735
+ Yes. Set `EXCALIDRAW_SHARE_UPLOAD_URL` to your storage backend's scene endpoint and `EXCALIDRAW_SHARE_BASE_URL` to your Excalidraw app. Any backend that speaks the excalidraw-json API works, for example [alswl/excalidraw-storage-backend](https://github.com/alswl/excalidraw-storage-backend), whose endpoint is `<storage>/api/v2/scenes/`:
736
+
737
+ ```bash
738
+ EXCALIDRAW_SHARE_UPLOAD_URL=https://draw.example.com/api/v2/scenes/ \
739
+ EXCALIDRAW_SHARE_BASE_URL=https://draw.example.com \
740
+ npx -y daigram share
741
+ ```
742
+
743
+ Your app must load `#json=` links from that same backend (for the alswl fork: `VITE_APP_BACKEND_V2_GET_URL`).
744
+
745
+ ### Does it need an API key or cloud service?
746
+
747
+ No API key is required. Core drawing runs locally (AGPL-3.0). Outbound traffic is limited to the optional `share` upload to excalidraw.com (or your own instance, see above) and, only if you use the built-in AI (chat or `ai ask`), requests to the model provider you configure. The CLI, MCP server and headless renderer make no other network calls.
748
+
749
+ ### Can I use it without configuring MCP?
750
+
751
+ Yes — that's the recommended path for coding agents: `npx -y daigram install-skill --dir <skills-root>` and the agent drives everything through the CLI. MCP configuration is only needed for chat clients like Claude Desktop.
752
+
753
+ ### Can the MCP client and canvas run on different machines?
754
+
755
+ Yes, if the MCP process can reach the canvas server. Keep the MCP process on the machine that launches it and set `EXPRESS_SERVER_URL` to that canvas location. The canvas HTTP/WebSocket URL is not an MCP endpoint; for an HTTP-only MCP client, configure a separate stdio-to-HTTP bridge. See [Remote Canvas and HTTP-Only MCP Clients](#remote-canvas-and-http-only-mcp-clients) for a loopback-preserving SSH tunnel and matching JSON configuration.
756
+
757
+ ## Troubleshooting
758
+
759
+ - **CLI exit code 3** (canvas unreachable): the server is not running for an inspecting command such as `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.
760
+ - **CLI exit code 4** (browser required): only `mermaid` and `screenshot --renderer browser` need an open tab — open `http://127.0.0.1:3000` in a browser and retry, or drop `--renderer browser` to render headless.
761
+ - **Headless PNG shows boxes instead of CJK/emoji text**: the bundled fonts cover Latin scripts; for other scripts resvg falls back to the machine's fonts (a warning is printed). Install a CJK font on the machine running the canvas server.
762
+ - **Canvas not updating**: confirm `EXPRESS_SERVER_URL` points at the running canvas server (`status` shows the URL in use).
763
+ - **Something else looks wrong**: the server log has the details; its location is in [Environment Variables](#environment-variables) (`LOG_FILE_PATH`).
764
+
765
+ ## Known Issues / TODO
766
+
767
+ - [x] **Optional persistent storage**: set `EXCALIDRAW_DATA_DIR` for atomic local restart recovery; the default remains in-memory.
768
+ - [ ] **Mermaid conversion requires a browser**: `mermaid` / `create_from_mermaid` lay out the diagram in the frontend. Image export and screenshots are headless.
769
+
770
+ Contributions welcome!
771
+
772
+ ## Development
773
+
774
+ ```bash
775
+ npm run type-check
776
+ npm run build
777
+ npm run cli -- status # run the CLI from the local build
778
+ npm run sync:skills # after editing skills/excalidraw-skill, sync the repo-local agent copy
779
+ ```
780
+
781
+ Bug reports and pull requests are welcome on [GitHub issues](https://github.com/joshuakosasih/dAIgram/issues). If this project helps you, a ⭐ helps others find it.
782
+
783
+ ## License
784
+
785
+ [AGPL-3.0-only](LICENSE) for the changes and additions in this project; the work it is based on, [mcp_excalidraw](https://github.com/yctimlin/mcp_excalidraw) © [yctimlin](https://github.com/yctimlin), stays under its [MIT license](LICENSE-MIT) (see [NOTICE](NOTICE)). Not affiliated with the Excalidraw team. [Excalidraw](https://github.com/excalidraw/excalidraw) is its own MIT-licensed project.
786
+
787
+ Contributions: see [CONTRIBUTING](CONTRIBUTING.md). Security: see [SECURITY](SECURITY.md).
788
+
789
+ **Links:** [npm package](https://www.npmjs.com/package/daigram) · [GitHub](https://github.com/joshuakosasih/dAIgram) · [Issues](https://github.com/joshuakosasih/dAIgram/issues)