Draw.io MCP Server
Builds, edits and exports draw.io diagrams live in a browser tab under an assistant's direction
Draws and edits draw.io diagrams for coding agents on a live canvas in your browser
By Dayuan Jiang (individual) TypeScript Local · stdio Design
79 popularity score ★ 37k ↓ 22k/wk
Opens the app, which asks before it adds the server.
claude mcp add next-ai-draw-io -- npx @next-ai-drawio/mcp-server@latest{
"mcpServers": {
"next-ai-draw-io": {
"command": "npx",
"args": [
"@next-ai-drawio/mcp-server@latest"
]
}
}
}{
"mcpServers": {
"next-ai-draw-io": {
"command": "npx",
"args": [
"@next-ai-drawio/mcp-server@latest"
]
}
}
}{
"servers": {
"next-ai-draw-io": {
"type": "stdio",
"command": "npx",
"args": [
"@next-ai-drawio/mcp-server@latest"
]
}
}
}[mcp_servers.next-ai-draw-io]
command = "npx"
args = ["@next-ai-drawio/mcp-server@latest"]gemini mcp add --scope user next-ai-draw-io npx -- @next-ai-drawio/mcp-server@latestPORT |
Optional: Preview port; when taken, the next free one up to 6020 is used. |
|---|---|
DRAWIO_DATA_DIR |
Optional: Folder for saved diagrams and instructions.md; off turns saving off. |
BROWSER |
Optional: none stops it opening the preview by itself; start_session still returns the address. |
DRAWIO_AUTO_SCREENSHOT |
Optional: true adds a screenshot to every create and edit result (2 to 10 s each). |
DRAWIO_BASE_URL |
Optional: Address of another draw.io, such as a self-hosted one, used instead of the bundled copy. |
DRAWIO_LANG |
Optional: Fixes the editor and preview language (en, zh, zh-tw, ja, de and so on). |
DRAWIO_UI |
Optional: Fixes the draw.io theme: kennedy, atlas, dark, min, sketch or simple. |
DRAWIO_DARK |
Optional: 1 starts dark, 0 starts light, auto follows the system. |
DRAWIO_ALLOW_EMBED |
Optional: true lets pages served from localhost or 127.0.0.1 show the preview in a frame, as DeepSeek Harness does. |
DRAWIO_PREVIEW_UI |
Optional: classic opens the older preview page, without outlines, Ctrl+Z or get_selection. |
DEBUG |
Optional: true writes debug messages to stderr. |
Next AI Draw.io MCP Server gives Claude Code, Codex, Cursor, VS Code and other agents a draw.io canvas to work on, for example to sketch the architecture of the project they have open. It belongs to the Next AI Draw.io project, which also has a web app and a desktop app; the MCP server reuses the web app's canvas as a preview page that opens in your browser.
The agent writes diagrams as draw.io mxCell XML and changes single cells by id. It reads back what you changed by hand and which shapes you selected, so you can say "these" and point. It can take a PNG of the rendered page to look for overlapping shapes, work across several pages (tabs), look up the icon names of libraries such as AWS, Azure, GCP, Kubernetes and Cisco, open .drawio and .drawio.svg files, and export to .drawio, .png, .svg or .drawio.svg. Its edits are outlined for a moment in the preview, one Ctrl+Z undoes them, and the last 20 versions of each diagram can be restored.
It runs on your machine with npx and needs no account or key. The draw.io editor comes inside the package, so it works offline, or DRAWIO_BASE_URL points it at your own draw.io. Each diagram is saved to ~/.next-ai-drawio and the newest 50 are kept; an instructions.md file in that folder adds your own drawing rules, of which the first 5000 characters are used.
The code shows one thing the README leaves out: export_diagram creates missing folders and writes to the path it is given without checking whether a file is already there, so an existing file of that name is replaced (src/index.ts).
| Runtime | Node.js 18+ |
|---|---|
| Runs on | macOS, Windows, Linux |
| Also |
|
It suits someone who wants to work on one diagram together with an agent: the agent draws, you adjust shapes by hand in the browser, and the agent reads your changes before its next edit. Runs locally and offline with no sign-up. It needs a browser tab open for screenshots and image export, so it fits a desktop session more than a headless one. Its own README compares other options: draw.io's official server (draw-io here) opens each diagram in the full draw.io editor or shows it inside chat apps through a hosted endpoint, but no tool reads the diagram back; lgazo's drawio-mcp-server (drawio-mcp-server here) has finer-grained shape and layer tools, handles several documents, imports Mermaid.
7 only read, 8 change things, 1 can delete or overwrite. A ? marks an optional parameter.
start_session changessession_id?: stringcreate_new_diagram changesxml: stringscreenshot?: booleanedit_diagram changesoperations: arrayscreenshot?: booleanpage_id?: stringpage_name?: stringpage_index?: integerget_diagrampage_id?: stringpage_name?: stringpage_index?: integerget_selectionscreenshot_diagrampage_id?: stringpage_name?: stringpage_index?: integerload_diagram changespath?: stringxml?: stringexport_diagram deletespath: stringformat?: enumtransparent?: booleanpage_id?: stringpage_name?: stringpage_index?: integerrestore_version changessteps_back?: integerlist_saved_diagramsget_drawing_guidetopic?: enumget_shape_librarylibrary: stringlist_pagesadd_page changesname?: stringid?: stringxml?: stringrename_page changesnew_name: stringpage_id?: stringpage_name?: stringpage_index?: integerdelete_page changespage_id?: stringpage_name?: stringpage_index?: integer