Next AI Draw.io MCP Server
Allows AI agents to generate and edit draw.io (diagrams.net) diagrams with real-time browser preview, version history, and export to .drawio files.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Next AI Draw.io MCP Server Create a flowchart for user authentication."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Next AI Draw.io MCP Server
MCP (Model Context Protocol) server that enables AI agents like Claude Desktop and Cursor to generate and edit draw.io diagrams with real-time browser preview.
Self-contained - includes an embedded HTTP server, no external dependencies required.
Quick Start
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["@next-ai-drawio/mcp-server@latest"]
}
}
}Related MCP server: Excalidraw MCP Server
Installation
Claude Desktop
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["@next-ai-drawio/mcp-server@latest"]
}
}
}VS Code
Add to your VS Code settings (.vscode/mcp.json in workspace or user settings):
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["@next-ai-drawio/mcp-server@latest"]
}
}
}Cursor
Add to Cursor MCP config (~/.cursor/mcp.json):
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["@next-ai-drawio/mcp-server@latest"]
}
}
}Cline (VS Code Extension)
Click the MCP Servers icon in Cline's top menu bar
Select the Configure tab
Click Configure MCP Servers to edit
cline_mcp_settings.jsonAdd the drawio server:
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["@next-ai-drawio/mcp-server@latest"]
}
}
}Claude Code CLI
claude mcp add drawio -- npx @next-ai-drawio/mcp-server@latestOther MCP Clients
Use the standard MCP configuration with:
Command:
npxArgs:
["@next-ai-drawio/mcp-server@latest"]
Usage
Restart your MCP client after updating config
Ask the AI to create a diagram:
"Create a flowchart showing user authentication with login, MFA, and session management"
The diagram appears in your browser in real-time!
Features
Real-time Preview: Diagrams appear and update in your browser as the AI creates them
Version History: Restore previous diagram versions with visual thumbnails - click the clock button (bottom-right) to browse and restore earlier states
Natural Language: Describe diagrams in plain text - flowcharts, architecture diagrams, etc.
Edit Support: Modify existing diagrams with natural language instructions
Export: Save diagrams as
.drawiofilesSelf-contained: Embedded server, works offline (except draw.io UI which loads from
embed.diagrams.netby default, configurable viaDRAWIO_BASE_URL)
Available Tools
Tool | Description |
| Opens browser with real-time diagram preview |
| Create a new diagram from XML (requires |
| Edit diagram by ID-based operations (update/add/delete cells) |
| Get the current diagram XML |
| Save diagram to a |
How It Works
┌─────────────────┐ stdio ┌─────────────────┐
│ Claude Desktop │ <───────────> │ MCP Server │
│ (AI Agent) │ │ (this package) │
└─────────────────┘ └────────┬────────┘
│
┌────────▼────────┐
│ Embedded HTTP │
│ Server (:6002) │
└────────┬────────┘
│
┌────────▼────────┐
│ User's Browser │
│ (draw.io embed) │
└─────────────────┘MCP Server receives tool calls from Claude via stdio
Embedded HTTP Server serves the draw.io UI and handles state
Browser shows real-time diagram updates via polling
Configuration
Variable | Default | Description |
|
| Port for the embedded HTTP server |
|
| Base URL for the draw.io embed. Set this to use a self-hosted draw.io instance for private deployments. |
Private Deployment (Self-hosted draw.io)
For security-sensitive environments that require private deployment of draw.io:
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["@next-ai-drawio/mcp-server@latest"],
"env": {
"DRAWIO_BASE_URL": "https://drawio.your-company.com"
}
}
}
}You can deploy your own draw.io instance using the official Docker image:
docker run -d -p 8080:8080 jgraph/drawioThen set DRAWIO_BASE_URL=http://localhost:8080 (or your server's URL).
Troubleshooting
Port already in use
If port 6002 is in use, the server will automatically try the next available port (up to 6020).
Or set a custom port:
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["@next-ai-drawio/mcp-server@latest"],
"env": { "PORT": "6003" }
}
}
}"No active session"
Call start_session first to open the browser window.
Browser not updating
Check that the browser URL has the ?mcp= query parameter. The MCP session ID connects the browser to the server.
License
Apache-2.0
Available Tools
5 toolscreate_new_diagramA
Create a NEW diagram from mxGraphModel XML. Use this when creating a diagram from scratch or replacing the current diagram entirely.
CRITICAL: You MUST provide the 'xml' argument in EVERY call. Do NOT call this tool without xml.
When to use this tool:
Creating a new diagram from scratch
Replacing the current diagram with a completely different one
Major structural changes that require regenerating the diagram
When to use edit_diagram instead:
Small modifications to existing diagram
Adding/removing individual elements
Changing labels, colors, or positions
XML FORMAT - Full mxGraphModel structure:
LAYOUT CONSTRAINTS:
Keep all elements within x=0-800, y=0-600 (single page viewport)
Start from margins (x=40, y=40), keep elements grouped closely
Use unique IDs starting from "2" (0 and 1 are reserved)
Set parent="1" for top-level shapes
Space shapes 150-200px apart for clear edge routing
EDGE ROUTING RULES:
Never let multiple edges share the same path - use different exitY/entryY values
For bidirectional connections (A↔B), use OPPOSITE sides
Always specify exitX, exitY, entryX, entryY explicitly in edge style
Route edges AROUND obstacles using waypoints (add 20-30px clearance)
Use natural connection points based on flow (not corners)
COMMON STYLES:
Shapes: rounded=1; fillColor=#hex; strokeColor=#hex
Edges: endArrow=classic; edgeStyle=orthogonalEdgeStyle; curved=1
Text: fontSize=14; fontStyle=1 (bold); align=center
Inputs: xml (required).
edit_diagramA
Edit the current diagram by ID-based operations (update/add/delete cells).
⚠️ REQUIRED: You MUST call get_diagram BEFORE this tool! This fetches the latest state from the browser including any manual user edits. Skipping get_diagram WILL cause user's changes to be LOST.
Workflow:
Call get_diagram to see current cell IDs and structure
Use the returned XML to construct your edit operations
Call edit_diagram with your operations
Operations:
add: Add a new cell. Provide cell_id (new unique id) and new_xml.
update: Replace an existing cell by its id. Provide cell_id and complete new_xml.
delete: Remove a cell by its id. Only cell_id is needed.
For add/update, new_xml must be a complete mxCell element including mxGeometry.
Example - Add a rectangle: {"operations": [{"operation": "add", "cell_id": "rect-1", "new_xml": "<mxCell id="rect-1" value="Hello" style="rounded=0;" vertex="1" parent="1"><mxGeometry x="100" y="100" width="120" height="60" as="geometry"/>"}]}
Example - Update a cell: {"operations": [{"operation": "update", "cell_id": "3", "new_xml": "<mxCell id="3" value="New Label" style="rounded=1;" vertex="1" parent="1"><mxGeometry x="100" y="100" width="120" height="60" as="geometry"/>"}]}
Example - Delete a cell: {"operations": [{"operation": "delete", "cell_id": "rect-1"}]}
Inputs: operations (required).
export_diagramA
Export the current diagram to a .drawio file.
Inputs: path (required).
get_diagramA
Get the current diagram XML (fetches latest from browser, including user's manual edits). Call this BEFORE edit_diagram if you need to update or delete existing elements, so you can see the current cell IDs and structure.
Inputs: no named parameters.
start_sessionA
Start a new diagram session and open the browser for real-time preview. Starts an embedded server and opens a browser window with draw.io. The browser will show diagram updates as they happen.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool targets a distinct phase of the diagram workflow: session startup, creation, modification, retrieval, and export. The descriptions explicitly clarify the boundary between create_new_diagram and edit_diagram, preventing misselection.
All tool names follow a verb_noun pattern in snake_case (start_session, edit_diagram, get_diagram, export_diagram; create_new_diagram includes an adjective but still starts with a verb). There is no mixed case or inconsistent verb tense.
With 5 tools covering the complete lifecycle of a draw.io diagram, the count is well-scoped. It is not too small to be limiting nor too large to be confusing.
The tool set covers the full workflow: start a session, create a new diagram, read the current state, apply modifications (including add/update/delete operations), and export. No critical gaps are apparent for the stated purpose of diagram creation and editing.
Maintenance
Related MCP Connectors
Create and edit architecture diagrams from your AI agent; get an SVG and a live editable canvas.
Draw architecture diagrams, UML, planning boards and clickable wireframes from your AI assistant.
Create, edit and organize hand-drawn diagrams (flowcharts, ER, architecture) from any AI agent.
Saves the diagrams your AI draws and gives you a link to share. Edits update the same link.
Related MCP Servers
- AlicenseBqualityAmaintenanceEnables AI agents to programmatically create, modify, and analyze Draw.io diagrams through the Model Context Protocol. Supports generating architectural diagrams, flowcharts, and visualizations with bidirectional communication between AI systems and Draw.io.13109 npm1,498MIT
- AlicenseAqualityDmaintenanceEnables AI agents to programmatically generate, edit, and view Excalidraw diagrams with real-time browser synchronization. It provides a suite of tools for adding shapes, text, and arrows to diagrams through natural language interactions.113,392 npm102MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to create, modify, and analyze diagrams using Draw.io (Diagrams.net) through MCP commands.MIT
- FlicenseNot gradedqualityFmaintenanceEnables AI assistants to create, read, and manage Draw.io diagrams programmatically through natural language interactions.1-