Draw.io MCP Server
OFFICIAL SERVEROfficial draw.io server that turns XML, Mermaid or CSV into diagrams shown in chat or opened in the editor
Builds, edits and exports draw.io diagrams live in a browser tab under an assistant's direction
By Ladislav Gazo (individual) TypeScript Local · stdio Design
64 popularity score ★ 1.5k ↓ 3.7k/wk
Opens the app, which asks before it adds the server.
claude mcp add draw-io -- npx -y drawio-mcp-server --editor{
"mcpServers": {
"draw-io": {
"command": "npx",
"args": [
"-y",
"drawio-mcp-server",
"--editor"
]
}
}
}{
"mcpServers": {
"draw-io": {
"command": "npx",
"args": [
"-y",
"drawio-mcp-server",
"--editor"
]
}
}
}{
"servers": {
"draw-io": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"drawio-mcp-server",
"--editor"
]
}
}
}[mcp_servers.draw-io]
command = "npx"
args = ["-y", "drawio-mcp-server", "--editor"]gemini mcp add --scope user draw-io npx -- -y drawio-mcp-server --editorDRAWIO_MCP_EDITOR |
Optional: true is the same as --editor: host the built-in draw.io editor (otherwise the browser extension is needed). |
|---|---|
DRAWIO_MCP_HTTP_PORT |
Optional: Port for the HTTP transport and built-in editor. |
DRAWIO_MCP_EXTENSION_PORT |
Optional: WebSocket port the editor or extension connects to. |
DRAWIO_MCP_TRANSPORT |
Optional: stdio, http, or stdio,http. |
DRAWIO_MCP_HOST |
Optional: Bind address for HTTP and WebSocket; unset lets the OS choose. |
DRAWIO_MCP_ASSET_PATH |
Optional: Folder for the downloaded draw.io editor files instead of the user cache. |
DRAWIO_MCP_WEBSOCKET_URL |
Optional: WebSocket URL advertised to the editor, for example behind a reverse proxy. |
DRAWIO_MCP_LOGGER |
Optional: console (stderr) or mcp-server log notifications. |
| Set together: tls | |
DRAWIO_MCP_TLS |
Optional: true turns on HTTPS and WSS, needed for Firefox. Give a cert and key, or DRAWIO_MCP_TLS_AUTO. |
DRAWIO_MCP_TLS_AUTO |
Optional: true creates a self-signed certificate from a local CA (needs DRAWIO_MCP_TLS). |
DRAWIO_MCP_TLS_CERT |
Optional: Path to your own certificate PEM, used with DRAWIO_MCP_TLS_KEY. |
DRAWIO_MCP_TLS_KEY |
Optional: Path to the private key PEM for DRAWIO_MCP_TLS_CERT. |
This server links an MCP client to a draw.io editor open in your browser, so you can watch the diagram change while the assistant works on it. It places shapes and connectors, changes how they look and where they sit, nests one inside another, and manages pages and layers. Shapes come from the stencil libraries draw.io ships with, and the AWS, GCP, Azure, Cisco19 and CiscoSafe icons are looked up at runtime from the editor's sidebar. Whole diagrams can be imported or exported as XML or as images with the XML embedded. Mermaid source can become native draw.io cells or an editable embedded image.
You connect in one of two ways. Start it with --editor and it serves its own copy of draw.io at http://localhost:3000/, which you open in a browser. Without that flag you open app.diagrams.net yourself, and a Chrome or Firefox extension joins the tab to the server over a WebSocket on port 3333. Several documents can be open at once, and calls aimed at the same document wait in a queue, so more than one agent can work side by side.
The released package registers 30 tools, listed in src/tools/index.ts. The README on main also describes a show-diagram tool that opens the diagram inside MCP Apps hosts, but that tool is not in the published release yet. With --editor the editor is not shipped in the npm package. On first start the server downloads the latest draw.war release from jgraph/drawio on GitHub and unpacks it into your user cache unless --asset-path names another folder (src/assets/downloader.ts). There is also an installer subcommand, npx drawio-mcp-server install <host>, that writes the client config for you. It knows claude-code, claude-desktop, codex, zed and opencode.
| Runtime | Node.js 22+ |
|---|---|
| Runs on | macOS, Windows, Linux |
| Also |
|
Node.js 22 or newer. A web browser with draw.io open: either the built-in editor started with --editor (internet access on first start to download draw.io from GitHub), or app.diagrams.net plus the Draw.io MCP browser extension for Chrome or Firefox. Firefox needs TLS mode (--tls with your own certificate, or --tls --tls-auto and trusting the generated local CA).
It does nothing until a draw.io tab is open and connected; every live tool works on a connected tab, and when several documents are connected each call must name one with target_document. Some tools (get-selected-cell, set-active-layer, get-active-layer, import-diagram, selection exports) act through the visible page and may switch it. save-document only triggers draw.io's own Save; sign-in, conflict or Save As prompts still need you in the tab. export-diagram writes a file only to an absolute output_path whose folder already exists. Support for the draw.io desktop app is marked experimental and is blocked by draw.io's connect-src CSP, so the WebSocket link fails there.
Suits developers and architects who want an assistant to draw and rearrange real, editable draw.io diagrams on their own machine, including cloud architecture with vendor icons, multi-page diagrams or Mermaid conversion. It needs a browser tab kept open, so it fits desktop work rather than headless pipelines. It is a community project, not from draw.io's makers: jgraph publishes its own draw.io MCP server (which we also list), whose hosted endpoint at mcp.draw.io renders diagrams inside the chat without an install, and whose tool server opens diagrams in a new browser tab rather than editing a live one cell by cell.
10 only read, 17 change things, 3 can delete or overwrite. A ? marks an optional parameter.
list-documentsset-document-title changestitle: stringsave-document changesget-selected-celltarget_page: objectget-shape-categoriesget-shapes-in-categorycategory_id: stringget-shape-by-nameshape_name: stringlist-paged-modeltarget_page: objectpage: objectpage_size?: numberfilter?: objectadd-rectangle changestarget_page: objectx?: numbery?: numberwidth?: numberheight?: numbertext?: stringstyle?: stringparent_id?: stringadd-edge changestarget_page: objectsource_id: stringtarget_id: stringtext?: stringstyle?: stringpoints?: arrayparent_id?: stringdelete-cell-by-id deletestarget_page: objectcell_id: stringadd-cell-of-shape changestarget_page: objectshape_name: stringx?: numbery?: numberwidth?: numberheight?: numbertext?: stringstyle?: stringparent_id?: stringset-cell-shape changestarget_page: objectcell_id: stringshape_name: stringset-cell-data changestarget_page: objectcell_id: stringkey: stringvalue: anyedit-cell changestarget_page: objectcell_id: stringtext?: stringx?: numbery?: numberwidth?: numberheight?: numberstyle?: stringedit-edge changestarget_page: objectcell_id: stringtext?: stringsource_id?: stringtarget_id?: stringstyle?: stringpoints?: arrayset-cell-parent changestarget_page: objectcell_id: stringparent_id: stringlist-pagesget-current-pagecreate-page changesname: stringcopy-page changespage: objectname?: stringrename-page changespage: objectname: stringlist-layerstarget_page: objectset-active-layer changestarget_page: objectlayer_id: stringmove-cell-to-layer changestarget_page: objectcell_id: stringtarget_layer_id: stringget-active-layertarget_page: objectcreate-layer changestarget_page: objectname: stringexport-diagram changestarget_page: objectformat: enumscale?: numberborder?: numberbackground?: stringshadow?: booleancrop?: booleanselection_only?: booleantransparent?: booleandpi?: numberembed_xml?: booleansize?: enumoutput_path?: stringimport-diagram deletestarget_page: objectdata: stringformat: enummode?: enumfilename?: stringimport-mermaid deletestarget_page: objectmermaid_source: stringmode?: enuminsert_mode?: enum