SuperAPIAI Directory

DayuanJiang/next-ai-draw-io

github.com · AI coding

Next AI Draw.io MCP Server is an MCP server that lets AI agents such as Claude Code, Cursor, VS Code, and Codex draw and edit draw.io diagrams through conversation. It provides a live preview canvas in the browser, marks AI changes with outlines, supports undo with Ctrl+Z, and also allows manual editing. Agents can read project code and documentation to generate architecture diagrams, support loading existing .drawio files, use real icon libraries such as AWS/Azure/GCP/Kubernetes/Cisco, draw sequence diagrams/swimlane diagrams/use case diagrams, and automatically check for issues such as connectors crossing shapes and overlapping text. Diagrams are saved locally with the most recent 20 versions retained, support multiple pages and PNG/SVG/drawio export, and include a built-in offline draw.io editor.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

Purpose: Next AI Draw.io MCP Server is a server based on the MCP protocol that lets AI agents such as Claude Code, Cursor, VS Code, Codex, and Cline draw and edit draw.io diagrams from project files through conversation, with a live preview in the browser.

Key capabilities:

  • Draw from the project: agents use their own tools to read code and documentation and generate diagrams; existing .drawio and .drawio.svg files can be opened with load_diagram.
  • Shared canvas preview: the preview is the canvas of the Next AI Draw.io web app; AI changes are marked with outlines for a few seconds (not shown on export) and can be undone with a single Ctrl+Z; you can select shapes and tell the AI "these" (get_selection), and the AI reads manual changes before editing again.
  • Real icons: uses the web app's drawing rules and shape libraries (AWS, Azure, GCP, Kubernetes, Cisco, etc.), and the AI uses real icon names.
  • Specialized diagrams: provides drawing guides for sequence diagrams, swimlane diagrams, and use case diagrams (get_drawing_guide with topic); the server handles layout, arranges shapes according to text spacing, and routes connectors around obstacles.
  • Automatic checks: connectors automatically route around shapes when passing through them, connector labels automatically move when overlapping shapes or text, and overlapping shapes are separated; diagrams without issues remain unchanged.
  • Self-check: the AI can view screenshots of the rendered diagram and fix overlaps (screenshot: true or screenshot_diagram).
  • Versions: the most recent 20 versions are shown as cards next to the canvas and can be restored, compared, or undone by the AI (restore_version).
  • Pages and export: supports multi-page diagrams and can save as .drawio, .png, .svg, or .drawio.svg; images have a 20 px margin and white background (transparent: true removes it), and SVG stays light in dark mode.
  • Offline: the draw.io editor is bundled with the package.

Usage:

  • One-click add in VS Code or Cursor.
  • You can also let the AI agent install it itself: paste the installation instructions to Claude Code, Codex, Cursor, VS Code, Cline and other agents that can edit files and run commands.
  • Manual installation: using --scope user makes the tool available in all projects; without it, it is only available in the folder where the command is run.
  • It can also be installed as a plugin from the Claude Code community marketplace (requires Claude Code 2.1.275 or later).
  • Codex asks before every drawio tool call that modifies a diagram; codex exec without full access reports "MCP tool call requires approval". You can add a line to the server configuration section of ~/.codex/config.toml to allow running without asking; you can also use [mcp_servers.drawio.tools.<tool name>] with approval_mode = "approve" to approve only some tools.
  • VS Code configuration is located in .vscode/mcp.json; clients such as Cursor, Claude Desktop and Cline use ~/.cursor/mcp.json, claude_desktop_config.json and cline_mcp_settings.json respectively.
  • DeepSeek Harness: install the plugin into the profile used to start DSH (dsh web corresponds to web); the agent replies with a preview link, and clicking it opens the preview in the right sidebar of DSH.
  • After restarting the client, you can ask questions, for example "read this repository and draw its architecture"; the preview opens in the browser, and the diagram appears step by step as it is drawn.

Data and configuration:

  • Each change is saved to ~/.next-ai-drawio/<session-id>.drawio, keeping the most recent 20 versions and at most the latest 50 diagrams; in later conversations you can ask the AI to find them with list_saved_diagrams and reopen them with start_session.
  • Custom drawing rules are written in ~/.next-ai-drawio/instructions.md (for example "always use a minimalist style"); they are added to the drawing guide on every call, take effect without a restart, and only the first 5000 characters are used.
  • Environment variables are set in the env configured for the server in the client.

Remote preview and self-hosting:

  • Remote preview behind a private proxy: set DRAWIO_PREVIEW_URL=https://diagram.example.net,start_session in the MCP server environment, which returns that origin plus the session preview path and query parameters. The server still listens only on 127.0.0.1; you need to configure a private or authenticated HTTPS reverse proxy to the actual PORT, preserving the external Host and browser Origin headers, forwarding the entire origin (including /shell/, /drawio/ and /api/) without adding a path prefix. If the port is occupied, the server may choose another port, so check the listening port before configuring the proxy. Only this exact extra Host and the matching Origin are trusted; forwarded headers are not used to establish trust, and the default localhost check and API token are still retained. The value must be a canonical HTTPS origin, optionally ending with /, without credentials, path, query or fragment; HTTP is accepted only for localhost or 127.0.0.1; an invalid value causes startup to fail rather than silently falling back. A hostname is not authentication: anyone who can access the preview can read the embedded API token and edit diagrams, so access to the proxy should be restricted through network policies or authentication, and the listening port should not be publicly exposed. DRAWIO_ALLOW_EMBED is a separate setting and does not allow arbitrary remote embedding. This setting only changes the browser preview and does not affect the stdio MCP transport or DRAWIO_BASE_URL (the draw.io editor).
  • Self-hosted draw.io: set DRAWIO_BASE_URL=http://localhost:8080。预览无法访问另一源的 draw.io, so AI changes are not marked and cannot be undone with Ctrl+Z (use version cards instead), and get_selection is unavailable. The built-in copy lacks some features that load code on demand (such as org chart layout), and there is no image proxy, so images inserted by URL will not appear in exported images.

Limitations and troubleshooting:

  • Blank preview in VS Code Simple Browser or the Cursor browser: the page refuses to be embedded by other pages; open the URL in a regular browser.
  • Screenshot or PNG/SVG export times out: rendering is done by the preview tab, and browsers slow down background tabs; bring the tab to the foreground and retry.
  • "No active session": the AI must first call start_session; after a restart, you can use that session id to continue a previous diagram.
  • Preview does not update: open the URL returned by start_session, where the ?mcp= part connects the page to the session.
  • The server communicates with the agent via stdio and runs an HTTP server on 127.0.0.1 to serve the preview page and the built-in draw.io; the page polls for changes; every /api request requires a token held only by the preview page, so other websites cannot read or modify the diagram.

Use cases: development and documentation scenarios that need to have AI generate architecture diagrams from a codebase, repeatedly modify diagrams in conversation, draw professional diagrams using real cloud provider icons, and require version management and multi-format export.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools