How yctimlin/mcp_excalidraw works
The product is a local Excalidraw workbench driven by coding agents through CLI, MCP, or HTTP. The main loop is to create or convert a diagram, inspect and refine the live canvas, then export or share it. The README documents broader capabilities than the sampled source; paths and links for those features are included only where the tree or excerpts support them.
Main entry points: run.ts CLI dispatcher · canvas-client.ts Canvas API client · mcp-dispatch.ts Tool dispatcher · App.tsx Excalidraw UI
Components 25
Agent interfaces
- CLI dispatcher
src/cli/run.ts - MCP stdio entry
src/index.ts - Canvas REST API
src/server.ts
Command orchestration
- Element commands
src/cli/commands/elements.ts - Scene commands
src/cli/commands/scene.ts - Arrange commands
src/cli/commands/arrange.ts - Snapshot commands
src/cli/commands/snapshot.ts - Server commands
src/cli/commands/server.ts - MCP tool server
src/core/mcp-server.ts - Tool dispatcher
src/core/mcp-dispatch.ts - Canvas startup
src/core/canvas-state.ts
Live canvas
- Canvas API client
src/core/canvas-client.ts - Canvas server
src/server.ts - Excalidraw UI
frontend/src/App.tsx - Live element state
src/server.ts
Diagram operations
- Scene normalization
frontend/src/utils/scene.ts - Layout operations
src/core/geometry.ts - Scene file I/O
src/core/scene-io.ts - Share export
src/core/share-url.ts - Mermaid converter
frontend/src/utils/mermaidConverter.ts
Other components
- Coding agent
- CLI user
- MCP client
- HTTP client
- Excalidraw sharing
Connections 29
- Coding agent → CLI dispatcher: runs commands
- Coding agent → MCP client: requests tools
- CLI user → CLI dispatcher: runs commands
- MCP client → MCP stdio entry: stdio requests
- HTTP client → Canvas REST API: HTTP requests
- CLI dispatcher → Element commands: dispatches
- CLI dispatcher → Scene commands: dispatches
- CLI dispatcher → Arrange commands: dispatches
- CLI dispatcher → Snapshot commands: dispatches
- CLI dispatcher → Server commands: dispatches
- MCP stdio entry → MCP tool server: starts
- MCP tool server → Tool dispatcher: dispatches tools
- Tool dispatcher → Canvas startup: ensures ready
- Server commands → Canvas startup: starts or stops
- Element commands → Canvas API client: reads and writes
- Scene commands → Canvas API client: imports and exports
- Arrange commands → Canvas API client: updates layout
- Snapshot commands → Canvas API client: uses canvas
- Tool dispatcher → Canvas API client: reads and writes
- Tool dispatcher → Layout operations: arranges elements
- Tool dispatcher → Share export: exports share URL
- Canvas API client → Canvas server: HTTP requests
- Canvas REST API → Live element state: reads and writes
- Canvas server → Excalidraw UI: serves UI
- Excalidraw UI → Canvas server: syncs over WebSocket
- Excalidraw UI → Scene normalization: restores scenes
- Excalidraw UI → Mermaid converter: converts diagrams
- Excalidraw UI → Canvas server: sends scene updates
- Share export → Excalidraw sharing: uploads encrypted scene