Skip to main content
Glama
hj1003862396

Next AI Draw.io MCP Server

by hj1003862396

Next AI Draw.io MCP Server

MCP (Model Context Protocol) server that enables AI agents like Claude Desktop and Cursor to generate and edit draw.io diagrams with real-time browser preview.

Self-contained - includes an embedded HTTP server, no external dependencies required.

Quick Start

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

Related MCP server: Excalidraw MCP Server

Installation

Claude Desktop

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

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

VS Code

Add to your VS Code settings (.vscode/mcp.json in workspace or user settings):

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

Cursor

Add to Cursor MCP config (~/.cursor/mcp.json):

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

Cline (VS Code Extension)

  1. Click the MCP Servers icon in Cline's top menu bar

  2. Select the Configure tab

  3. Click Configure MCP Servers to edit cline_mcp_settings.json

  4. Add the drawio server:

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

Claude Code CLI

claude mcp add drawio -- npx @next-ai-drawio/mcp-server@latest

Other MCP Clients

Use the standard MCP configuration with:

  • Command: npx

  • Args: ["@next-ai-drawio/mcp-server@latest"]

Usage

  1. Restart your MCP client after updating config

  2. Ask the AI to create a diagram:

    "Create a flowchart showing user authentication with login, MFA, and session management"

  3. The diagram appears in your browser in real-time!

Features

  • Real-time Preview: Diagrams appear and update in your browser as the AI creates them

  • Version History: Restore previous diagram versions with visual thumbnails - click the clock button (bottom-right) to browse and restore earlier states

  • Natural Language: Describe diagrams in plain text - flowcharts, architecture diagrams, etc.

  • Edit Support: Modify existing diagrams with natural language instructions

  • Export: Save diagrams as .drawio files

  • Self-contained: Embedded server, works offline (except draw.io UI which loads from embed.diagrams.net by default, configurable via DRAWIO_BASE_URL)

Available Tools

Tool

Description

start_session

Opens browser with real-time diagram preview

create_new_diagram

Create a new diagram from XML (requires xml argument)

edit_diagram

Edit diagram by ID-based operations (update/add/delete cells)

get_diagram

Get the current diagram XML

export_diagram

Save diagram to a .drawio file

How It Works

┌─────────────────┐     stdio      ┌─────────────────┐
│  Claude Desktop │ <───────────> │   MCP Server    │
│    (AI Agent)   │               │  (this package) │
└─────────────────┘               └────────┬────────┘
                                          │
                                 ┌────────▼────────┐
                                 │ Embedded HTTP   │
                                 │ Server (:6002)  │
                                 └────────┬────────┘
                                          │
                                 ┌────────▼────────┐
                                 │  User's Browser │
                                 │ (draw.io embed) │
                                 └─────────────────┘
  1. MCP Server receives tool calls from Claude via stdio

  2. Embedded HTTP Server serves the draw.io UI and handles state

  3. Browser shows real-time diagram updates via polling

Configuration

Variable

Default

Description

PORT

6002

Port for the embedded HTTP server

DRAWIO_BASE_URL

https://embed.diagrams.net

Base URL for the draw.io embed. Set this to use a self-hosted draw.io instance for private deployments.

Private Deployment (Self-hosted draw.io)

For security-sensitive environments that require private deployment of draw.io:

{
  "mcpServers": {
    "drawio": {
      "command": "npx",
      "args": ["@next-ai-drawio/mcp-server@latest"],
      "env": { 
        "DRAWIO_BASE_URL": "https://drawio.your-company.com"
      }
    }
  }
}

You can deploy your own draw.io instance using the official Docker image:

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

Then set DRAWIO_BASE_URL=http://localhost:8080 (or your server's URL).

Troubleshooting

Port already in use

If port 6002 is in use, the server will automatically try the next available port (up to 6020).

Or set a custom port:

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

"No active session"

Call start_session first to open the browser window.

Browser not updating

Check that the browser URL has the ?mcp= query parameter. The MCP session ID connects the browser to the server.

License

Apache-2.0

Available Tools

5 tools
create_new_diagramA

Create a NEW diagram from mxGraphModel XML. Use this when creating a diagram from scratch or replacing the current diagram entirely.

CRITICAL: You MUST provide the 'xml' argument in EVERY call. Do NOT call this tool without xml.

When to use this tool:

  • Creating a new diagram from scratch

  • Replacing the current diagram with a completely different one

  • Major structural changes that require regenerating the diagram

When to use edit_diagram instead:

  • Small modifications to existing diagram

  • Adding/removing individual elements

  • Changing labels, colors, or positions

XML FORMAT - Full mxGraphModel structure:

LAYOUT CONSTRAINTS:

  • Keep all elements within x=0-800, y=0-600 (single page viewport)

  • Start from margins (x=40, y=40), keep elements grouped closely

  • Use unique IDs starting from "2" (0 and 1 are reserved)

  • Set parent="1" for top-level shapes

  • Space shapes 150-200px apart for clear edge routing

EDGE ROUTING RULES:

  • Never let multiple edges share the same path - use different exitY/entryY values

  • For bidirectional connections (A↔B), use OPPOSITE sides

  • Always specify exitX, exitY, entryX, entryY explicitly in edge style

  • Route edges AROUND obstacles using waypoints (add 20-30px clearance)

  • Use natural connection points based on flow (not corners)

COMMON STYLES:

  • Shapes: rounded=1; fillColor=#hex; strokeColor=#hex

  • Edges: endArrow=classic; edgeStyle=orthogonalEdgeStyle; curved=1

  • Text: fontSize=14; fontStyle=1 (bold); align=center

ParametersJSON Schema
NameRequiredDescriptionDefault
xmlYesREQUIRED: The complete mxGraphModel XML. Must always be provided.

TDQS

A5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It clearly states that the tool replaces the current diagram entirely and requires the xml argument in every call. It also discloses layout constraints, ID conventions, and edge routing rules, which are critical behavioral details for the agent to invoke correctly.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Despite length, the description is well-structured with clear headers (When to use, XML Format, Layout Constraints, Edge Routing, Common Styles) and critical content front-loaded with a CRITICAL warning. Every section earns its place, providing necessary detail for correct usage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has high complexity (mxGraphModel XML, layout rules, edge routing), and the description covers all these aspects comprehensively. It provides a full XML example, constraints, styles, and even routing logic. While there is no output schema or return value description, for a create operation this is sufficient. It fully enables an agent to use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although schema coverage is 100% for the xml parameter, the description goes far beyond the schema by providing a complete mxGraphModel XML example, mandatory argument warning, and detailed layout/edge/styling constraints. This adds substantial meaning that the schema alone does not convey.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a clear verb+resource: "Create a NEW diagram from mxGraphModel XML." It explicitly distinguishes from edit_diagram by stating this tool is for creating from scratch or replacing entirely, versus small modifications. This directly addresses sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description has explicit "When to use" and "When to use edit_diagram instead" sections. It provides concrete use cases (creating new, replacing, major structural changes) and explicitly names the alternative tool for smaller edits. This is exemplary guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

edit_diagramA

Edit the current diagram by ID-based operations (update/add/delete cells).

⚠️ REQUIRED: You MUST call get_diagram BEFORE this tool! This fetches the latest state from the browser including any manual user edits. Skipping get_diagram WILL cause user's changes to be LOST.

Workflow:

  1. Call get_diagram to see current cell IDs and structure

  2. Use the returned XML to construct your edit operations

  3. Call edit_diagram with your operations

Operations:

  • add: Add a new cell. Provide cell_id (new unique id) and new_xml.

  • update: Replace an existing cell by its id. Provide cell_id and complete new_xml.

  • delete: Remove a cell by its id. Only cell_id is needed.

For add/update, new_xml must be a complete mxCell element including mxGeometry.

Example - Add a rectangle: {"operations": [{"operation": "add", "cell_id": "rect-1", "new_xml": "<mxCell id="rect-1" value="Hello" style="rounded=0;" vertex="1" parent="1"><mxGeometry x="100" y="100" width="120" height="60" as="geometry"/>"}]}

Example - Update a cell: {"operations": [{"operation": "update", "cell_id": "3", "new_xml": "<mxCell id="3" value="New Label" style="rounded=1;" vertex="1" parent="1"><mxGeometry x="100" y="100" width="120" height="60" as="geometry"/>"}]}

Example - Delete a cell: {"operations": [{"operation": "delete", "cell_id": "rect-1"}]}

ParametersJSON Schema
NameRequiredDescriptionDefault
operationsYesArray of operations to apply

TDQS

A5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full transparency burden. It discloses a critical behavioral trait: skipping get_diagram WILL cause user's changes to be LOST. It also explains that new_xml must be a complete mxCell element including mxGeometry, and clarifies requirements for each operation (e.g., delete only needs cell_id). This goes beyond the schema and provides essential side-effect awareness.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections: warning, workflow, operations, and examples. Despite its length, every part contributes necessary information—no filler or redundancy. The warning is prominent, and the examples are efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (three operations, XML structure, prerequisite dependency), the description is thoroughly complete. It covers the required get_diagram call, operation semantics, exact XML format, and illustrative examples. No output schema exists, but for a mutation tool the return value is not essential; the description fully equips an agent to use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the description adds substantial meaning: it explains the three operation enum values, that new_xml is required for add/update, that cell_id must be unique for add, and provides full valid XML examples. This goes well beyond the schema's bare property descriptions and gives the agent precise construction guidance.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource+scope: 'Edit the current diagram by ID-based operations (update/add/delete cells).' It clearly distinguishes itself from sibling tools by focusing on the current diagram and the ID-based nature, while get_diagram is for fetching and create_new_diagram for creating new diagrams.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states a mandatory prerequisite: '⚠️ REQUIRED: You MUST call get_diagram BEFORE this tool!' and provides a step-by-step workflow. It also includes detailed operation semantics and three concrete examples covering each operation type, making usage conditions explicit and actionable.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

export_diagramA

Export the current diagram to a .drawio file.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesFile path to save the diagram (e.g., ./diagram.drawio)

TDQS

A3.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It only states the export action without disclosing whether existing files are overwritten, if a session is required, or how errors are handled. This is a significant gap for a write operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no fluff. It efficiently conveys the action and target format, making it concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity of the tool (one parameter, no output schema, no annotations), the description is minimally adequate. However, it assumes the existence of a 'current diagram' without stating prerequisites like an active session or open diagram, leaving some context incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% for the single 'path' parameter, which includes a clear description and example. The tool description adds no additional meaning beyond the schema, so the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool exports the current diagram to a .drawio file, specifying the verb and resource. It is distinct from siblings like start_session, create_new_diagram, edit_diagram, and get_diagram, which cover session management and diagram CRUD operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies clear usage context: use when you need to save the current diagram as a .drawio file. However, it does not explicitly mention alternatives or when not to use it, such as when trying to load a diagram (which would use get_diagram).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_diagramA

Get the current diagram XML (fetches latest from browser, including user's manual edits). Call this BEFORE edit_diagram if you need to update or delete existing elements, so you can see the current cell IDs and structure.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full transparency burden. It discloses that the tool fetches the latest state from the browser, includes manual edits, and that the output contains cell IDs and structure. However, it doesn't mention potential prerequisites (e.g., active session) or error behavior, which would make it more complete.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, consisting of two purposeful sentences. The first sentence states the primary function and an important behavioral detail, while the second gives a targeted usage instruction. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter tool with no output schema, the description is exceptionally complete. It explains what the tool returns (diagram XML), the freshness guarantee (latest from browser, manual edits), and when to call it relative to edit_diagram. The only minor omission is potential session requirements, but this is not critical given the simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so the schema is trivially 100% covered. The description adds value by explaining what the output contains (XML with cell IDs and structure), which helps the agent understand the result even though there are no inputs to clarify.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get the current diagram XML.' It specifically distinguishes this from sibling tools like edit_diagram by emphasizing it fetches the latest state including manual edits, which is a unique read-only function.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides explicit usage guidance: 'Call this BEFORE edit_diagram if you need to update or delete existing elements, so you can see the current cell IDs and structure.' This tells the agent exactly when to use this tool relative to an alternative.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

start_sessionA

Start a new diagram session and open the browser for real-time preview. Starts an embedded server and opens a browser window with draw.io. The browser will show diagram updates as they happen.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full behavioral burden. It discloses key traits: starts an embedded server, opens a browser window, and shows live diagram updates. However, it omits lifecycle details like how to stop the session and what happens to the server afterwards, and does not mention the return value.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three sentences, front-loaded with the primary action. Each sentence adds a distinct piece of useful information: the session start, the embedded server/browser, and the real-time update behavior. No redundant or unnecessary text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description accurately explains what happens during the session but leaves gaps around the return value (e.g., session ID or URL) and session termination/cleanup. Given the lack of an output schema and annotations, these omissions mean an agent may not know what to expect back or how to manage the session lifecycle. Adequate for a simple tool but with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so the baseline score is 4. The description adds context about the session's behavior but no parameter-specific details are needed since there are none.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly specifies the action 'Start a new diagram session' and the key feature 'real-time preview', distinguishing it from sibling tools like create_new_diagram or export_diagram. The mention of an embedded server and browser window adds specific context that clearly identifies this as a session-launching tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It does not reference sibling tools, state prerequisites, or mention when not to use it. The usage context is implied (when real-time preview is needed) but never explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv1.0.2
    • First observedcreate_new_diagram
    • First observededit_diagram
    • First observedexport_diagram
    • First observedget_diagram
    • First observedstart_session

TDQS

A4.4/5.0
Disambiguation5/5

Each tool targets a distinct phase of the diagram workflow: session startup, creation, modification, retrieval, and export. The descriptions explicitly clarify the boundary between create_new_diagram and edit_diagram, preventing misselection.

Naming Consistency5/5

All tool names follow a verb_noun pattern in snake_case (start_session, edit_diagram, get_diagram, export_diagram; create_new_diagram includes an adjective but still starts with a verb). There is no mixed case or inconsistent verb tense.

Tool Count5/5

With 5 tools covering the complete lifecycle of a draw.io diagram, the count is well-scoped. It is not too small to be limiting nor too large to be confusing.

Completeness5/5

The tool set covers the full workflow: start a session, create a new diagram, read the current state, apply modifications (including add/update/delete operations), and export. No critical gaps are apparent for the stated purpose of diagram creation and editing.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hj1003862396/draw-flow-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server