← Cribsheets
drawio
  1. Overview
  2. How it works
  3. Pipeline
  4. Icons & macOS
  5. Servers
  6. Gallery
  7. Under the hood
  8. Findings
  9. Build your own
  10. Sources
Skill explainer · jgraph/drawio-mcp

Draw.io

Every diagram becomes a native .drawio file first, then whatever format you asked for.

The official draw.io skill, shipped byte-identical to Claude Code, Codex, Copilot, Cursor and Antigravity. Author as Mermaid or XML, repair it, lay it out with ELK, and export with the XML embedded so every PNG stays editable. I read the skill, ran both servers’ test suites and the shared modules. Every diagram becomes a native .drawio file first, then is delivered in the requested output format, whether you authored Mermaid or XML.

05c1747commit, 22 Oct 2026
5byte-identical ports
6ELK presets
5output formats
8MCP tools
201/201tests pass

Who it is for

Agents in terminals (Claude Code, Codex, Copilot CLI) where diagrams cannot render inline.

What you get

A .drawio, an embedded-XML PNG/SVG/PDF, or an app.diagrams.net link.

How It Works

Author, Repair, Lay Out, Deliver

The skill is one pipeline with two ways in.

1

Inline first. Inline viewer first. In chats that render diagrams, the MCP create_diagram tool wins.

2

Author. Mermaid when the desktop CLI exists; XML otherwise. If Mermaid was requested but no desktop CLI is available, author the same diagram as XML.

3

Repair. It changes nothing in a well-formed file, and needs only Node.js.

4

Lay out. The CLI's --layout step auto-positions XML-authored diagrams with the same ELK layouts as the editor's Arrange ▸ Layout menu and the draw.io MCP app server.

5

Deliver. Exports use double extensions so the name says the XML is inside.

The Pipeline

Fifteen Choices, One Artifact

Pick an authoring route, a layout or an output. Quotes are checked against SKILL.md at build time.

Shapes, Icons And macOS (1.2.6)

Look Up Icons, Find The Real Binary

New in plugin 1.2.6. Both fixes stop the agent from guessing.

1

Icon lookup. never guess mxgraph.* names: look them all up in one call to scripts/find-shapes.js in this skill's folder (Node.js 18+, network), one query per icon, narrowed by library (aws4, azure2, cisco19). Why: a wrong stencil name renders as an empty box, and this works without the MCP server.

2

Output. prints title width×height style lines; use a style as is:

3

macOS CLI. this prints the first of drawio on PATH (Homebrew), /Applications, the per-user ~/Applications and Spotlight, or nothing if draw.io is absent:

4

Use the real binary. Call the binary inside the .app: a copy or symlink outside it dies with Unable to find helper app.

5

File naming. The File naming section no longer tells you to delete the .mmd or intermediate .drawio; the workflow steps above it still do.

node <skill-folder>/scripts/find-shapes.js "aws4 lambda" "github" "slack"

# macOS: which draw.io will the skill use?
{ command -v drawio; ls /Applications/draw.io.app/Contents/MacOS/draw.io ~/Applications/draw.io.app/Contents/MacOS/draw.io
  mdfind "kMDItemCFBundleIdentifier == 'com.jgraph.drawio.desktop'" | sed 's|$|/Contents/MacOS/draw.io|'; } 2>/dev/null | head -1
App Server 1.7.0 And Tool Server 1.11.0

Download, Layout Check, Self-Hosted Editor

Read from upstream source at 639186a. Neither server was installed or test-run on this box.

1

PNG/SVG from the viewer. Copy the diagram XML; download it as a .drawio file, PNG or SVG and copy it as a PNG where the host allows it.

2

Rendering feedback. The XML doesn't tell the model how wide a label comes out. The viewer adds a layout check (and a PNG on hosts that take images) to model context.

3

One-click layout fix. the toolbar shows a chip, "Fix N issues" when the check found something and the host can take a follow-up.

4

Self-hosted editor. Set DRAWIO_BASE_URL to a self-hosted draw.io for Open in draw.io and the link given when the host has no inline viewer.

5

Link only. Set DRAWIO_BROWSER to off to get only the URL. Headless agents, CI and SSH skip launching a browser.

Under The Hood

Eight Shared Modules Feed Two Servers

The skill’s inline repair step is a small version of repair-xml.js. I imported each module and ran it on test input.

What I Found Running It

Thoroughly Tested; The CLI Is The Dependency

All runs used a copy of the repo in /tmp, with nice and timeout, at commit 05c1747.

RunResultNote
mcp-tool-server npm test125/125 passAbout 1 s.
mcp-app-server npm test76 pass, 2 skippedSkipped tests need a live Worker (EDGE_COMPARE_URL).
SKILL.md repair one-linerfixedProse, fence, unescaped label and self-parented layer.
SKILL.md URL one-linerround-trips247-character link for a tiny diagram.
Shared modulesworkrepair, normalize, mermaid-elk and shape search all behaved as documented.
5 SKILL.md portsbyte-identicalA CI workflow enforces it.
draw.io Desktop CLInot on the boxMermaid conversion, layout and export need it.
app-server 1.7.0, tool-server 1.11.0upstream source onlyNot installed or test-run here. PNG/SVG download and copy, layout-fix chip, rendering layout check, DRAWIO_BASE_URL, DRAWIO_BROWSER=off.

Gap Mermaid, layouts and export all need the desktop app

Without it the skill can only write XML and a URL. The skill says so and falls back cleanly.

Gap References load from main, unpinned

SKILL.md tells the agent to fetch xml-essentials.md and mermaid-reference.md from raw.githubusercontent.com/…/main, so a skill pinned at one commit reads rules from another.

Cost Two repair implementations

The inline one-liner and repair-xml.js do overlapping work; only the module reports what it changed or handles leaked tool-call tags.

Bug Shape search ranks a number first

“cisco router” returns a stencil titled “10700” above “ATM Router”.

Copy Editable exports

-e embeds the XML, and the double extension tells people it is there.

Copy Port parity in CI

One workflow fails the build if any port’s SKILL.md drifts from the Claude Code copy.

Build Your Own

What To Steal

  1. One native artifact, many deliveries. Write the source format first; derive the rest.

  2. Prefer a layout engine to model coordinates. Ask for structure, not positions.

  3. Measure the model’s mistakes, then fix them in code. repair-xml.js says its three fixes covered all 15 broken diagrams out of 473.

  4. Detect the environment exhaustively. The Windows chain checks PATH, install paths, registry and other drives before giving up.

  5. Keep ports identical by CI.

Sources

Everything Here Is Checked

Each quote on this page is compared with its source file at build time; the build fails on any mismatch.

  1. plugins/cursor/skills/drawio/SKILL.md
  2. mcp-tool-server/src/index.js
  3. shared/repair-xml.js
  4. mcp-app-server/README.md
  5. mcp-tool-server/README.md
  6. mcp-app-server/AGENTS.md
  7. .github/workflows/check-skill-sync.yml
  8. github.com/jgraph/drawio-mcp