drawio-mcp
Click on "Install 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., "@drawio-mcpCreate a flowchart for user login process in login.drawio"
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.
drawio-mcp
MCP server that lets AI assistants create, read, and edit draw.io diagrams. Pair it with the VS Code draw.io extension and watch diagrams update in real time as the AI works.
What can it do?
Create diagrams — flowcharts, architecture diagrams, sequence diagrams from natural language
Read & understand — parse existing
.drawiofiles and describe their structureEdit precisely — add/remove/update individual nodes and edges
Undo mistakes — full history with undo/redo, independent of the editor's Ctrl+Z
Live preview — changes appear instantly in the VS Code draw.io editor, no reload
Install
Click one of the badges above, or add this to .vscode/mcp.json in your project:
{
"servers": {
"drawio": {
"command": "npx",
"args": ["-y", "github:abossard/drawio-mcp"]
}
}
}Tip: Commit this file to your repo — every contributor gets diagram support automatically.
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["-y", "github:abossard/drawio-mcp"]
}
}
}Add to your User settings.json (Cmd+Shift+P → Preferences: Open User Settings (JSON)):
{
"mcp": {
"servers": {
"drawio": {
"command": "npx",
"args": ["-y", "github:abossard/drawio-mcp"]
}
}
}
}Related MCP server: Draw.io MCP Server
Usage
Just ask your AI assistant:
"Create a flowchart for a user login process in
docs/login-flow.drawio"
"Read
architecture.drawioand describe the components"
"Add a Redis cache node between the API and Database, then highlight it"
"Undo the last change"
The server also ships with prompt templates — try asking to "use the architecture prompt" or "use the flowchart prompt".
Tools
Diagram manipulation
Tool | Description |
| Create a new |
| Parse and return all pages, nodes, and edges |
| Add a shape with label, position, size, and style |
| Connect two nodes with optional label and style |
| Modify label, style, position, or size |
| Delete a node or edge by ID |
| Add a new page/tab |
| List all predefined styles |
History
Tool | Description |
| Restore file to previous state |
| Re-apply last undone change |
| List recent operations |
Visual feedback
Tool | Description |
| Flash elements with a colored highlight |
| Show AI cursor position † |
| Highlight AI-selected cells † |
| Status bar message † |
| Loading spinner † |
† Requires the companion extension.
Predefined styles
Use the shape parameter in add_node or edgeStyle in add_edge:
Category | Styles |
Shapes |
|
Flowchart |
|
Architecture |
|
UML |
|
Colors |
|
Edges |
|
How it works
AI Assistant ──(MCP)──> drawio-mcp server ──(writes XML)──> .drawio file
│
VS Code draw.io extension
detects change & live-merges
│
draw.io webview
(instant update ✨)✅ No page reload — changes merge seamlessly
✅ Undo works — each write becomes one Ctrl+Z step
✅ User selection preserved — the merge doesn't disrupt anything
Companion Extension (Optional)
The companion VS Code extension adds real-time AI presence overlays to the draw.io editor. Without it the core MCP tools (create, read, edit, undo) work fine — the extension adds the visual extras.
What it adds
Feature | Description |
🤖 AI cursor | Shows where the AI is "looking" in the diagram |
🔲 Cell selection | Highlights which cells the AI is editing |
✨ Flash highlight | Temporary colored flash on elements |
💬 Status messages | Shows AI status in the editor (e.g. "Adding database…") |
⏳ Spinner | Loading indicator during long operations |
📐 Auto-layout | Applies layout algorithms (hierarchical, organic, tree, circle, radial) |
Prerequisites
draw.io VS Code extension — install from the marketplace or run:
code --install-extension hediet.vscode-drawio # or for Insiders: code-insiders --install-extension hediet.vscode-drawio
Install the Bridge Extension
# From the drawio-mcp repo root:
cd vscode-drawio-mcp-bridge
npm install
npm run build
npx @vscode/vsce package --allow-missing-repositoryThis produces a drawio-mcp-bridge-0.1.0.vsix file. Install it:
code --install-extension ./drawio-mcp-bridge-0.1.0.vsix
# or for Insiders:
code-insiders --install-extension ./drawio-mcp-bridge-0.1.0.vsixAlternatively, in VS Code: F1 → "Extensions: Install from VSIX…" → select drawio-mcp-bridge-0.1.0.vsix.
Verify
Reload VS Code (Cmd+Shift+P → "Developer: Reload Window")
Open any
.drawiofileA small activity log panel appears in the top-left of the draw.io editor showing connection status
Use the MCP tool
check_connectionto confirm the bridge is connected
The extension auto-connects to the MCP server's WebSocket sidecar when you open a .drawio file. No extra configuration needed.
Settings
Setting | Default | Description |
|
| WebSocket port (must match |
|
| Connect automatically when a |
|
| Color for AI cursor and selection overlays |
|
| Label shown next to the AI cursor |
Commands
Draw.io MCP: Connect to Server — manually connect to the sidecar
Draw.io MCP: Disconnect from Server — disconnect
How it works
┌─────────────────────────────────────────────────┐
│ VS Code │
│ │
│ draw.io extension drawio-mcp-bridge │
│ ┌──────────────┐ ┌─────────────────┐ │
│ │ draw.io │◄─plugin─┤ Injects JS into │ │
│ │ webview │ │ draw.io iframe │ │
│ └──────────────┘ └────────┬────────┘ │
│ │ WebSocket │
│ ┌──────────▼────────┐ │
│ │ drawio-mcp server │ │
│ │ sidecar (:9219) │ │
│ └───────────────────┘ │
└─────────────────────────────────────────────────┘The extension injects a plugin into the draw.io iframe that opens its own WebSocket to the MCP sidecar (ws://127.0.0.1:9219/drawio). AI actions (cursor moves, highlights, status) flow through this channel. User interactions (mouse position, cell selection) are sent back to the MCP server so the AI knows what the user is looking at.
Development
git clone https://github.com/abossard/drawio-mcp.git
cd drawio-mcp
npm install
npm testPoint VS Code at your local build — add to .vscode/mcp.json in any project:
{
"servers": {
"drawio-dev": {
"command": "node",
"args": ["/absolute/path/to/drawio-mcp/build/index.js"]
}
}
}Run npm run dev for watch mode — VS Code auto-restarts the server on each rebuild.
Command | Description |
| Compile TypeScript |
| Watch mode (rebuild on save) |
| Run tests |
| Watch mode for tests |
Environment Variables
Variable | Default | Description |
|
| WebSocket port for companion extension |
|
| Set to |
License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/abossard/drawio-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server