From drawio-diagramming
Guides configuration of draw.io MCP servers for AI-assisted diagram creation, editing, rendering in Claude.ai, VS Code, and local setups with CLI exports.
How this skill is triggered — by the user, by Claude, or both
Slash command
/drawio-diagramming:mcp-integrationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
There are two main MCP server options for draw.io integration:
There are two main MCP server options for draw.io integration:
Both enable AI assistants to create, read, update, and manage draw.io diagrams programmatically.
The official MCP server operates in multiple modes depending on the deployment context.
A hosted MCP endpoint that renders diagrams as interactive iframes directly in AI chat interfaces.
Endpoint: https://mcp.draw.io/mcp
Features:
Configuration for Claude.ai:
https://mcp.draw.io/mcpConfiguration for VS Code (Copilot Chat):
// .vscode/settings.json
{
"mcp": {
"servers": {
"drawio": {
"type": "http",
"url": "https://mcp.draw.io/mcp"
}
}
}
}
A locally-run MCP server that opens diagrams in the draw.io editor.
Installation and Usage:
npx @drawio/mcp
Features:
Configuration:
// .mcp.json (project-level)
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["-y", "@drawio/mcp"]
}
}
}
Claude Desktop config:
// ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
// %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["-y", "@drawio/mcp"]
}
}
}
Uses draw.io Desktop's command-line interface for generating native .drawio files and exporting to image formats.
Requirements:
drawio CLI available in PATHCapabilities:
.drawio files from XML--embed-diagram flag for round-trip editingxvfb-run on Linux)Export Commands:
# Export to editable SVG
drawio --export --format svg --embed-diagram --output diagram.drawio.svg diagram.drawio
# Export to editable PNG
drawio --export --format png --embed-diagram --output diagram.drawio.png diagram.drawio
# Export to PDF
drawio --export --format pdf --output diagram.pdf diagram.drawio
# Export specific page
drawio --export --format svg --page-index 2 --output page3.svg diagram.drawio
# Export with custom dimensions
drawio --export --format png --width 1920 --border 10 --output diagram.png diagram.drawio
# Crop to content
drawio --export --format svg --crop --output cropped.svg diagram.drawio
Zero-installation mode that works by pasting draw.io generation instructions directly into a Claude Project's custom instructions. The AI generates clickable draw.io URLs using Python URL encoding.
How it works:
URL format:
https://app.diagrams.net/#R<URL-encoded-XML>
Python URL generation:
import urllib.parse
xml = '''<mxGraphModel>
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="2" value="Hello" style="rounded=1;" vertex="1" parent="1">
<mxGeometry x="100" y="100" width="120" height="60" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>'''
encoded = urllib.parse.quote(xml, safe='')
url = f'https://app.diagrams.net/#R{encoded}'
print(url)
An open-source MCP server with a built-in web-based draw.io editor and comprehensive CRUD tools.
# Run directly with npx (recommended)
npx -y drawio-mcp-server --editor
# Or install globally
npm install -g drawio-mcp-server
drawio-mcp-server --editor
Version: 1.8.0+ (MIT License)
When started with --editor, the server launches a web-based draw.io editor:
http://localhost:3000/
Features:
drawio-mcp-server [options]
Options:
--editor Launch built-in web editor (default port 3000)
--port <number> Custom port for the editor
--file <path> Open a specific .drawio file on startup
--help Show help
The community server exposes these MCP tools:
| Tool | Description |
|---|---|
create_shape | Create a new shape (vertex) |
update_shape | Modify shape properties (position, size, style, label) |
delete_shape | Remove a shape |
read_shape | Get shape details (style, geometry, label) |
create_shape parameters:
{
"label": "API Gateway",
"x": 100,
"y": 100,
"width": 140,
"height": 60,
"style": "rounded=1;fillColor=#dae8fc;strokeColor=#6c8ebf;"
}
update_shape parameters:
{
"id": "cell-id",
"label": "Updated Label",
"x": 200,
"y": 150,
"style": "fillColor=#d5e8d4;strokeColor=#82b366;"
}
| Tool | Description |
|---|---|
create_edge | Create a connector between shapes |
update_edge | Modify edge properties (label, style, routing) |
delete_edge | Remove an edge |
create_edge parameters:
{
"source": "source-cell-id",
"target": "target-cell-id",
"label": "REST API",
"style": "edgeStyle=orthogonalEdgeStyle;strokeWidth=2;"
}
| Tool | Description |
|---|---|
create_text | Create a text label element |
update_text | Modify text properties |
| Tool | Description |
|---|---|
read_diagram | Get the full diagram structure |
inspect_diagram | Analyze diagram contents (shapes, edges, layers) |
clear_diagram | Remove all elements |
| Tool | Description |
|---|---|
create_layer | Create a new diagram layer |
switch_layer | Change the active layer |
list_layers | List all layers |
Available for Chrome and Firefox. Enables the MCP server to interact with draw.io running in a browser tab.
Chrome Extension: Search "drawio-mcp" in Chrome Web Store Firefox Extension: Search "drawio-mcp" in Firefox Add-ons
The community server is designed for iterative, conversational diagram creation:
This is more efficient than regenerating full XML because only changed elements are modified.
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["-y", "@drawio/mcp"]
}
}
}
Or with the community server:
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["-y", "drawio-mcp-server", "--editor"]
}
}
}
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["-y", "@drawio/mcp"]
}
}
}
# Add official server
claude mcp add-json drawio '{"command":"npx","args":["-y","@drawio/mcp"]}'
# Add community server with editor
claude mcp add-json drawio '{"command":"npx","args":["-y","drawio-mcp-server","--editor"]}'
// .vscode/settings.json
{
"mcp": {
"servers": {
"drawio-app": {
"type": "http",
"url": "https://mcp.draw.io/mcp"
},
"drawio-local": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@drawio/mcp"]
}
}
}
}
// ~/.config/zed/settings.json
{
"context_servers": {
"drawio": {
"command": {
"path": "npx",
"args": ["-y", "@drawio/mcp"]
}
}
}
}
// .cursor/mcp.json
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["-y", "@drawio/mcp"]
}
}
}
// ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["-y", "@drawio/mcp"]
}
}
}
| Feature | Official @drawio/mcp | Community drawio-mcp-server |
|---|---|---|
| Maintained by | jgraph (draw.io team) | Community (lgazo) |
| License | Proprietary | MIT |
| Hosted option | Yes (mcp.draw.io) | No |
| Built-in editor | No (opens draw.io app) | Yes (localhost:3000) |
| CRUD MCP tools | Limited | Full (shapes, edges, layers) |
| Inline rendering | Yes (iframes in chat) | No |
| File export | Yes (via CLI) | Via editor |
| Mermaid support | Yes | No |
| CSV import | Yes | No |
| Browser extension | No | Yes |
| Desktop app required | For CLI mode | No |
| Vibe Diagramming | Via chat | Via MCP tools + editor |
Recommendation:
User: "Create an architecture diagram for my microservices"
|
v
AI generates draw.io XML
|
v
MCP server renders/opens diagram
|
v
User views and refines
Source code analysis
|
v
Extract classes/services/dependencies
|
v
Generate draw.io XML programmatically
|
v
Save as .drawio.svg in repo
|
v
Auto-rendered in GitHub README
Health check API
|
v
Python update script (see conditional-formatting skill)
|
v
Update .drawio file with status colors
|
v
Export to .drawio.svg
|
v
Commit to repo (via CI/CD)
|
v
Dashboard page auto-updates
Developer writes/modifies .drawio file
|
v
Git commit triggers CI
|
v
CI exports to .drawio.svg (drawio CLI)
|
v
SVGs embedded in docs site
|
v
Confluence/wiki syncs from Git
| Issue | Cause | Fix |
|---|---|---|
npx: command not found | Node.js not installed | Install Node.js v20+ |
EACCES permission denied | npm global dir permissions | Use npx -y or fix npm permissions |
| Connection refused on port 3000 | Port already in use | Use --port 3001 or kill existing process |
| MCP server not detected | Wrong config file location | Verify config path for your client |
| Diagram not rendering | Invalid XML | Run validation script from ai-generation skill |
Cannot find module | npm cache issue | npm cache clean --force && npx -y ... |
| Timeout on diagram operations | Large diagram | Increase timeout in MCP client config |
| Editor blank on startup | Browser cache | Clear browser cache, try incognito |
Both servers require Node.js v20 or later:
node --version # Must be v20.0.0 or higher
# Install via nvm if needed
nvm install 20
nvm use 20
| Client | Official @drawio/mcp | Community drawio-mcp-server |
|---|---|---|
| Claude.ai | Yes (hosted) | No |
| Claude Desktop | Yes | Yes |
| Claude Code CLI | Yes | Yes |
| VS Code (Copilot) | Yes (hosted + local) | Yes (local) |
| Cursor | Yes | Yes |
| Zed | Yes | Yes |
| Windsurf | Yes | Yes |
| Continue | Yes | Yes |
# Test official server
npx @drawio/mcp --help
# Test community server
npx drawio-mcp-server --help
# Check if MCP port is in use
lsof -i :3000
# Run with verbose logging
DEBUG=* npx drawio-mcp-server --editor
# Verify MCP config is valid JSON
python3 -c "import json; json.load(open('.mcp.json'))"
In Claude Code:
# List registered MCP servers
claude mcp list
# Test connection
claude mcp test drawio
npx claudepluginhub markus41/claude --plugin drawio-diagrammingIntegrates Claude Code with draw.io desktop app using OS detection, editor path lookup, CLI exports to SVG/PNG/PDF, file watching, and iterative AI-human diagram workflows. Auto-triggers on .drawio files.
Creates and exports editable draw.io / diagrams.net technical diagrams — architecture, ERD, UML, sequence, flowcharts, ML models, brand symbols, Graphviz auto-layout, codebase structure maps — with .drawio validation and CLI export fallback.
Generates SAP BTP solution architecture diagrams as native draw.io files following official SAP guidelines. Opens them via a configured draw.io MCP server. For BTP architecture diagrams only, not generic flowcharts or UML.