Draw diagrams with your AI Agent: drawio-mcp
AI coding agents are surprisingly bad at drawing diagrams. They can describe a flowchart in text, generate Mermaid code that half-renders, or output ASCII art that looks like 1990s internet. But none of that produces something you can open in a real diagramming tool, move nodes around in, or export to a presentation slide. drawio-mcp, an open-source MCP server by JGraph (the makers of draw.io), fixes this by letting agents generate native .drawio files that are fully editable in draw.io or any mxGraph-compatible editor.
How it works
The agent takes a natural language description of the diagram — “a flowchart for the user login process” or “an ER diagram for an e-commerce database” — and generates the raw mxGraphModel XML that draw.io uses as its native format. The result is a .drawio file you can double-click to open, edit, and export. It supports all standard diagram types: flowcharts, architecture diagrams, ER diagrams, sequence diagrams, class diagrams, network topologies, wireframes, UI mockups. The MCP server also exposes an export tool — PNG, SVG, or PDF — with the diagram XML embedded in the output file, so the exported image remains editable in draw.io later.
Why this beats Mermaid
Mermaid.js is the most common diagram approach for AI agents today, but it has a ceiling. Complex layouts, precise positioning, swimlanes, nested containers, custom styling, and dark-mode-aware palettes all push past what Mermaid can express. draw.io’s mxGraph format is a full vector graphics canvas — everything is positioned explicitly, styled individually, and layered. The .drawio file is just XML underneath, which means agents can generate it directly without any server-side rendering, no API calls, no dependencies beyond the MCP server itself. For the agent, it’s a text generation task; for the human, it’s a real diagram file that works with a real tool.
The gap between “a diagram the agent can generate” and “a diagram you’d put in a slide deck” is exactly what drawio-mcp closes — by making the output a first-class file in a first-class tool.