跳到正文
FunCoding

Smart Drawio

官方 MCP Registry 已收录

Generate, validate, repair and style editable draw.io XML diagrams.

Star
367
版本
v0.1.0
许可证
MIT
最近提交
2026年11月26日

Smart Drawio MCP

A local MCP server for generating, validating, repairing and styling editable draw.io XML. It shares the diagram core with Smart Drawio Next. It uses stdio and does not require the Next.js website, a browser, or draw.io Desktop.

Install from npm

Use Node.js 20.9 or later. Configure a client that supports local stdio MCP servers:

{
  "mcpServers": {
    "smart-drawio": {
      "command": "npx",
      "args": ["-y", "@yunshenwuchuxun/[email protected]"]
    }
  }
}

The client starts the MCP process. Validation, repair, styling and option discovery work immediately. Configure the four model environment variables below to enable generation.

The Smart Drawio Skill can also use the agent's own model to create XML and then optionally call these tools.

Run from this repository

Use Node.js 20.9 or later. Build from the repository root:

pnpm install --frozen-lockfile
pnpm build:mcp

Configure a client that supports local stdio MCP servers:

{
  "mcpServers": {
    "smart-drawio": {
      "command": "node",
      "args": ["/absolute/path/smart-drawio-next/packages/mcp/dist/stdio.js"]
    }
  }
}

Replace the absolute path with your checkout path. The client launches the process; running the executable directly waits for JSON-RPC on stdin. stdout contains only MCP messages.

The npm executable is smart-drawio-mcp. Running it directly waits for JSON-RPC on stdin; it is intended to be started by an MCP client.

Optional model configuration

Validation, repair, styling and the options catalog work without model credentials. Only generate_drawio requires the following four environment variables, set on the MCP process:

VariableMeaning
SMART_DRAWIO_PROVIDERopenai or anthropic
SMART_DRAWIO_BASE_URLCompatible HTTP(S) base URL, e.g. https://api.openai.com/v1 or a local model endpoint
SMART_DRAWIO_API_KEYProvider API key; for a local endpoint that ignores authentication, use a non-empty placeholder
SMART_DRAWIO_MODELModel ID supported by that provider

Use your client's environment or secret settings. Credentials are absent from tool arguments and results. Localhost and custom HTTP(S) providers are supported. A base URL must not contain embedded credentials, query parameters or fragments.

Example using placeholder settings in the client configuration:

{
  "mcpServers": {
    "smart-drawio": {
      "command": "node",
      "args": ["/absolute/path/smart-drawio-next/packages/mcp/dist/stdio.js"],
      "env": {
        "SMART_DRAWIO_PROVIDER": "openai",
        "SMART_DRAWIO_BASE_URL": "http://localhost:11434/v1",
        "SMART_DRAWIO_API_KEY": "local-placeholder",
        "SMART_DRAWIO_MODEL": "your-local-model-id"
      }
    }
  }
}

Restart the MCP process after changing its model settings. Generation has a 240-second total deadline and a 60-second inactivity deadline. Client cancellation aborts the provider request.

Tools

ToolInputsBehavior
list_drawio_options{}Discover IDs and descriptions for chart types, themes, style packs, presets, text tools and tricks
validate_drawioxmlValidate XML syntax, IDs, parents and edge references
repair_drawioxmlRepair supported missing closing tags and validate the repaired result
style_drawioxml; optional theme, sourceTheme, stylePack, presets, textTool, trickReturn a transformed XML document; presets is an ID-to-boolean map
generate_drawioprompt; optional chartType="auto", theme="research"Generate with the configured provider and return complete, validated XML

Every result includes structuredContent with ok, diagnostics, and optional xml, stats or options. Text content includes diagnostics and the XML when available. Tool failures set isError: true; invalid tool arguments are rejected by the MCP SDK. Cancelled calls follow MCP cancellation semantics.

Example style request after discovering the IDs:

{
  "xml": "<mxfile>...</mxfile>",
  "stylePack": "researchClean",
  "presets": { "shadow": false }
}

Supported scope

This version handles uncompressed .drawio XML, with an MCP input limit of 2,097,152 characters per XML document. Prompts are limited to 262,144 characters. Compressed diagrams and legacy JSON drawing formats must be converted to uncompressed XML first.

The server returns diagram data in memory. The client decides whether and where to save .drawio files. It does not read the current browser canvas, select nodes, export PNG/PDF screenshots, manage realtime editor sessions or offer a remote HTTP MCP endpoint.

Import the returned XML into draw.io, or use the Smart Drawio Next website for visual editing. Generation calls the configured external provider; validation, repair and style transformations stay local.

Factory API

import { createSmartDrawioServer } from '@yunshenwuchuxun/smart-drawio-mcp';
import { serveStdio } from '@modelcontextprotocol/server/stdio';

serveStdio(() => createSmartDrawioServer());

createSmartDrawioServer({ env, core }) allows a supplied environment and core implementation for embedding or testing. The package also exports the shared diagram core under @yunshenwuchuxun/smart-drawio-mcp/core.

同类 MCP Server

精选

Metabase

搜索、查询和可视化 Metabase 数据,操作受用户权限控制。

MEmetabase/metabase51k近 7 天新增 205 个 star

精选

next-ai-draw-io

描述一句话生成架构图,选中形状修改,每次改动可撤销。

DADayuanJiang/next-ai-draw-io37k近 7 天新增 125 个 star

精选

GitDiagram

将 GitHub 仓库转为交互式架构图,获取 Mermaid 源码和视频解说。

AHahmedkhaleel2004/gitdiagram19k近 7 天新增 79 个 star

Figma-Context-MCP

Give your coding agent access to your Figma data. Implement designs in any framework in one-shot.

GLGLips/Figma-Context-MCP16k近 7 天新增 54 个 star

stitch-skills

A library of Agent Skills designed to work with the Stitch MCP server. Each skill follows the Agent Skills open standard, for compatibility with coding agents such as Antigravity, Gemini CLI, Claude Code, Cursor.

GOgoogle-labs-code/stitch-skills15k近 7 天新增 2,607 个 star

精选

cursor-talk-to-figma-mcp

让智能体读取和修改 Figma 设计稿。

GRgrab/cursor-talk-to-figma-mcp7.1k近 7 天新增 16 个 star