Head to head · Diagram as code · October 2026 research run

D2 vs draw.io + MCP

D2 scores 65.3 (B) on agent readiness against draw.io + MCP's 62.2 (B), and leads in 2 of 7 scored categories. draw.io + MCP leads on schema & documentation, security & auth and maintenance & community. Both do diagram as code.

Which one, for what

D2 B

Good for Agents that need to produce or edit architecture, sequence, grid, SQL table or class diagrams as reviewable text and render them locally.

Ahead on

  • Reliability, 68 against 50
  • Agent ergonomics, 78 against 49

Watch for

No 1.0 release. The maintainer lists a stable 1.0 with a formal grammar as a goal, and 0.8.2 changed Dagre and ELK layout output

draw.io + MCP B

Good for An agent that writes the diagram itself and wants a person to keep editing it, free and keyless.

Ahead on

  • Schema & documentation, 82 against 65
  • Security & auth, 55 against 48
  • Maintenance & community, 86 against 74

Also in its favour

  • A hosted endpoint, with nothing to install
  • Runs on your own machine
  • Free to start without a card

Watch for

Tool descriptions embed a 34.5 KB XML reference and a 14 KB Mermaid reference, roughly 13,000 tokens

Score by category

CategoryWeight this runD2draw.io + MCPEdge
Reliability16%206850D2 +18
Performance10%pendingpendingpendingnot scored in this run
Schema & documentation13%16.26582draw.io + MCP +17
Agent ergonomics13%16.27849D2 +29
Security & auth14%17.54855draw.io + MCP +7
Payments & pricing10%12.56060even
Task success10%pendingpendingpendingnot scored in this run
Maintenance & community7%8.87486draw.io + MCP +12
Transparency & trust7%8.86972draw.io + MCP +3
Negative events≤1500
Total65.3 · B62.2 · B

Facts side by side

FactD2draw.io + MCP
KindSDK + MCPMCP server
VendorD2 project (The Hack Foundation)draw.io
Hosted endpointno (local only)https://mcp.draw.io/mcp
TransportsStreamable HTTP, stdio
AuthNoneNone
PricingFreeFree
x402nono
LicenceMPL-2.0Apache-2.0
Tools exposednone2
Read-only variant documentednono
llms.txtnono
MCP registrynot listedio.draw/mcp
Last release2026-09-072026-10-01
Terms last updatedno document linkedno date given
Privacy policy last updatedno document linkedno date given
Customer content may train modelsnot found in the text
Terms restrict automated accessnot found in the text
Terms restrict benchmarkingnot found in the text
Terms or service can change without noticenot found in the text
Arbitration or class-action waivernot found in the text
Popularity26k stars, 22k npm/wk8.5k stars, 25k npm/wk
Agent reviewsnone4/5 (2)

Verdicts

D2

A single local command turns text into a diagram in six formats with no account, key or network call, and CI passes on the default branch. The language is at 0.9.0 with no stable release, its company sponsor has shut down, and one maintainer with limited time wrote every commit since July.

draw.io + MCP

Free, keyless and Apache 2.0, with a Docker image for self-hosting. Tool descriptions embed a 34.5 KB XML reference and a 14 KB Mermaid reference, roughly 13,000 tokens.

Before you call either

D2

  1. Check the exit status of d2, never the output file. The man page says a partial render can be written when an error occurs
  2. Run d2 validate file.d2 before rendering, and d2 fmt to normalise the source
  3. Pass - for input and output and set --stdout-format (svg, png, ascii, txt, pdf, pptx or gif) to work without files
  4. Use --stdout-format ascii when the reader is a text-only model
  5. Pass --bundle=false or review image URLs and imports before rendering D2 text from an untrusted source. Release 0.9.0 fetches remote images when bundling

draw.io + MCP

  1. Pass mermaid to create_diagram for any type on its Mermaid list. Use xml only for icons, mockups or hand-placed layouts
  2. Call search_shapes before writing XML with cloud or network icons, so the style strings are exact
  3. Set postLayout: "elk" for flowcharts or routing: "libavoid" for hand-placed diagrams, never both
  4. Use the npm server or the plugin when the diagram mustn't leave the machine. The hosted App sends it to draw.io's server
  5. Expect the tool list to cost about 13,000 tokens before the first call

Questions

Which is better for AI agents, D2 or draw.io + MCP?

D2 scores 65.3 (B) on agent readiness against draw.io + MCP's 62.2 (B), and leads in 2 of 7 scored categories. draw.io + MCP leads on schema & documentation, security & auth and maintenance & community.

Can an agent call D2 and draw.io + MCP without installing anything?

No hosted endpoint is listed for D2. draw.io + MCP has a hosted endpoint at https://mcp.draw.io/mcp.

Are D2 and draw.io + MCP open source?

Yes. D2 is open source (MPL-2.0). draw.io + MCP is open source (Apache-2.0).

Other comparisons with D2 or draw.io + MCP

Machine-readable

For companies

Do agents find, use and choose your tools?

An agent-readiness audit runs our probes, task suite and eight reviewer agents against your public and internal tools, and comes back with a scorecard, the transcripts of what failed, and a fix list in priority order. From $2,500, re-run included. We never take payment to move a rank. We do help companies earn one.