Stop Drawing Diagrams by Hand! AI Agents Now Control Draw.io
What if your AI assistant could draw your architecture diagrams while you describe them in plain English? No more dragging boxes. No more hunting for the right AWS icon. No more spending 45 minutes on a diagram that becomes outdated the moment you finish it.
Here's the painful truth every developer knows: diagrams are essential but diagramming is soul-crushing. We need them for architecture reviews, onboarding docs, incident post-mortems, and stakeholder presentations. Yet the tools haven't evolved since 2008. We're still manually positioning rectangles, aligning connectors, and copy-pasting the same database icon for the hundredth time.
The worst part? Your diagrams rot faster than your code. That beautiful system architecture you drew last quarter? It's already a lie. The microservice you diagrammed got split into three. The database choice changed. The CDN vendor switched. And now you're back to square one, rebuilding from scratch.
Enter drawio-mcp-server — the secret weapon that's making senior architects quietly abandon their manual workflows. This Model Context Protocol server transforms Draw.io (Diagrams.net) from a drag-and-drop chore into an AI-powered diagramming engine. Describe what you need, and watch your AI agent build it programmatically. Update it with a sentence. Generate multi-page architecture docs in parallel. This isn't the future — it's v2.1.0, and it's available right now.
What is drawio-mcp-server?
drawio-mcp-server is an open-source MCP (Model Context Protocol) server that gives AI agents complete programmatic control over Draw.io diagrams. Created by Ladislav Gazo and actively maintained with a thriving community, this project bridges the gap between conversational AI and visual documentation.
The Model Context Protocol, pioneered by Anthropic, is the emerging standard for how AI assistants interact with external tools and data sources. Think of it as USB-C for AI capabilities — one protocol, infinite possibilities. The drawio-mcp-server implements this protocol specifically for diagramming, exposing dozens of tools that let AI agents inspect, create, modify, and manage complex visual documents.
Why it's trending now: The project hit a major inflection point with v2.1.0, adding multi-document targeting, multi-page workflows, Mermaid diagram import, and auto-discovered vendor stencils for AWS, GCP, Azure, and Cisco. The built-in editor mode eliminates browser extension friction entirely. Meanwhile, the AI coding assistant ecosystem — Claude Desktop, Claude Code, Zed, Codex, OpenCode — has exploded in adoption, creating massive demand for MCP servers that extend these tools into specialized domains.
The repository has earned verification badges from MSeeP for security assessment and maintains active CI/CD pipelines. With npm distribution and comprehensive documentation, it's production-ready for teams that want to automate their visual documentation pipeline.
Key Features That Change Everything
The drawio-mcp-server isn't a basic wrapper — it's a deep integration that exposes Draw.io's full power through structured MCP tools:
Built-in Editor Mode — The server hosts Draw.io directly at localhost:3000. No browser extension to install, no compatibility headaches. The --editor flag spins up a complete diagramming environment that your AI agent controls natively.
Multi-Document & Multi-Page Orchestration — This is where v2.1.0 shines. Agents can list-documents across multiple tabs, target specific files with target_document selectors, and scope operations to individual pages via target_page. Build a three-page architecture doc with parallel agents: one for service topology, one for message flow, one for failure handling. Each works independently without stepping on others.
Per-Document FIFO Serialization — Multiple agents can safely operate on different files simultaneously. The server queues operations per document, preventing race conditions without artificial bottlenecks.
Auto-Discovered Vendor Stencils — No more hand-curated icon catalogs. The server automatically discovers AWS, GCP, Azure, Cisco19, and CiscoSafe stencils from Draw.io's sidebar at runtime. Your agent can place mxgraph.gcp2.cloud_run or mxgraph.cisco19.router directly, with zero configuration.
Mermaid Integration — Import, embed, or expand Mermaid diagrams. Bring existing text-based diagrams into Draw.io's visual environment, or let AI generate Mermaid syntax and convert it automatically.
Advanced Geometry Control — Edge waypoints, automatic self-connector routing, parent-child relationships for nested shapes and grouping. Build diagrams that don't just communicate — they look professionally designed.
Layer Management — Create, switch, and organize layers for complex diagrams. Separate infrastructure from application logic, or isolate decorative elements from functional components.
Enterprise-Ready TLS — Optional HTTPS and WSS with manual certificates or auto-generated self-signed material via a per-user local CA. Secure enough for corporate environments.
Universal MCP Client Support — Claude Desktop, Claude Code, Zed, Codex, OpenCode, oterm — if it speaks MCP, it controls Draw.io.
Real-World Use Cases Where This Dominates
1. Architecture Review Automation
You're preparing for a quarterly architecture review. Instead of spending a day in Draw.io, you tell Claude: "Create an event-driven architecture diagram showing a message queue with producers, consumers, and three backend services. Use AWS icons. Add a second page for the disaster recovery flow." The agent builds it in 90 seconds. You refine with natural language: "Make the queue an SQS icon, add DLQ handling, and color the critical path red."
2. Living Documentation That Evolves With Code
Embed diagram generation in your CI pipeline. On every merge to main, an agent reads your Terraform state or Kubernetes manifests and regenerates infrastructure diagrams. Your docs are never stale because they're derived from truth, not maintained by hand.
3. Parallel Multi-Agent Documentation Sprints
For complex systems, assign specialized agents to different diagram aspects. One agent maps the API gateway and microservices topology. Another traces authentication flows. A third documents the data pipeline. All write to separate pages of the same document, coordinated through target_page selectors. What took a team day now takes an hour.
4. Mermaid-to-Visual Conversion
Your team loves Mermaid for version-controlled diagrams in Markdown. But stakeholders need polished visuals for presentations. The agent imports your .mmd files, applies professional styling, adds vendor icons, and exports PNG or SVG. Best of both worlds: maintain in text, present in pixels.
5. Incident Response Visualization
During an outage, describe the symptoms to your AI: "Draw the current failure scenario — requests hit CloudFront, fail at the ALB health check, never reach the ECS cluster. Highlight the suspected bottleneck." You get a clear visual for the war room in seconds, not minutes of manual diagramming while production burns.
Step-by-Step Installation & Setup Guide
Prerequisites
- Node.js v20+ — Verify with
node --version - An MCP client — Claude Desktop, Claude Code, Zed, Codex, or OpenCode
- pnpm (optional but preferred) —
npm install -g pnpm
Installation & Configuration
The fastest path uses npx to run the server without global installation:
Claude Desktop (macOS)
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["-y", "drawio-mcp-server", "--editor"]
}
}
}
The -y flag auto-accepts the npm prompt. The --editor flag enables the built-in Draw.io server — no browser extension needed.
Claude Code (CLI)
# One-line configuration
claude mcp add-json drawio '{"type":"stdio","command":"npx","args":["-y","drawio-mcp-server","--editor"]}'
Zed Editor
Add to ~/.config/zed/settings.json:
{
"context_servers": {
"drawio": {
"command": "npx",
"args": ["-y", "drawio-mcp-server", "--editor"],
"env": {}
}
}
}
Codex CLI
Edit ~/.codex/config.toml:
[mcp_servers.drawio]
command = "npx"
args = ["-y", "drawio-mcp-server", "--editor"]
OpenCode
Add to opencode.json in project root or ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"drawio": {
"type": "local",
"command": ["npx", "-y", "drawio-mcp-server", "--editor"],
"enabled": true
}
}
}
Launch & Verify
- Restart your MCP host to load the new server configuration
- Open the editor at
http://localhost:3000/— Draw.io loads with MCP control enabled - Test with a prompt: "Create a simple flowchart with start, process, and end nodes"
Alternative: Browser Extension Mode
If you prefer using Draw.io's web app directly:
- Install the Chrome extension or Firefox add-on
- Open app.diagrams.net
- Confirm the extension shows green (connected)
- Configure MCP host without
--editor:
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["-y", "drawio-mcp-server"]
}
}
}
Note: Firefox requires TLS mode. Enable with flags from CONFIG.md.
REAL Code Examples from the Repository
Let's examine actual configuration patterns and usage from the drawio-mcp-server repository, with detailed explanations of how each enables AI-powered diagramming.
Example 1: Claude Desktop Configuration with Built-in Editor
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["-y", "drawio-mcp-server", "--editor"]
}
}
}
What's happening here? This JSON configures Claude Desktop to launch the drawio-mcp-server as a subprocess via npx, which downloads and executes the package without global installation. The --editor flag is critical: it starts an embedded Draw.io instance on port 3000, creating a self-contained environment where the AI agent has guaranteed control. Without this flag, the server expects a browser extension connection, which requires additional setup. The stdio transport (implied by the array format) means Claude communicates with the server through standard input/output — fast, reliable, and debuggable.
Example 2: Claude Code One-Liner Setup
claude mcp add-json drawio '{"type":"stdio","command":"npx","args":["-y","drawio-mcp-server","--editor"]}'
Why this pattern matters: Claude Code's CLI-first approach lets you version-control your MCP configuration in shell scripts or dotfiles. The add-json subcommand validates and persists the configuration atomically. Notice the explicit "type":"stdio" — this documents the transport protocol for future readers. The single-quoted JSON prevents shell interpolation issues with the nested quotes. For teams standardizing on Claude Code, this one-liner can be added to onboarding scripts, ensuring every engineer gets AI diagramming capability on day one.
Example 3: Zed Editor Context Server Configuration
{
"context_servers": {
"drawio": {
"command": "npx",
"args": ["-y", "drawio-mcp-server", "--editor"],
"env": {}
}
}
}
Zed's unique approach: Zed uses "context_servers" rather than "mcpServers", reflecting its architecture where external tools augment the editor's context understanding. The explicit "env": {} is significant — Zed requires this key even when empty, ensuring environment isolation. For developers who live in Zed's GPU-accelerated editor, this integration means diagramming without leaving their keyboard-centric workflow. The configuration lives in ~/.config/zed/settings.json, making it portable across machines via dotfile sync.
Example 4: Multi-Page Parallel Agent Prompt
Based on the repository's documented prompt examples, here's how you leverage v2.1.0's multi-page targeting:
"Create a three-page event-driven architecture diagram.
Use three agents in parallel for service topology,
message flow, and retry/failure handling, with each
agent assigned to a separate target page."
The orchestration magic: When you issue this prompt, Claude spawns parallel tool calls targeting different pages via target_page selectors. The first agent calls create-page with name "Service Topology", then adds shapes using target_page: "Service Topology". Simultaneously, the second agent creates "Message Flow" and builds sequence-style diagrams. The third handles "Failure Handling" with retry loops and DLQs. The server's per-document FIFO serialization ensures these parallel operations don't corrupt the shared document structure, while target_page scoping prevents cross-page interference. This is genuinely impossible with manual diagramming — you'd be context-switching between pages, copying styles, aligning layouts. The AI agents don't get tired or lose track.
Example 5: Vendor Stencil Auto-Discovery in Action
When an agent places an AWS Lambda icon, it doesn't use a hardcoded path. The server discovered this at runtime:
Agent tool call: add_shape with {
"shape": "mxgraph.aws4.lambda",
"x": 120,
"y": 80,
"width": 60,
"height": 60
}
Behind the scenes: The server scanned Draw.io's sidebar configuration on startup, building an index of available stencils. The mxgraph.aws4.lambda identifier resolves through Draw.io's standard shape library — no custom icon packs, no manual SVG imports. This auto-discovery extends to mxgraph.gcp2.cloud_run, mxgraph.azure.compute, mxgraph.cisco19.router, and hundreds more. For infrastructure diagrams, this means your agent speaks the same visual language as your cloud provider's official documentation.
Advanced Usage & Best Practices
Layer Strategy for Complex Diagrams — Don't dump everything on one canvas. Train your prompts to organize: "Create a 'Background' layer for decorative elements, a 'Infrastructure' layer for AWS resources, and an 'Application' layer for service components." This lets stakeholders toggle detail levels.
Document Naming Conventions — With multi-document support, establish prefixes: proj-arch- for architecture, proj-flow- for workflows, proj-incident- for post-mortems. Use list-documents to filter and target_document to route precisely.
Version Control Integration — Export diagrams as XML (with embedded metadata) or SVG for git tracking. The server's export tools preserve full editability. Commit these alongside code changes for true living documentation.
TLS for Team Environments — Don't expose localhost:3000 on shared networks without TLS. Use the auto-generated certificates: drawio-mcp-server --editor --tls --tls-auto. The per-user local CA approach avoids browser security warnings while maintaining encryption.
Prompt Engineering for Diagram Quality — Be specific about layout direction ("left-to-right flow"), icon families ("use AWS4 icons"), and grouping ("group the database cluster with a rounded rectangle"). The agent's output quality scales with prompt precision.
Firefox & TLS Requirement — If your team uses Firefox, TLS is non-negotiable due to stricter WebSocket security policies. Plan for certificate distribution or use the browser extension with --tls enabled.
Comparison with Alternatives
| Feature | drawio-mcp-server | Manual Draw.io | Mermaid CLI | Lucidchart API |
|---|---|---|---|---|
| AI Control | ✅ Native MCP tools | ❌ None | ⚠️ Text-only generation | ⚠️ Limited automation |
| Built-in Editor | ✅ --editor flag |
N/A (web only) | ❌ No editor | ❌ Web only |
| Vendor Icons | ✅ Auto-discovered AWS/GCP/Azure/Cisco | ✅ Manual drag | ❌ Text symbols only | ✅ Pre-built libraries |
| Multi-Page | ✅ Parallel agent targeting | ❌ Manual switching | ❌ Single diagram | ✅ Supported |
| Multi-Document | ✅ list-documents + target_document |
❌ Tab switching | ❌ Single file | ❌ Per-document |
| Mermaid Import | ✅ Import, embed, expand | ❌ Not supported | N/A (native format) | ❌ Not supported |
| Layer Management | ✅ Full MCP tools | ✅ Manual UI | ❌ Not supported | ✅ Basic layers |
| Cost | ✅ Free, open-source | ✅ Free | ✅ Free | 💰 $7.95+/user/month |
| Offline Capable | ✅ Built-in editor | ✅ Desktop app | ✅ CLI | ❌ Cloud required |
| Extensibility | ✅ Any MCP client | ❌ None | ⚠️ Plugin ecosystem | ⚠️ Limited API |
The verdict: drawio-mcp-server uniquely combines AI-native control, professional diagramming features, and zero cost. Mermaid excels for text-based workflows but lacks visual sophistication. Lucidchart has polish but locks you into subscriptions and limited automation. Manual Draw.io is free but painfully slow. This server eliminates the trade-off.
FAQ
Q: Do I need a paid Draw.io subscription? No. Draw.io (Diagrams.net) is free and open-source. The MCP server builds on this foundation at zero cost.
Q: Can multiple team members collaborate on the same diagram? The server supports multiple agents via per-document FIFO serialization, but real-time human collaboration requires the browser extension connected to Draw.io's native sharing or using the built-in editor with screen sharing.
Q: What MCP clients are confirmed working? Claude Desktop, Claude Code, Zed, Codex, OpenCode, and oterm are documented. Any stdio-based MCP client should work; SSE transport is not currently supported.
Q: How do I troubleshoot connection issues? Check the TROUBLESHOOTING.md guide. Common fixes: restart your MCP host after config changes, verify Node.js v20+, ensure port 3000 isn't blocked, and check extension connection status (green overlay) for browser mode.
Q: Is the desktop app integration ready for production?
No — the draw.io desktop (Electron) integration is experimental and blocked by an upstream Content Security Policy issue. The built-in editor (--editor) or browser extension are the stable paths.
Q: Can I export diagrams for presentations? Yes. The server exports to XML (editable), SVG (with embedded XML for round-tripping), and PNG (with embedded XML). All formats preserve full diagram data.
Q: How do I add custom shapes not in the auto-discovered stencils? Use the standard Draw.io custom shape workflow: import SVG or XML shape definitions, then reference them by their mxGraph identifier. The auto-discovered stencils cover major cloud vendors but extensibility isn't limited.
Conclusion
The drawio-mcp-server represents a fundamental shift in how technical teams produce visual documentation. It doesn't just make diagramming faster — it makes it programmable, versionable, and AI-native. The v2.1.0 release with multi-document targeting, parallel page workflows, and auto-discovered vendor stencils removes the last friction points that kept diagram automation impractical.
I've watched teams spend hours on diagrams that become obsolete within sprints. I've seen architecture reviews derailed by outdated visuals. This tool solves both: your diagrams become living artifacts, generated from description, updated with conversation, and exported for any audience.
The competitive advantage is temporal. Early adopters are already building documentation pipelines their competitors can't match — not because they work harder, but because they've automated what others still do by hand.
Stop dragging boxes. Start describing systems. Your AI agent is ready to draw.
👉 Star drawio-mcp-server on GitHub and install it in the next 10 minutes. Your future self — reviewing architecture docs that actually match production — will thank you.