Skip to content

Comparison

Several MCP-based tools can generate diagrams from AI coding assistants. This page compares drawmode with other popular options to help you choose the right tool for your workflow.

FeaturedrawmodeExcalidraw MCPMermaid MCPDraw.io MCP
InputTypeScript SDKNatural languageMermaid syntaxNatural language
Auto-layoutGraphviz (Sugiyama)ManualBuilt-inBuilt-in
Edge routingOrthogonal 90°ManualBasicCurves
Color presets28 (general + cloud)Custom hex5 themesBuilt-in
Edit existingfromFile() + updateNode()YesReimportYes
Outputsfile, URL, PNG, SVGInteractive UIPNG, SVGXML
Cloud deployCloudflare WorkersCloud-hostedLocal onlyLocal only
ValidationSDK runtime + Zig WASMCanvas feedbackSyntaxNone
Sequence diagramsYes (addActor/message)ManualYesYes
Multi-format outputYes (["excalidraw", "svg"])NoNoNo
Code ModeYes (typed SDK)No (raw JSON)No (DSL)No (XML)

Side-by-Side: Same Diagram, Different Approaches

Section titled “Side-by-Side: Same Diagram, Different Approaches”

Here’s the same 3-node diagram expressed in each tool’s format:

drawmode — 6 lines of TypeScript:

const d = new Diagram();
const api = d.addBox("API", { color: "backend" });
const db = d.addBox("DB", { color: "database" });
d.connect(api, db, "queries");
return d.render();

Raw Excalidraw JSON — ~120 lines (abbreviated):

{
"elements": [
{ "id": "rect1", "type": "rectangle", "x": 100, "y": 100,
"width": 180, "height": 80, "backgroundColor": "#d0bfff",
"strokeColor": "#7048e8", "boundElements": [{"type":"text","id":"t1"}], ... },
{ "id": "t1", "type": "text", "text": "API", "containerId": "rect1", ... },
{ "id": "rect2", "type": "rectangle", "x": 100, "y": 300, ... },
{ "id": "t2", "type": "text", "text": "DB", "containerId": "rect2", ... },
{ "id": "arr1", "type": "arrow", "x": 190, "y": 180,
"points": [[0,0],[0,120]], "elbowed": true, "roundness": null,
"roughness": 0, "startBinding": {"elementId":"rect1",...},
"endBinding": {"elementId":"rect2",...}, ... }
]
}

Mermaid — 4 lines of DSL:

graph TD
API[API] --> |queries| DB[DB]

drawmode’s SDK is more verbose than Mermaid for trivial cases, but produces pixel-perfect Excalidraw output with automatic layout, 28 color presets, and full editing capabilities via fromFile().

drawmode uses a Code Mode approach: instead of having the LLM describe a diagram in natural language or write raw JSON, it writes TypeScript code against a typed SDK. This matters for several reasons.

Raw Excalidraw JSON is error-prone. Labels require two separate elements (a shape with boundElements and a text element with containerId). Arrow bindings need precise edge coordinates, staggered connection points, and specific property combinations (elbowed: true, roundness: null, roughness: 0). LLMs frequently produce broken diagrams when writing this JSON directly.

A typed SDK catches errors at the API level. Calling addBox("API Gateway") always produces a valid shape-plus-label pair. connect(a, b) validates that both nodes exist, handles arrow geometry automatically, and throws a clear error if something is wrong. Every SDK method validates its inputs — invalid IDs, wrong element types (e.g., connecting from a group instead of a node), and missing dependencies all produce actionable error messages that let the LLM self-correct:

d.connect(groupId, db, "writes");
// → Error: Cannot connect from group "grp_1_...". Connect from a node inside the group instead.

Code is readable, diffable, and version-controllable. A 10-line TypeScript snippet is easier to review and modify than 200 lines of Excalidraw JSON. You can commit diagram source code alongside your application code.

fromFile() enables incremental editing. Load an existing .excalidraw file, find nodes with findByLabel(), update them with updateNode(), add new connections — without regenerating the entire diagram from scratch.

Graphviz handles layout automatically. The Sugiyama algorithm with orthogonal edge routing produces clean, readable graphs. No manual coordinate math, no overlapping nodes, no crossed edges.

Different tools suit different needs. Here is when you might prefer another option:

  • Excalidraw MCP is a better fit when you want interactive, hand-drawn-style editing with real-time visual feedback. Its canvas-based approach lets you drag, resize, and refine diagrams manually after generation.

  • Mermaid MCP works well for simple diagrams with minimal setup. Mermaid’s text-based syntax is widely supported, renders in GitHub Markdown, and requires no external dependencies. If your diagram fits Mermaid’s built-in chart types, the setup cost is lower.

  • Draw.io MCP is worth considering when you need complex XML-based diagrams with specific tool integration, or when your team already uses Draw.io as a standard diagramming tool.