Install
$ claude mcp add --scope user drawio -- npx @next-ai-drawio/mcp-server@latest--scope user makes the tools available in every project. Without it, they exist only in the folder where you ran the command.
Or install it as a plugin from the Claude Code community marketplace (Claude Code 2.1.275 or later):
/plugin install next-ai-drawio --marketplace anthropics/claude-plugins-community$ codex mcp add drawio -- npx @next-ai-drawio/mcp-server@latestCodex asks before each drawio tool that changes the diagram, and codex exec without full access fails with "MCP tool call requires approval". To let the drawio tools run without asking, add one line to the server's section in ~/.codex/config.toml:
[mcp_servers.drawio]
command = "npx"
args = ["@next-ai-drawio/mcp-server@latest"]
default_tools_approval_mode = "approve"To approve only some tools, use [mcp_servers.drawio.tools.<tool name>] with approval_mode = "approve" instead.
Or write it in .vscode/mcp.json:
{
"servers": {
"drawio": { "type": "stdio", "command": "npx", "args": ["@next-ai-drawio/mcp-server@latest"] }
}
}Or write it in ~/.cursor/mcp.json, claude_desktop_config.json, cline_mcp_settings.json or your client's MCP config:
{
"mcpServers": {
"drawio": { "command": "npx", "args": ["@next-ai-drawio/mcp-server@latest"] }
}
}Paste this into Claude Code, Codex, Cursor, VS Code, Cline or any agent that can edit files and run commands:
Install the drawio MCP server for the client you are running in, following
https://raw.githubusercontent.com/DayuanJiang/next-ai-draw-io/main/packages/mcp-server/README.md
Install it for all my projects (user scope, for Claude Code "--scope user"),
name the server "drawio" and keep the servers that are already configured.
Then tell me how to reload so its tools show up.Restart the client, then ask, for example, "Read this repo and draw its architecture". The preview opens in your browser and the diagram appears as it is drawn.
What it does
Draws from your project
The agent reads your code and documents with its own tools. Existing .drawio and .drawio.svg files open too.
Every change is a version
The AI's changes are outlined for a few seconds and one Ctrl+Z takes them back. The last 20 versions sit next to the canvas to restore or compare.
You and the AI share the canvas
Edit by hand at any time, or select shapes and say "these". The AI reads your edits before it edits again.
Real icons
The web app's drawing rules and shape libraries for AWS, Azure, GCP, Kubernetes, Cisco and more, so the AI uses real icon names.
Checks its own work
The AI can look at a screenshot of the rendered diagram and fix overlapping shapes.
Export, offline and saved
Save .drawio, .png, .svg or .drawio.svg. The draw.io editor ships inside the package and works offline, and every diagram is saved for a later conversation.
Why Next AI Draw.io is better than draw.io's official MCP server
If you keep changing a diagram after the AI has drawn it, use Next AI Draw.io. You and the AI share one canvas, so the AI sees what you select and what you change.
| What you do | draw.io's official MCP server and plugin | Next AI Draw.io |
|---|---|---|
| Select two shapes and say "make these two red" | draw.io's official MCP server and pluginThe AI does not know which two | Next AI Draw.ioThe AI changes those two |
| Change the diagram by hand | draw.io's official MCP server and pluginThe AI sees it only after you save it to a file | Next AI Draw.ioThe AI reads the canvas before it edits |
| Want to know what the AI changed | draw.io's official MCP server and pluginNothing on the diagram shows it | Next AI Draw.ioThe change is outlined |
| Want to take the AI's change back | draw.io's official MCP server and pluginAsk the AI to change it again | Next AI Draw.ioPress Ctrl+Z |
| Want to watch the AI draw | draw.io's official MCP server and pluginIt opens when it is done | Next AI Draw.ioYou watch it being drawn |
Tools
| Tool | What it does |
|---|---|
start_session | Open the preview and return the drawing guide; session_id continues a saved diagram |
create_new_diagram | Draw a new diagram from mxCell XML |
edit_diagram | Add, update or delete cells by id, all or nothing |
get_diagram | The current XML, including your edits in the browser |
get_selection | The shapes you selected in the preview |
screenshot_diagram | A PNG of a page, for the AI to check |
load_diagramexport_diagram | Open a .drawio or .drawio.svg file; save .drawio, .png, .svg or .drawio.svg |
restore_version | Go back to an earlier version; a redo stays possible |
list_saved_diagrams | Diagrams saved by earlier sessions, newest first |
get_drawing_guideget_shape_library | The drawing rules again; the icon styles of a library such as aws4 |
list_pagesadd_pagerename_pagedelete_page | Pages (tabs) |
Configuration and troubleshooting
Environment variables, your own drawing rules, a self-hosted draw.io and fixes for common problems are in the docs and the README.