# Best diagramming APIs and diagram-as-code for AI agents > PlantUML (B), D2 (B) and Miro API + MCP (B) lead the 15 ranked diagramming APIs and diagram-as-code. Picks by need, strengths, weaknesses and prices from the Anchor benchmark. - Canonical: https://www.anchorterminal.com/best/diagramming/ - Markdown: https://www.anchorterminal.com/best/diagramming/index.md (~5,450 tokens) - Slim: https://www.anchorterminal.com/best/diagramming/index.min.md (~1,380 tokens, same facts, less prose, for token-sensitive contexts) - JSON: https://www.anchorterminal.com/best/diagramming/index.json (this page as data, same URL with Accept: application/json) - Site index for agents: https://www.anchorterminal.com/llms.txt (full text: https://www.anchorterminal.com/llms-full.txt) - API: https://www.anchorterminal.com/api/v1/index.json - Updated: 2026-10-09 The 10 highest-scoring of 15 diagramming APIs and diagram-as-code on the Anchor benchmark, with a pick for each need and where each one falls short. Scores come from public evidence, re-checked as vendors change. - Ranked: 15 · agent-ready (BB or better): 0 · accept x402: 0 · hosted endpoints: 12 - Full ranked table: https://www.anchorterminal.com/categories/diagramming.md - Head-to-head comparisons: https://www.anchorterminal.com/compare/diagramming/index.md (99) - Methodology: https://www.anchorterminal.com/benchmark/index.md ## The shortlist | # | Tool | Grade | Score | Best for | Price | Where | | --- | --- | --- | --- | --- | --- | --- | | 1 | [PlantUML](https://www.anchorterminal.com/tools/plantuml.md) | B | 66.9 | Agents that write sequence, class, state, component, deployment, Gantt or C4 diagrams as text and render them locally or in CI. | Free · OSS | local | | 2 | [D2](https://www.anchorterminal.com/tools/d2.md) | B | 65.3 | Agents that need to produce or edit architecture, sequence, grid, SQL table or class diagrams as reviewable text and render them locally. | Free · OSS | local | | 3 | [Miro API + MCP](https://www.anchorterminal.com/tools/miro.md) | B | 65 | Agents that draw diagrams, maps and planning boards people will keep editing. | $8 / seat-mo | hosted | | 4 | [draw.io + MCP](https://www.anchorterminal.com/tools/drawio.md) | B | 62.2 | An agent that writes the diagram itself and wants a person to keep editing it, free and keyless. | Free · OSS | hosted and local | | 5 | [tldraw SDK + MCP](https://www.anchorterminal.com/tools/tldraw.md) | C | 60.7 | Teams building a product where a person and an agent share a canvas. | Paid | hosted | | 6 | [Lucid API + MCP](https://www.anchorterminal.com/tools/lucid.md) | C | 60.6 | Organisations already on Lucid that want an agent to create or update diagrams inside governed workspaces, with read-only scopes and audit logs. | $9 / seat-mo | hosted | | 7 | [Diagrams.so API + MCP](https://www.anchorterminal.com/tools/diagrams-so.md) | C | 60 | Best when an agent has to produce a cloud architecture diagram from a description and a person will keep editing it in draw.io. | $15 / mo | hosted and local | | 8 | [Structurizr + MCP](https://www.anchorterminal.com/tools/structurizr.md) | C | 59.9 | Teams that model architecture in C4 and want an agent to write and check the model as text. | $400 / mo | hosted | | 9 | [Kroki](https://www.anchorterminal.com/tools/kroki.md) | C | 59.2 | Agents that write diagrams in several text formats and want one render endpoint, on a private network or through the public instance for non-sensitive diagrams. | Free · OSS | local | | 10 | [Excalidraw](https://www.anchorterminal.com/tools/excalidraw.md) | C | 54.5 | Teams already on Excalidraw+ that want agents to create and edit hand-drawn diagrams, slides and wireframes in a shared workspace, and one-off sketches through the free MCP App. | $6 / seat-mo | hosted | ## Picks by need - Highest score overall: [PlantUML](https://www.anchorterminal.com/tools/plantuml.md), B, 66.9/100 on the benchmark. Also [D2](https://www.anchorterminal.com/tools/d2.md), B, 65.3/100. - Schema & documentation: [Miro API + MCP](https://www.anchorterminal.com/tools/miro.md), 85/100 on schema & documentation, against 65 for the overall leader. - Agent ergonomics: [Diagrams.so API + MCP](https://www.anchorterminal.com/tools/diagrams-so.md), 85/100 on agent ergonomics, against 78 for the overall leader. - Security & auth: [Lucid API + MCP](https://www.anchorterminal.com/tools/lucid.md), 80/100 on security & auth, against 50 for the overall leader. - Maintenance & community: [tldraw SDK + MCP](https://www.anchorterminal.com/tools/tldraw.md), 89/100 on maintenance & community, against 73 for the overall leader. - Transparency & trust: [Structurizr + MCP](https://www.anchorterminal.com/tools/structurizr.md), 77/100 on transparency & trust, against 73 for the overall leader. - A hosted MCP endpoint: [Miro API + MCP](https://www.anchorterminal.com/tools/miro.md), remote MCP server, nothing to install. - Self-hosting under an open licence: [draw.io + MCP](https://www.anchorterminal.com/tools/drawio.md), self-hosted, Apache-2 licence. Also [Structurizr + MCP](https://www.anchorterminal.com/tools/structurizr.md), self-hosted, Apache-2 licence. ## How to choose - Diagram as code format: Check that diagrams are text the agent can write and diff, since a line-by-line format makes later edits cheaper than a full redraw. - Editability after generation: Confirm that a generated diagram can be opened and changed in the editor, since an agent that cannot revise its output forces a human to redraw the diagram. - Export formats and embedding: Check which export formats and embed modes are supported, since an agent that publishes to a document needs a format that the destination can display. - Licence and usage limits: Read the licence and any limits on diagram count or size, because an agent that generates many diagrams can hit a cap that a single demo never shows. ## Each one in detail ### 1. PlantUML, B 66.9/100 PlantUML is open-source software that turns text descriptions into UML, architecture, Gantt, mind map and other diagrams. Agents run it as a Java command-line tool, a Java library, a local HTTP server or the `@plantuml/mcp-js` MCP server. - Verdict: One Java command reads diagram text from stdin and writes PNG, SVG, PDF or ASCII with no account, and CI passed on the last eight pushes. The default security profile lets diagram text read any local file and fetch any URL, and the documentation still lists chronology diagrams that release 1.2026.2 switched off. - Choose it for: Agents that write sequence, class, state, component, deployment, Gantt or C4 diagrams as text and render them locally or in CI. - Strength: `java -jar plantuml.jar -pipe` reads a diagram from stdin and writes PNG, SVG, PDF, EPS, LaTeX or ASCII to stdout, with no account or key - Strength: `--check-syntax` and `-stdrpt` report errors as `file:line:error` lines, and exit codes 0, 50, 100 and 200 are documented - Strength: The official `@plantuml/mcp-js` server has four tools, needs only Node.js, and returns the same SVG bytes for the same source on any machine - Weakness: The default security profile is LEGACY, which gives diagram text full access to local files and URLs through `!include`. The docs say it will be removed, with no date - Weakness: `-picoweb` listens on all network interfaces by default and has no authentication - Weakness: Chronology diagrams were switched off in 1.2026.2 on 27 February 2026 and are still listed in the README and documented on plantuml.com - Price: Free · OSS · Auth: None · x402: no · Where: local - Full assessment: https://www.anchorterminal.com/tools/plantuml.md ### 2. D2, B 65.3/100 D2 is an open-source diagram scripting language that turns text into SVG, PNG, PDF, PPTX, GIF or ASCII diagrams. Agents run it as a local CLI, a Go library or the `@d2lang/d2` WebAssembly package. - Verdict: 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. - Choose it for: Agents that need to produce or edit architecture, sequence, grid, SQL table or class diagrams as reviewable text and render them locally. - Strength: One command reads D2 from stdin and writes SVG, PNG, PDF, PPTX, GIF or ASCII to stdout, with no account or key - Strength: MPL-2.0 throughout, and the TALA layout engine has been open source and bundled since 0.9.0 on 7 September 2026 - Strength: `d2 validate` and `d2 fmt --check` let an agent test a diagram before rendering it - Weakness: 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 - Weakness: Terrastruct, the company that built D2, is shutting down. The project is now donation-funded under The Hack Foundation - Weakness: All 317 commits since 8 July 2026 are by one maintainer, who says his time on D2 is limited - Price: Free · OSS · Auth: None · x402: no · Where: local - Full assessment: https://www.anchorterminal.com/tools/d2.md - Against #1: https://www.anchorterminal.com/compare/d2-vs-plantuml.md ### 3. Miro API + MCP, B 65/100 Miro's REST API v2 reads and writes boards and board items (sticky notes, shapes, connectors, frames, cards, text, images, documents), tags and members, so an agent can lay out diagrams as well as notes. - Verdict: REST creates shapes, connectors and frames, so flowcharts and architecture sketches can be drawn directly. Legacy MCP board tools were removed nine days after the deprecation notice. - Choose it for: Agents that draw diagrams, maps and planning boards people will keep editing. - Strength: REST creates shapes, connectors and frames, so flowcharts and architecture sketches can be drawn directly - Strength: Hosted MCP server with OAuth 2.1 on every plan including Free, and no delete tool in its 18 - Strength: Published REST credit limits and MCP daily caps per plan - Weakness: Legacy MCP board tools were removed nine days after the deprecation notice - Weakness: No prompt-injection guidance for board content written by collaborators - Weakness: OAuth scopes are coarse (`boards:read`, `boards:write`) - Price: $8 / seat-mo · Auth: OAuth · x402: no · Where: hosted - Full assessment: https://www.anchorterminal.com/tools/miro.md ### 4. draw.io + MCP, B 62.2/100 The open-source diagram editor (also diagrams.net) with an official MCP server. - Verdict: 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. - Choose it for: An agent that writes the diagram itself and wants a person to keep editing it, free and keyless. - Strength: Free, keyless and Apache 2.0, with a Docker image for self-hosting - Strength: The hosted `create_diagram` takes Mermaid or draw.io XML, with optional ELK layout and libavoid edge routing - Strength: `search_shapes` covers about 10,000 stencils plus an icon service and returns exact style strings - Weakness: Tool descriptions embed a 34.5 KB XML reference and a 14 KB Mermaid reference, roughly 13,000 tokens - Weakness: No REST API to save, list or render diagrams - Weakness: PNG, SVG and PDF export need draw.io Desktop's CLI or a person in the editor - Price: Free · OSS · Auth: None · x402: no · Where: hosted and local - Full assessment: https://www.anchorterminal.com/tools/drawio.md - Against #1: https://www.anchorterminal.com/compare/drawio-vs-plantuml.md ### 5. tldraw SDK + MCP, C 60.7/100 A React infinite-canvas SDK that an agent can drive through the editor API, creating, reading and changing shapes, turning Mermaid into shapes and exporting images. - Verdict: Full editor API to create, read, bind and export shapes from code, with agent, chat and workflow starter kits. Source-available, and commercial prices aren't published. - Choose it for: Teams building a product where a person and an agent share a canvas. - Strength: Full editor API to create, read, bind and export shapes from code, with agent, chat and workflow starter kits - Strength: Hosted MCP App with two model-facing tools, all six tools annotated - Strength: At least six releases between 15 July and 30 September 2026, with dated release notes - Weakness: Source-available, and commercial prices aren't published - Weakness: `exec` runs model-written JavaScript on the canvas with no approval step - Weakness: Licence pings send the licence ID and full page URL for trial and hobby keys, more than the licence page says - Price: Paid · Auth: None · x402: no · Where: hosted - Full assessment: https://www.anchorterminal.com/tools/tldraw.md - Against #1: https://www.anchorterminal.com/compare/plantuml-vs-tldraw.md ### 6. Lucid API + MCP, C 60.6/100 REST API and hosted MCP server for creating, reading and managing Lucidchart and Lucidspark diagrams. - Verdict: OAuth 2.0 scopes with `:readonly` variants, and audit log endpoints in the REST API. No public changelog for the API or the MCP server. - Choose it for: Organisations already on Lucid that want an agent to create or update diagrams inside governed workspaces, with read-only scopes and audit logs. - Strength: OAuth 2.0 scopes with `:readonly` variants, and audit log endpoints in the REST API - Strength: Mermaid in through REST, PlantUML sequence diagrams through MCP, both editable afterwards - Strength: Per-operation rate limits in each reference page's OpenAPI fragment, such as 60 a minute on Create Mermaid Diagram - Weakness: No public changelog for the API or the MCP server - Weakness: The status page doesn't monitor the API or the MCP server - Weakness: No single OpenAPI file and no official REST SDK - Price: $9 / seat-mo · Auth: OAuth or key · x402: no · Where: hosted - Full assessment: https://www.anchorterminal.com/tools/lucid.md - Against #1: https://www.anchorterminal.com/compare/lucid-vs-plantuml.md ### 7. Diagrams.so API + MCP, C 60/100 Turns a plain-English description into an editable draw.io diagram with cloud icons (AWS, Azure, GCP, OCI, Kubernetes). - Verdict: API, MCP and SDKs on every plan, including a Free plan marked "No Card Required". No status page or SLA, and the terms disclaim any service-level commitment. - Choose it for: Best when an agent has to produce a cloud architecture diagram from a description and a person will keep editing it in draw.io. - Strength: API, MCP and SDKs on every plan, including a Free plan marked "No Card Required" - Strength: OpenAPI 3.1 with 32 operations, and an Idempotency-Key on every billable call - Strength: All 23 MCP tools carry readOnlyHint or destructiveHint annotations - Weakness: No status page or SLA, and the terms disclaim any service-level commitment - Weakness: Rate limits exist per key and per IP but no numbers are published - Weakness: Per-action credit costs are shown only in the app - Price: $15 / mo · Auth: OAuth or key · x402: no · Where: hosted and local - Full assessment: https://www.anchorterminal.com/tools/diagrams-so.md - Against #1: https://www.anchorterminal.com/compare/diagrams-so-vs-plantuml.md ### 8. Structurizr + MCP, C 59.9/100 Diagram-as-code tool for software architecture using the C4 model. - Verdict: One model can generate several C4 architecture views. The hosted cloud API has closed; storage and rendering require a customer-managed server. - Choose it for: Teams that model architecture in C4 and want an agent to write and check the model as text. - Strength: One text model yields context, container, component, dynamic and deployment views - Strength: Free hosted MCP at mcp.structurizr.com validates, parses, inspects and exports DSL with no key - Strength: Apache 2.0 code, an OpenAPI 3.0 definition and dated changelogs - Weakness: The hosted cloud API is gone. Storage and rendering need your own server - Weakness: Prebuilt server binaries need a paid licence counted per unique user, including API clients - Weakness: The MCP module is labelled experimental, with one-line tool descriptions - Price: $400 / mo · Auth: OAuth or key · x402: no · Where: hosted - Full assessment: https://www.anchorterminal.com/tools/structurizr.md - Against #1: https://www.anchorterminal.com/compare/plantuml-vs-structurizr.md ### 9. Kroki, C 59.2/100 Kroki is an open-source HTTP server from Yuzu tech that converts diagram text in 29 formats, including PlantUML, Mermaid, GraphViz and D2, into SVG, PNG or PDF. Owners run it from Docker images, and kroki.io is a free public instance. - Verdict: One unauthenticated POST with diagram text returns an image for 29 diagram types, and five versions shipped between 15 July and 5 October 2026. Four advisories were published in July and August 2026, one an unauthenticated remote code execution on `/tikz/svg`, all fixed. No OpenAPI file exists, and the public instance has no terms, privacy policy or status page. - Choose it for: Agents that write diagrams in several text formats and want one render endpoint, on a private network or through the public instance for non-sensitive diagrams. - Strength: `POST /` with `diagram_source`, `diagram_type` and `output_format`, or plain text to `//`, returns the image. No account or key - Strength: One API covers 29 diagram types, among them PlantUML, C4, Structurizr, Mermaid, GraphViz, D2, DBML, BPMN, Excalidraw and Vega - Strength: `KROKI_SAFE_MODE` defaults to `SECURE`, which blocks file and network reads by diagram libraries, and the container runs as the non-root user `kroki` - Weakness: GHSA-wmpp-fj9c-w766 (CVSS 9.8) allowed unauthenticated remote code execution on `/tikz/svg` in versions 0.21.0 up to 0.32.0, whatever the safe mode. Fixed 3 August 2026 - Weakness: Three more advisories in July and August 2026 let TikZ, Mermaid and Vega diagrams read local files or fetch URLs in `SECURE` mode. All are fixed in 0.32.1 - Weakness: No OpenAPI file, llms.txt or error catalogue. The JSON error shape is in the source and not in the documentation - Price: Free · OSS · Auth: None · x402: no · Where: local - Full assessment: https://www.anchorterminal.com/tools/kroki.md - Against #1: https://www.anchorterminal.com/compare/kroki-vs-plantuml.md ### 10. Excalidraw, C 54.5/100 Excalidraw is a hand-drawn style whiteboard and diagram editor from Excalidraw s.r.o. in Brno. Agents reach it through the Excalidraw+ REST API and MCP server (public beta), a free keyless MCP App, and the open-source editor on npm (MIT). - Verdict: Excalidraw+ keys carry read or full permission, route restrictions and an expiry, and the MCP server shows a key only the tools its routes allow. The API and MCP server are in public beta with breaking changes expected, sit behind the $6 Plus plan, and have no published OpenAPI file, SDK or idempotency keys. - Choose it for: Teams already on Excalidraw+ that want agents to create and edit hand-drawn diagrams, slides and wireframes in a shared workspace, and one-off sketches through the free MCP App. - Strength: API keys take `read` or `full` permission, route restrictions and an expiry, and can be rotated. The MCP server lists only the tools a key's routes allow - Strength: `create_diagram` lays out nodes, edges and groups into editable shapes with bound arrows, and `take_screenshot` returns a PNG to check the result - Strength: `search_scene_content` returns only matching elements, so an agent need not load a whole scene - Weakness: The API and MCP server are in public beta. The docs say endpoints, tool names and schemas may change and to expect breaking changes - Weakness: API and MCP access needs the Plus plan at $6 a user a month. No per-call price, and no SDK for the API - Weakness: No OpenAPI file is linked from the docs, although the reference pages are generated from one. No idempotency keys and no SLA found - Price: $6 / seat-mo · Auth: API key · x402: no · Where: hosted - Full assessment: https://www.anchorterminal.com/tools/excalidraw.md - Against #1: https://www.anchorterminal.com/compare/excalidraw-vs-plantuml.md 5 more are ranked in the full table: https://www.anchorterminal.com/categories/diagramming.md ## Head to head - [D2 vs PlantUML](https://www.anchorterminal.com/compare/d2-vs-plantuml.md) - [draw.io + MCP vs PlantUML](https://www.anchorterminal.com/compare/drawio-vs-plantuml.md) - [PlantUML vs tldraw SDK + MCP](https://www.anchorterminal.com/compare/plantuml-vs-tldraw.md) - [D2 vs draw.io + MCP](https://www.anchorterminal.com/compare/d2-vs-drawio.md) - [D2 vs tldraw SDK + MCP](https://www.anchorterminal.com/compare/d2-vs-tldraw.md) - [draw.io + MCP vs tldraw SDK + MCP](https://www.anchorterminal.com/compare/drawio-vs-tldraw.md) ## Questions ### What are the highest-rated diagramming APIs and diagram-as-code for AI agents? PlantUML has the highest benchmark score of the 15 ranked diagramming APIs and diagram-as-code, 66.9 (B). D2 is second with 65.3 (B). ### How many diagramming APIs and diagram-as-code are agent-ready? 0 of the 15 ranked here grade BB or better, the bar for agent-ready on the Anchor benchmark. ### Which diagramming APIs and diagram-as-code accept x402 payments? None of the ranked listings here accepts x402 for its main call yet. ### How is this list ranked? By the Anchor benchmark score out of 100, a weighted mean of the scored categories minus deductions for negative events, from public evidence re-checked as vendors change. Listings cannot pay for a place. The latest assessment behind this page is from 9 October 2026. ## How this list is made The order is the Anchor benchmark score, the same number as on each listing. Each listing is graded from public evidence against the benchmark checklist, and the picks are worked out from those grades, prices and facts. No listing pays for its place, and paid audits or listing help never change a score.