thomast1906/drawio-mcp-diagramming
Create and edit diagrams using the Draw.io MCP server — any shape, any vendor. USE FOR: draw me a diagram, create an architecture diagram, add Azure/AWS/GCP/Cisco/Kubernetes icons to a diagram, convert Mermaid to draw.io, fix overlapping arrows, edit a .drawio file, network topology diagrams, CI/CD pipeline diagrams, auth flow diagrams. Supports XML, Mermaid, and CSV. Uses drawio/search_shapes to find any of 10,000+ shapes across all vendor and icon libraries. DO NOT USE FOR: Excalidraw output (use excalidraw-mcp-diagramming skill).
npx skills add https://github.com/thomast1906/github-copilot-agent-skills --skill drawio-mcp-diagramming
Create or update diagrams via the Draw.io MCP server. Before generating XML, read references/xml-authoring-rules.md — hard constraints, container rules, and edge routing guidance that prevent the most common rendering failures. For layout anti-pattern fixes, see references/layout-antipatterns.md. For cloud topology conventions, icon libraries, and worked examples, see references/azure.md and references/aws.md.
For diagrams that use only basic shapes (flowcharts, UML, ERD, org charts, mind maps, timelines, wireframes), skip icon discovery and proceed directly to drawio/create_diagram or drawio/open_drawio_mermaid.
.drawio file (Tool Server only).Draw.io provides two MCP server variants. The skill works with either; call the tools that match the configured server.
drawio/create_diagram{
"servers": {
"drawio": {
"type": "http",
"url": "https://mcp.draw.io/mcp"
}
}
}
Supported inputs: xml (draw.io XML), mermaid (Mermaid.js text).
Optional layout passes: postLayout: "elk", routing: "libavoid".
drawio/open_drawio_xml, drawio/open_drawio_mermaid, drawio/open_drawio_csv, drawio/search_shapes, drawio/list_pages, drawio/get_page, drawio/set_page{
"servers": {
"drawio": {
"command": "npx",
"args": ["-y", "@drawio/mcp"]
}
}
}
Supported inputs: XML, Mermaid, CSV.
Optional layout pass: routing: "libavoid" on open_drawio_xml — requires @drawio/mcp v1.3.0 or later. On older versions the parameter is ignored, so pin with npx -y @drawio/mcp@latest if connector routing does not improve.
> Use Option A if your host supports MCP Apps inline rendering (Claude.ai, Cursor ≥ 2.6) or if the "Open in draw.io" button workflow is acceptable. Use Option B for VS Code / GitHub Copilot or any standard MCP client.
drawio/search_shapes — search 10,000+ draw.io shapes and return ready-to-use style strings.query (space-separated keywords) and optional limit (default 10, max 50). Raise limit when a first search returns nothing usable, before concluding a shape does not exist.MCP hosts may register tools with a server prefix (e.g. mcp_drawio-mcp-ap_create_diagram and mcp_drawio-mcp-ap_search_shapes). If tool_search does not surface the drawio tools, inspect the available or deferred tools list and call the exact names shown there. Do not assume a tool is unavailable if it appears in the deferred list; use the exact registered name.
In VS Code and GitHub Copilot, parallel tool calls are cancelled if the user sends a new message while they are in flight. Always run drawio/search_shapes calls one at a time — never in parallel batches.
The draw.io MCP server enforces strict XML rules, and the most common quality failures are flattened hierarchy and hand-routed edges. Before generating any XML, read references/xml-authoring-rules.md which covers:
swimlane containment, relative child coordinates, and why cross-container edges must sit at parent="1"routing: "libavoid" or postLayout: "elk" compute paths; the narrow cases where manual connection points are justifiedmermaid parameter.drawio/open_drawio_csv).drawio/create_diagram or drawio/open_drawio_xml).drawio/search_shapes for any non-geometric shape — it searches all 10,000+ shapes across every draw.io library and returns ready-to-use style strings."azure virtual machine", "aws lambda", "cisco router", "kubernetes pod", "slack", "docker".search_shapes only for diagrams that use purely geometric shapes: rectangles, diamonds, circles, and arrows.search_shapes vs skip it — if a shape has a recognised name, brand, or product identity, always look it up via search_shapes first. Only skip it for standard geometric diagrams (flowcharts, UML, ERD, org charts, mind maps, timelines, wireframes) that need no pictorial icons. For sequence and flow diagrams, apply Sequence and Flow Diagram Patterns (see section below).swimlane;startSize=24; container, set parent="<container_id>" on children, and give children coordinates relative to their parent. Edges between cells in *different* containers must use parent="1" or they render inside the container and get clipped. Drawing a large rectangle and positioning shapes on top of it at absolute coordinates is the anti-pattern the draw.io XML reference explicitly calls out — it breaks move/resize, collapse, and layout passes.mxGraphModel using verified icons/style strings.mermaid; Tool Server: use drawio/open_drawio_mermaid).drawio/open_drawio_csv).drawio/create_diagram with xml or mermaid.drawio/open_drawio_xml, drawio/open_drawio_mermaid, or drawio/open_drawio_csv.routing: "libavoid" — keeps your hand-placed coordinates and only reroutes connectors around shapes. This is the default for topology, architecture, deployment, and container-based diagrams.postLayout: "elk" — full re-layout that replaces your vertex positions. Use for directional/hierarchical XML (pipelines, decision flows). Add direction: "horizontal" when the flow reads left-to-right — it defaults to vertical, which is why left-to-right CI/CD pipelines come out stacked.postLayout and routing — ELK already routes its own edges. direction is XML-only and ignored for Mermaid (Mermaid takes direction from flowchart TD/LR).exitX/entryX or <Array as="points"> waypoints. The routing pass computes them, and manual values fight it. See references/xml-authoring-rules.md for the narrow exceptions.10. If the user wants a file artifact, save as .drawio wrapped in <mxfile><diagram>...</diagram></mxfile>. Read references/standalone-file-requirements.md before writing any .drawio file by hand (or whenever the MCP tools are unavailable) — the MCP tools add as="geometry" and the mxGraphModel layout attributes for you, and without them every element collapses to the origin.
11. Keep labels concise and explicit (service name + role).
12. Prefer one icon per major component or service; use edges for flow semantics (ingress/egress/dependency/telemetry).
Choose the input that matches the diagram type and configured server.
| Input | Best for | App Server | Tool Server |
|---|---|---|---|
| XML | Architecture/topology diagrams with vendor or pictorial icons, custom layouts | drawio/create_diagram with xml | drawio/open_drawio_xml |
| Mermaid | Flowcharts, sequence, class, ER, state, mindmap, Gantt, timeline, kanban | drawio/create_diagram with mermaid | drawio/open_drawio_mermaid |
| CSV | Org charts, flowcharts, simple diagrams from tabular data | Not supported | drawio/open_drawio_csv |
Use Mermaid for standard diagram types; use XML when the user needs pictorial or vendor-specific icons, precise positioning, complex containers, or custom styling. See references/REFERENCE.md for Mermaid/CSV examples and multi-page editing details.
Apply these defaults unless the user explicitly asks for a dense/technical view:
1, 2, 3, 4) instead of many edge labels.routing: "libavoid" separate what remains — only add explicit exitX/exitY if a specific edge is still ambiguous after routing.flowAnimation=1; to any edge style renders a moving dot that travels along the arrow, making directional flow immediately visible without extra labels — ideal for data-flow and pipeline diagrams. The animation is preserved in SVG export and the draw.io desktop app. By default, ask the user whether they want any flow arrows animated before generating the diagram — *"Would you like any of the flow arrows animated to show traffic direction? If so, which ones?"* Apply flowAnimation=1; only to the edges the user identifies. If the user has already indicated they want a static/clean diagram, skip the question.For worked examples of common layout problems (stacked edges, repeated labels, observability inside VNet, etc.), see references/layout-antipatterns.md.
Vendor-specific topology guidance lives in per-cloud reference files. Load the one that matches the diagram — or both for multi-cloud:
Shared rules that apply to both — containment, edge routing, and hard XML constraints — stay in references/xml-authoring-rules.md.
Use this section for diagrams that show temporal flows — what happens in order — rather than infrastructure topology. No shape lookup via drawio/search_shapes is required.
| Diagram type | Keywords | Layout |
|---|---|---|
| Auth / authorisation flow | OAuth, OIDC, JWT, SSO, login, token exchange, Entra, Cognito | Swimlane interaction flow |
| API / microservice call chain | REST, GraphQL, request/response, service-to-service, API gateway | Swimlane or vertical flowchart |
| CI/CD pipeline | pipeline, build, deploy, release, GitHub Actions, Azure DevOps, approval gate | Horizontal pipeline flowchart |
Swimlane interaction flow (auth / API flows with 2–5 actors):
swimlane lanes stacked vertically at parent="1", one actor per lane: swimlane;horizontal=0;startSize=110;fillColor=<pastel>;html=1; with geometry x=0, y=lane_index*150, width=CANVAS_W, height=150parent="<lane_id>") with coordinates relative to the lane: x = 120 + col*180, y = 45, size 140x60 (140x80 for decision diamonds). The x=120 start clears the 110px title area1., 2., 3.) in the label so execution order is unambiguousparent="1", not inside a lane, or they are clippededgeStyle=orthogonalEdgeStyle; and let the routing pass place the bendsmax_col * 180 + 300; do not nest lanes inside a pool or vary lane heightsactor_count * 150 + 100Horizontal pipeline flowchart (CI/CD):
rounded=1 rectangles for stages, rhombus shape for gate / decision pointspostLayout: "elk" with direction: "horizontal" — without direction the default vertical pass stacks the pipeline top-to-bottompageWidth="1700" pageHeight="600"Edge colours (consistent with topology palette):
| Meaning | strokeColor | Style |
|---|---|---|
| Primary request / call | #0078D4 Azure blue | solid, strokeWidth=2 |
| Success response / return | #00897B Teal | solid, strokeWidth=2 |
| Token / credential / redirect | #F57C00 Amber | dashed=1, strokeWidth=2 |
| Async / event-driven call | #5C6BC0 Indigo | dashed=1, strokeWidth=2 |
| Error / rejection / rollback | #C62828 Red | solid, strokeWidth=2 |
| Optional / conditional | #666666 Grey | dashed=1, strokeWidth=1 |
Participant lane colours (swimlane header + column background at opacity=30):
| Actor type | fillColor | strokeColor |
|---|---|---|
| User / browser / client | #dae8fc | #6c8ebf |
| Identity provider (Entra, Cognito, Okta) | #e6f4ea | #82b366 |
| API / backend service | #fff3e0 | #e6821e |
| Database / data store | #f5f5f5 | #666666 |
| Managed service / external system | #f3e5f5 | #7B1FA2 |
Stage fill colours (CI/CD pipeline):
| Stage | fillColor | fontColor |
|---|---|---|
| Source / Trigger | #0078D4 | #ffffff |
| Build | #00897B | #ffffff |
| Test / Quality Gate | #F57C00 | #ffffff |
| Deploy to Staging | #5C6BC0 | #ffffff |
| Approval Gate | #795548 | #ffffff |
| Deploy to Production | #43A047 | #ffffff |
| Rollback / Failure | #C62828 | #ffffff |
flowAnimation=1; works on sequence/flow edges exactly as in topology diagrams. Apply to primary call paths or pipeline stage transitions. Always ask the user before applying.
This applies to all shapes — cloud services, network equipment, brand logos, and any pictorial icon.
drawio/search_shapes is the only accepted source — do not guess or fabricate style strings.drawio/search_shapes before generating.drawio/search_shapes for an alternative, substitute, and regenerate.drawio/search_shapes searches all 10,000+ shapes across every draw.io library and returns ready-to-use style strings. Use it for any shape that has a name, brand, or product identity — not just cloud providers.
Example queries by category:
| Category | Example queries |
|---|---|
| Azure | "azure virtual machine", "azure key vault", "azure api management" |
| AWS | "aws lambda", "aws s3", "aws ec2" |
| GCP | "gcp compute engine", "gcp cloud storage" |
| Network equipment | "cisco router", "cisco firewall", "juniper switch" |
| Containers / orchestration | "kubernetes pod", "docker", "helm" |
| Brands / SaaS | "slack", "github", "jira", "salesforce" |
| On-premises / IT | "server", "database", "laptop", "printer" |
Always use the returned style value directly on the mxCell — never guess or fabricate a style string.
The style format varies by library:
# Image-based (Azure azure2, SVG files)
image;aspect=fixed;html=1;points=[];align=center;image=img/lib/azure2/<category>/<Name>.svg;
# Stencil-based (AWS4, shape library)
shape=mxgraph.aws4.<name>;fillColor=<color>;fontColor=#ffffff;strokeColor=none;
# Stencil-based (Cisco, Kubernetes, etc.)
shape=mxgraph.cisco.<category>.<name>;sketch=0;html=1;
# Icon-service (brand logos and concept icons, returned as an absolute URL)
shape=image;html=1;verticalLabelPosition=bottom;verticalAlign=top;image=https://<icon-service-host>/<icon>.svg;
When the built-in libraries have no strong match, search_shapes supplements results from the draw.io icon service (the same grouped icon search the editor sidebar uses) and returns them as shape=image styles with an absolute URL. These are valid results — use them as returned rather than rejecting them for not matching an img/lib/... path.
If any shapes do not render correctly:
drawio/search_shapes to find alternative verified style strings.OK, then generate the diagram.| Format | How | Notes |
|---|---|---|
| SVG | File → Export As → SVG | Recommended — preserves flowAnimation moving-dot effects and all icon rendering. Use for sharing or embedding. |
| PNG | File → Export As → PNG | Static snapshot. flowAnimation effects are not captured; icons and colours are preserved. |
| PDF | File → Export As → PDF | Best for printed or document-embedded diagrams. Static only. |
| .drawio file | File → Save As | Preserves all XML, animation settings, and style attributes for future editing. |
> flowAnimation=1 is only visible when the diagram is open in draw.io desktop or rendered as SVG. It does not appear in PNG or PDF exports — inform the user of this if they ask why the animation isn't showing.
MCP: List Servers.MCP: Reset Cached Tools if tool list is stale.<!-- -->) are forbidden — the MCP server rejects them. Remove all comments before submitting.</>/& in style strings).parent="1", background rectangles must be defined before the icons they sit behind, or they render on top. Using real containers (swimlane, container=1) avoids the problem entirely — children always render above their parent.html=1 in style is required for any cell whose value contains HTML tags (<b>, <br>, <i>). Newlines via 
 work without it.sketch=0 in search results: if drawio/search_shapes returns a style string containing sketch=0, preserve it exactly — omitting it enables the hand-drawn sketch rendering mode for that shape.search_shapes; they reflect the intended aspect ratio. When normalising a row of icons for visual consistency, 64×64 is a safe common size. Never change the aspect ratio of an icon that has aspect=fixed in its style.drawio/search_shapes for an alternative exact style string.See references/REFERENCE.md for diagram-type prompt presets and references/layout-antipatterns.md for the pre-flight layout checklist.
drawio/search_shapes before generating; unconfirmed icons are not used.routing: "libavoid" for hand-placed/container layouts; postLayout: "elk" — with direction: "horizontal" for left-to-right flows — for directional diagrams; never both).flowAnimation=1; applied only to user-identified edges.swimlane, children parented to their container with relative coordinates, cross-container edges at parent="1"..drawio (wrapped in <mxfile>) if requested, following references/standalone-file-requirements.md.source/target: no hand-written <Array as="points"> waypoints or exitX/entryX overrides unless a documented exception applies. See references/xml-authoring-rules.md.Take thomast1906/drawio-mcp-diagramming from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npx.
Without those the skill loads but fails at the first command.