Skip to main content
Glama

drawio-mcp

License: MIT MCP Compatible TypeScript

An MCP (Model Context Protocol) server that enables LLMs to create and open diagrams in draw.io. Supports native draw.io XML, Mermaid.js syntax, and CSV data formats.

When an LLM calls one of the tools, the server compresses the diagram content, builds a draw.io URL with the #create hash parameter, and opens it in your default browser — the diagram appears instantly in the draw.io editor, ready to edit and export.

Demo

Tools

Tool

Format

Best for

open_drawio_xml

draw.io XML

Full control over styling and layout

open_drawio_mermaid

Mermaid.js

Quick flowcharts, sequence diagrams, ER diagrams

open_drawio_csv

CSV

Org charts and diagrams from tabular data

Related MCP server: fcp-drawio

Installation

git clone https://github.com/mingrath/drawio-mcp.git
cd drawio-mcp
npm install
npm run build

Or install globally:

npm install -g drawio-mcp

Configuration

Claude Code

Add to your ~/.claude/settings.json:

{
  "mcpServers": {
    "drawio-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/drawio-mcp/dist/index.js"]
    }
  }
}

Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "drawio-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/drawio-mcp/dist/index.js"]
    }
  }
}

Usage Examples

XML — Custom styled diagram

<mxGraphModel>
  <root>
    <mxCell id="0"/>
    <mxCell id="1" parent="0"/>
    <mxCell id="2" value="Service A" style="rounded=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">
      <mxGeometry x="100" y="100" width="140" height="60" as="geometry"/>
    </mxCell>
    <mxCell id="3" value="Service B" style="rounded=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="1">
      <mxGeometry x="320" y="100" width="140" height="60" as="geometry"/>
    </mxCell>
    <mxCell id="4" style="endArrow=block;endFill=1;" edge="1" source="2" target="3" parent="1">
      <mxGeometry relative="1" as="geometry"/>
    </mxCell>
  </root>
</mxGraphModel>

Mermaid — Flowchart

graph TD
    A[Start] --> B{Decision}
    B -->|Yes| C[Action 1]
    B -->|No| D[Action 2]
    C --> E[End]
    D --> E

Mermaid — Sequence diagram

sequenceDiagram
    participant Client
    participant API
    participant DB

    Client->>API: POST /users
    API->>DB: INSERT user
    DB-->>API: OK
    API-->>Client: 201 Created

CSV — Org chart

# label: %name%
# style: whiteSpace=wrap;html=1;rounded=1;fillColor=#dae8fc;strokeColor=#6c8ebf;
# connect: {"from":"manager","to":"name","invert":true,"style":"endArrow=blockThin;endFill=1;"}
# layout: auto
name,manager
CEO,
CTO,CEO
CFO,CEO
VP Engineering,CTO
VP Product,CTO

Tool parameters

All three tools accept these optional parameters:

Parameter

Type

Default

Description

content

string

(required)

Diagram content or a URL pointing to content

lightbox

boolean

false

Open in read-only lightbox mode

dark

"auto" | "true" | "false"

"auto"

Dark mode setting

How It Works

  1. The LLM calls a tool with diagram content (XML, Mermaid, or CSV).

  2. The server URI-encodes and deflate-compresses the content.

  3. A draw.io URL is constructed with the compressed data in a #create= hash fragment.

  4. The URL opens in your default browser — draw.io reads the hash and renders the diagram.

Because the data lives in the URL hash fragment, it is never sent to any server.

Development

npm run dev    # Watch mode — recompiles on changes
npm run build  # One-time build
npm start      # Run the compiled server

Requirements

  • Node.js >= 18

  • A browser (for opening diagrams)

License

MIT - Mingrath Mekavichai

Available Tools

3 tools
open_drawio_csvA

Opens the draw.io editor with a diagram generated from CSV data or a URL to CSV data. The CSV format follows draw.io's CSV import specification for creating org charts, flowcharts, and other diagrams from tabular data.

Inputs: content (required), lightbox, dark.

open_drawio_mermaidA

Opens the draw.io editor with a diagram generated from Mermaid.js syntax or a URL to Mermaid content. Supports flowcharts (graph TD/LR), sequence diagrams, class diagrams, state diagrams, ER diagrams, Gantt charts, pie charts, and more.

Inputs: content (required), lightbox, dark.

open_drawio_xmlA

Opens the draw.io editor with a diagram from XML content or a URL to XML content. Use this to create, view, or edit diagrams in native draw.io/mxGraph XML format.

Inputs: content (required), lightbox, dark.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool targets a distinct input format (CSV, Mermaid, XML) for generating diagrams, with no overlap in purpose.

    Naming Consistency5/5

    All tools follow the consistent pattern 'open_drawio_{format}' using snake_case, making the naming predictable.

    Tool Count5/5

    Three tools is an appropriate and focused count for a server dedicated to opening diagrams in draw.io, covering the primary input formats.

    Completeness5/5

    The three tools cover the main methods for creating diagrams in draw.io (CSV import, Mermaid, native XML), with no obvious gaps for the stated purpose.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that enables AI assistants to programmatically create and manage flowcharts, ERDs, and swimlane diagrams. It provides tools for manipulating diagram structures, performing auto-layouts, and exporting to Mermaid or Markdown formats.
      23 npm
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      MCP server that enables LLMs to create and edit draw.io diagrams using high-level intent commands, with automatic layout and styling.
      4
      6 npm
      4
      MIT
    • A
      license
      A
      quality
      A
      maintenance
      MCP server for creating and editing diagrams using draw.io. Allows generating diagrams from Mermaid or XML, searching shapes, and opening them in draw.io for export.
      2
      0
      Apache 2.0