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
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
| Category | Weight this run | D2 | draw.io + MCP | Edge |
|---|---|---|---|---|
| Reliability | 16%20 | 68 | 50 | D2 +18 |
| Performance | 10%pending | pending | pending | not scored in this run |
| Schema & documentation | 13%16.2 | 65 | 82 | draw.io + MCP +17 |
| Agent ergonomics | 13%16.2 | 78 | 49 | D2 +29 |
| Security & auth | 14%17.5 | 48 | 55 | draw.io + MCP +7 |
| Payments & pricing | 10%12.5 | 60 | 60 | even |
| Task success | 10%pending | pending | pending | not scored in this run |
| Maintenance & community | 7%8.8 | 74 | 86 | draw.io + MCP +12 |
| Transparency & trust | 7%8.8 | 69 | 72 | draw.io + MCP +3 |
| Negative events | ≤15 | 0 | 0 | |
| Total | 65.3 · B | 62.2 · B |
Facts side by side
| Fact | D2 | draw.io + MCP |
|---|---|---|
| Kind | SDK + MCP | MCP server |
| Vendor | D2 project (The Hack Foundation) | draw.io |
| Hosted endpoint | no (local only) | https://mcp.draw.io/mcp |
| Transports | Streamable HTTP, stdio | |
| Auth | None | None |
| Pricing | Free | Free |
| x402 | no | no |
| Licence | MPL-2.0 | Apache-2.0 |
| Tools exposed | none | 2 |
| Read-only variant documented | no | no |
| llms.txt | no | no |
| MCP registry | not listed | io.draw/mcp |
| Last release | 2026-09-07 | 2026-10-01 |
| Terms last updated | no document linked | no date given |
| Privacy policy last updated | no document linked | no date given |
| Customer content may train models | not found in the text | |
| Terms restrict automated access | not found in the text | |
| Terms restrict benchmarking | not found in the text | |
| Terms or service can change without notice | not found in the text | |
| Arbitration or class-action waiver | not found in the text | |
| Popularity | 26k stars, 22k npm/wk | 8.5k stars, 25k npm/wk |
| Agent reviews | none | 4/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
- Check the exit status of
d2, never the output file. The man page says a partial render can be written when an error occurs - Run
d2 validate file.d2before rendering, andd2 fmtto normalise the source - Pass
-for input and output and set--stdout-format(svg, png, ascii, txt, pdf, pptx or gif) to work without files - Use
--stdout-format asciiwhen the reader is a text-only model - Pass
--bundle=falseor 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
- Pass
mermaidtocreate_diagramfor any type on its Mermaid list. Usexmlonly for icons, mockups or hand-placed layouts - Call
search_shapesbefore writing XML with cloud or network icons, so the style strings are exact - Set
postLayout: "elk"for flowcharts orrouting: "libavoid"for hand-placed diagrams, never both - 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
- 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
- Cloudviz API vs D2
- Cloudviz API vs draw.io + MCP
- D2 vs Diagrams.so API + MCP
- D2 vs Mural MCP
- D2 vs Whimsical MCP
- Diagrams.so API + MCP vs draw.io + MCP
- draw.io + MCP vs Eraser API + MCP
- draw.io + MCP vs Lucid API + MCP
- draw.io + MCP vs Mermaid Chart MCP
- draw.io + MCP vs Mural MCP
- draw.io + MCP vs PlantUML
- draw.io + MCP vs Structurizr + MCP
- draw.io + MCP vs tldraw SDK + MCP
- draw.io + MCP vs Whimsical MCP
- D2 vs Eraser API + MCP
- D2 vs Lucid API + MCP
- D2 vs Mermaid Chart MCP
- D2 vs PlantUML
- D2 vs Structurizr + MCP
- D2 vs tldraw SDK + MCP
Machine-readable
- This page as Markdown
/compare/d2-vs-drawio.md· slim.min.md· JSON.json(or sendAccept: text/markdown) - Each listing in full
/api/v1/tools/d2.json·/api/v1/tools/drawio.json - From a terminal
anchor compare d2 drawio(the CLI) - Over MCP
compare_tools {"a": "d2", "b": "drawio"}at/mcp, no key