Next AI Draw.io

io.github.DayuanJiang由 GitHub 帳號 DayuanJiang 發布v0.4.13更新於 Nov 7, 2026

draw.io diagrams your AI agent draws on a live browser canvas that you can also edit by hand

發布方自己的服務:draw.io

已驗證STDIO僅桌面開發者工具媒體與設計

概覽

AI 產生的概覽

讓 AI 助理在瀏覽器中的即時 draw.io 畫布上繪製與修改圖表,你也可以隨時手動編輯。

可以做什麼
  • 開啟預覽工作階段,並以 mxCell XML 繪製新圖表,或依 id 新增、修改、刪除儲存格
  • 讀取目前的圖表 XML、你的手動修改,以及你在預覽中選取的圖形
  • 擷取頁面 PNG 截圖,供助理檢查並修正重疊
  • 載入既有的 .drawio 或 .drawio.svg 檔案,匯出為 .drawio、.png、.svg 或 .drawio.svg
  • 還原舊版本、列出已儲存的圖表,並管理頁面(分頁)
  • 取得繪圖規則與 AWS、Azure、GCP、Kubernetes 等圖示庫
適用情境
適合讓助理把程式碼儲存庫、文件或想法畫成 draw.io 圖表,再與你在同一畫布上輪流修改、共同調整。
執行需求
透過 npx 以 stdio 在本機執行,需要 Node.js;瀏覽器會開啟 127.0.0.1 上的預覽(預設連接埠 6002)。可選環境變數可設定連接埠、資料目錄、語言、主題、draw.io 位址與預覽行為。未宣告需要帳號或 API 金鑰。
安裝前請注意
會寫入圖表檔案與本機資料目錄,每次修改都會保存版本紀錄。預覽監聽不以主機名稱作為身分驗證:任何能連上它的人都能讀取其權杖並修改圖表,因此不要公開暴露,反向代理需限制存取。改用自架的 draw.io 位址會失去變更高亮、復原與選取讀取功能。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Next AI Draw.io,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Next AI Draw.io MCP Server

An MCP server that lets Claude Code, Cursor, VS Code and other AI agents draw draw.io diagrams from your project's files, with a live preview in your browser. The preview is the canvas of the Next AI Draw.io web app: the AI's changes are outlined, Ctrl+Z takes them back, and you can edit by hand at any time.

https://github.com/user-attachments/assets/6f53a67b-ab21-4113-9fee-7fb32f9de678

Install

In VS Code or Cursor, one click adds it: [Install in VS Code] [Add to Cursor]

Let your AI agent install it

Paste this into Claude Code, Codex, Cursor, VS Code, Cline or any agent that can edit files and run commands:

text
Install the drawio MCP server for the client you are running in, followinghttps://raw.githubusercontent.com/DayuanJiang/next-ai-draw-io/main/packages/mcp-server/README.mdInstall 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.

Install by hand

Claude Code

bash
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):

text
/plugin install next-ai-drawio --marketplace anthropics/claude-plugins-community

Codex CLI

bash
codex mcp add drawio -- npx @next-ai-drawio/mcp-server@latest

Codex 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:

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.

VS Code (.vscode/mcp.json)

json
{  "servers": {    "drawio": { "type": "stdio", "command": "npx", "args": ["@next-ai-drawio/mcp-server@latest"] }  }}

DeepSeek Harness: install the plugin into the profile you start DSH with (web for dsh web). The agent replies with the preview link; clicking it opens the preview in DSH's right sidebar.

bash
dsh plugin --profile web add @next-ai-drawio/dsh

Cursor, Claude Desktop, Cline and most other clients (~/.cursor/mcp.json, claude_desktop_config.json, cline_mcp_settings.json)

json
{  "mcpServers": {    "drawio": { "command": "npx", "args": ["@next-ai-drawio/mcp-server@latest"] }  }}

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.

Features

  • Draws from your project: the agent reads your code and documents with its own tools. Existing .drawio and .drawio.svg files open with load_diagram.
  • The web app's canvas: the AI's changes are outlined for a few seconds (never in exports) and one Ctrl+Z takes them back. Select shapes and say "these" (get_selection). Your hand edits are read before the AI edits again.
  • Real icons: the web app's drawing rules and shape libraries (AWS, Azure, GCP, Kubernetes, Cisco and more), so the AI uses real icon names.
  • Self-check: the AI can look at a screenshot of the rendered diagram and fix overlaps (screenshot: true, or screenshot_diagram).
  • Versions: the last 20 versions as cards next to the canvas; restore or compare one, or ask the AI to undo (restore_version).
  • Pages and export: multi-page diagrams; save as .drawio, .png, .svg or .drawio.svg. Images get a 20 px margin, and PNGs a white background (transparent: true for none).
  • Offline: the draw.io editor ships inside the package.

Choosing a draw.io MCP server

Several MCP servers draw draw.io diagrams. As of October 2026 they differ like this:

ServerHow you see and change the diagramA good fit when
This server, @next-ai-drawio/mcp-serverA live draw.io canvas in your browser. The AI reads it back, including your hand edits and selection; its changes are outlined, Ctrl+Z takes them back, and earlier versions can be restoredYou and the AI take turns on the same diagram
draw.io's official @drawio/mcpOpens each diagram from XML, CSV or Mermaid in the draw.io editor in a new tab; no tool reads it backYou want the diagram in the full draw.io editor and edit it yourself from there
draw.io's hosted MCP app, https://mcp.draw.io/mcpShows the diagram inside the chat in Claude.ai, ChatGPT, VS Code or Cursor, with nothing to install; the diagram is sent to draw.io's serverYou work in a chat app and want to see the diagram in the conversation
draw.io's plugin for Claude Code, Codex CLI and Copilot CLIA skill that writes .drawio files; PNG, SVG and PDF export needs draw.io DesktopYou want diagram files in your repository without an MCP server
lgazo/drawio-mcp-serverA draw.io editor on localhost, or your own draw.io through a browser extension; tools create, read, update and delete single shapes, layers and pagesYou want fine-grained tools, several documents at once, or Mermaid import

Saved diagrams

Every change is saved to ~/.next-ai-drawio/<session-id>.drawio with its last 20 versions; the newest 50 diagrams are kept. To continue one in a later conversation, ask the AI for it: it finds it with list_saved_diagrams and reopens it with start_session.

Your own drawing rules

Write them in ~/.next-ai-drawio/instructions.md, for example "Always use a minimal style". They are added to the drawing guide on every call, so edits apply without a restart. The first 5000 characters are used.

Tools

ToolWhat it does
start_sessionOpen the preview and return the drawing guide; session_id continues a saved diagram
create_new_diagramDraw a new diagram from mxCell XML
edit_diagramAdd, update or delete cells by id, all or nothing
get_diagramThe current XML, including your edits in the browser
get_selectionThe shapes you selected in the preview
screenshot_diagramA PNG of a page, for the AI to check
load_diagram, export_diagramOpen a .drawio or .drawio.svg file; save .drawio, .png, .svg or .drawio.svg
restore_versionGo back to an earlier version; a redo stays possible
list_saved_diagramsDiagrams saved by earlier sessions, newest first
get_drawing_guide, get_shape_libraryThe drawing rules again; the icon styles of a library such as aws4
list_pages, add_page, rename_page, delete_pagePages (tabs)

Configuration

Environment variables, set in the client's env for the server:

VariableDefaultWhat it does
PORT6002Preview port; when it is taken, the next free one up to 6020 is used
DRAWIO_DATA_DIR~/.next-ai-drawioFolder for saved diagrams and instructions.md; off turns saving off
DRAWIO_AUTO_SCREENSHOTunsettrue attaches a screenshot to every create and edit result (2 to 10 s per call)
DRAWIO_BASE_URLthe bundled draw.ioUse another draw.io, such as a self-hosted one (see below)
DRAWIO_LANGunsetFix the editor and preview language: en, zh, zh-tw, ja, de and so on
DRAWIO_UIunsetFix the draw.io theme: kennedy, atlas, dark, min, sketch or simple
DRAWIO_DARKauto1 starts dark, 0 starts light, auto follows the system
BROWSERunsetnone does not open the preview by itself; start_session still returns the URL
DRAWIO_ALLOW_EMBEDunsettrue lets pages on this machine (localhost, 127.0.0.1) show the preview in a frame, such as DeepSeek Harness's sidebar browser
DRAWIO_PREVIEW_URLunsetExplicit trusted preview origin behind a private HTTPS reverse proxy (see below)
DRAWIO_PREVIEW_UIshellclassic opens the previous preview page, without outlines, Ctrl+Z or get_selection
DEBUGunsettrue logs debug messages to stderr

Remote preview behind a private proxy

Set DRAWIO_PREVIEW_URL=https://diagram.example.net in the MCP server's environment. start_session returns that origin with the session's preview path and query. The server still listens only on 127.0.0.1; configure a private or authenticated HTTPS reverse proxy to its actual PORT, preserving the external Host and browser Origin headers. Forward the whole origin, including /shell/, /drawio/ and /api/, without a path prefix. If the chosen port is occupied, the server may choose another port, so check the listener before configuring the proxy.

Only this exact additional Host and matching Origin are trusted. Forwarded headers are not used to establish trust; the default localhost checks and API token remain. The value must be a canonical HTTPS origin, optionally ending in /, without credentials, a path, query or fragment. HTTP is accepted only for localhost or 127.0.0.1. Invalid values fail startup rather than silently falling back.

The hostname is not authentication. Anyone who can reach the preview can read its embedded API token and edit diagrams. Restrict proxy access to trusted users with network policy or authentication. Do not expose this listener publicly. DRAWIO_ALLOW_EMBED is separate and does not permit arbitrary remote framing. This setting changes only the browser preview, not the stdio MCP transport or DRAWIO_BASE_URL (the draw.io editor).

Self-hosted draw.io

bash
docker run -d -p 8080:8080 jgraph/drawio

Then set DRAWIO_BASE_URL=http://localhost:8080. The preview cannot reach into a draw.io from another origin, so the AI's changes are not outlined, Ctrl+Z does not take them back (use the version cards) and get_selection does not work. The bundled copy leaves out a few features that load code on demand, such as the org chart layout. It also has no image proxy, so exported images leave out pictures inserted by their web address; see Offline deployment.

Troubleshooting

  • Blank preview in VS Code Simple Browser or Cursor's browser: the page refuses to be embedded in other pages. Open the URL in a regular browser.
  • Screenshot or PNG/SVG export times out: the preview tab renders them, and browsers slow down background tabs. Bring the tab to the front and try again.
  • "No active session": the AI has to call start_session first.
  • The preview does not update: open the URL that start_session returned; its ?mcp= part connects the page to the session.

How it works

The server talks to the agent over stdio and runs an HTTP server on 127.0.0.1 that serves the preview page and the bundled draw.io; the page polls it for changes. Every /api request needs a token that only the preview page has, so other websites cannot read or change your diagram.

License

Apache-2.0

來源:packages/mcp-server/README.md,提交 04b1de9

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

5
  1. v0.4.13最新Nov 7, 2026
  2. v0.4.11Nov 1, 2026
  3. v0.4.7Oct 31, 2026
  4. v0.4.5Oct 17, 2026
  5. v0.4.3Oct 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Draw 整合