mcpField
S
Smart Drawio

Smart Drawio

Local
github.com/yunshenwuchuxunMedia & Design366Updated 2w ago

About Smart Drawio

Smart Drawio is a local MCP server for creating and transforming editable draw.io XML, aimed at diagram workflows using MCP clients. It provides local validation, repair, styling, and option discovery; diagram generation additionally requires model-provider configuration.

Key features

  1. 01Generate validated draw.io XML
  2. 02Validate XML structure and references
  3. 03Repair supported missing closing tags
  4. 04Apply themes and style options
  5. 05Discover chart and style options

Use cases

  1. 01Creating editable diagrams from prompts
  2. 02Checking XML before importing into draw.io
  3. 03Repairing supported malformed diagram XML
  4. 04Applying a theme or style pack

MCP support

Exposes tools for generating, validating, repairing, and styling uncompressed draw.io XML, plus discovering available options. It uses local stdio; generation calls the configured provider, while validation, repair, and styling run locally.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"yunshenwuchuxun-smart-drawio": {
"command": "npx",
"args": [
"-y",
"@yunshenwuchuxun/smart-drawio-mcp"
],
"env": {
"SMART_DRAWIO_PROVIDER": "<SMART_DRAWIO_PROVIDER>",
"SMART_DRAWIO_BASE_URL": "<SMART_DRAWIO_BASE_URL>",
"SMART_DRAWIO_API_KEY": "<SMART_DRAWIO_API_KEY>",
"SMART_DRAWIO_MODEL": "<SMART_DRAWIO_MODEL>"
}
}
}
}
Run commandnpx -y @yunshenwuchuxun/smart-drawio-mcp
Environment variables to set
SMART_DRAWIO_PROVIDERopenai or anthropic; required only for model generation
SMART_DRAWIO_BASE_URLModel provider HTTP(S) base URL; required only for model generation
SMART_DRAWIO_API_KEYSecretYour model provider API key; required only for model generation
SMART_DRAWIO_MODELModel identifier; required only for model generation

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@yunshenwuchuxun/smart-drawio-mcp0.1.0

Tools

5

Saved tool list · updated 2w ago

This tool takes no parameters.

Details

From the project README

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.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.