Draw.io MCP 服务器 logo

Draw.io MCP 服务器

CommunityPopular
lgazo

Draw.io Model Context Protocol (MCP) Server

Publisherlgazo
Repositorydrawio-mcp-server
LanguageTypeScript
Forks
131
Stars
1.5K
Available tools
28
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Draw.io MCP 服务器 exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 28 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    1.5K stars and 131 forks from the linked repository.

Draw.io MCP server

Let's do some Vibe Diagramming with the most wide-spread diagramming tool called Draw.io (Diagrams.net).

Discord channel Build project Verified on MseeP Version

Key Highlights

  • Claude Code plugin: /plugin marketplace add lgazo/drawio-mcp-server then /plugin install drawio, with /drawio-open and /drawio-status slash commands v2.3.0

  • npx drawio-mcp-server install <host> writes the MCP config for claude-code, claude-desktop, codex, zed, opencode, or all v2.3.0

  • Document persistence tools: set-document-title and save-document v2.3.0

  • Draw.io library API version compatibility mechanism v2.2.0

  • Enable Draw.io MCP in IFrames

  • AWS, GCP, Azure, Cisco19, and CiscoSafe stencils auto-discovered at runtime from drawio's sidebar

  • Multi-document targeting with list-documents and target_document selectors for multi-tab workflows

  • Multi-page targeting with required target_page selectors for page-scoped tools

  • Per-document FIFO serialization for live operations, so multiple agents can work on different files safely

  • Page management tools: list-pages, get-current-page, create-page, copy-page, rename-page

  • Import, embed, or expand Mermaid diagrams v2.1.0

  • Firefox support is back, TLS mode is necessary v2.1.0

  • Server supports TLS mode and optionally generates self-signed certificates v2.1.0

  • Import and export diagrams from/to XML, SVG (with embedded XML), or PNG (with embedded XML) v2.0.0

  • Edge geometry control with waypoints and automatic self-connector routing v2.0.0

  • Parent-child relationships for nested shapes and grouping v2.0.0

  • Unified Server and Extension in the same mono-repo v2.0.0

  • Built-in Draw.io editor - no browser extension required

  • MCP server that lets AI agents control Draw.io diagrams

  • Programmatic diagram creation, inspection, and modification via MCP tools

  • Layer management for complex diagrams

  • Works with any MCP client (Claude Desktop, Claude Code, Zed, Codex, etc.)

Introduction

The Draw.io MCP server brings Draw.io diagramming capabilities to AI agents. It provides MCP tools that can create, read, update, and delete diagram elements - letting AI assistants build architectural diagrams, flowcharts, and visual documentation automatically.

Two ways to use:

  1. Built-in editor - Server hosts Draw.io directly, accessible in your browser
  2. Browser extension - Connect to Draw.io running in your browser via extension

Experimental: integration with the draw.io desktop (Electron) app is in progress but currently blocked by an upstream CSP issue — see DESKTOP.md.

Requirements

  • Node.js (v22 or higher; tested against v22 LTS and v24 LTS) - Runtime environment for the MCP server
  • MCP client - Claude Desktop, Claude Code, Zed, Codex, OpenCode, or any MCP-compatible host

For Built-in Editor

No additional requirements - runs out of the box with --editor flag.

For Browser Extension

Optional

  • pnpm - Preferred package manager (npm works fine too)

Quick Start

1. Configure your MCP host

Fastest path:

  • Claude Code: /plugin marketplace add lgazo/drawio-mcp-server then /plugin install drawio.
  • Any other host: npx drawio-mcp-server install <host> where <host> is claude-code, claude-desktop, codex, zed, opencode, or all.

See docs/PLUGINS.md for the full reference, flags, and uninstall, and docs/release.md for how releases are cut.

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

json
{
  "mcpServers": {
    "drawio": {
      "command": "npx",
      "args": ["-y", "drawio-mcp-server", "--editor"]
    }
  }
}

For other MCP clients and detailed configuration (including pnpm options), see Configuration.

2. Open the editor

After restarting your MCP host, open: http://localhost:3000/

3. Start diagramming

Example prompts you can try:

"Create an event-driven architecture diagram showing a message queue with producers, consumers, and three backend services"

"Create a three-page event-driven architecture diagram. Use three agents in parallel for service topology, message flow, and retry/failure handling, with each agent assigned to a separate target page."

"Draw a CRUD API diagram with a database, API gateway, and four microservices with their endpoints"

"Add a new layer called 'Background' and move all decorative elements to it, then create a new layer for annotations"

Your AI assistant can now control the diagram using MCP tools.

Features

The server provides MCP tools for:

  • Document discovery - list connected Draw.io document instances and route later calls to a specific tab/file instance
  • Diagram inspection - read shapes, pages, layers, and cell properties
  • Diagram modification - add/edit/delete shapes, edges, and labels on a target page
  • Page management - list pages, inspect the current page, create pages, copy pages, and rename pages without forcing a visible page switch on supported runtimes
  • Layer management - create, switch, and organize layers
  • Vendor shape coverage - AWS, GCP, Azure, Cisco19, and CiscoSafe stencils auto-discovered at runtime from drawio's sidebar, so agents can place icons like mxgraph.gcp2.cloud_run or mxgraph.cisco19.router without hand-curated catalogs
  • Built-in TLS — opt-in HTTPS + WSS with manual cert/key or auto-generated self-signed material via a per-user local CA. See CONFIG.md → TLS.

See Tools Reference for the complete list of available tools.

Installation

The server runs as part of your MCP host. Detailed configuration for all supported clients (Claude Desktop, Claude Code, Zed, Codex, oterm) including npm and pnpm options is available in Configuration.

Alternative: Browser Extension

Instead of the built-in editor, you can use the browser extension to connect to Draw.io running in your browser. This works with or without the --editor flag.

  1. Open Draw.io in your browser
  2. Install the Draw.io MCP Browser Extension:
  3. Ensure the extension is connected (green signal overlay on icon)

Configuration without --editor:

json
{
  "mcpServers": {
    "drawio": {
      "command": "npx",
      "args": ["-y", "drawio-mcp-server"]
    }
  }
}

See the extension documentation for more details.

Experimental: Draw.io Desktop

Integration with the draw.io desktop (Electron) app is experimental and currently blocked end-to-end by an upstream CSP issue. The plugin loads inside draw.io desktop, but its WebSocket connection back to the MCP server is rejected by draw.io's hard-coded connect-src 'self' policy.

See DESKTOP.md for the full setup steps and the current limitation.

Related Resources

Configuration - CLI flags and advanced options

Tools Reference - Complete MCP tools documentation

Troubleshooting

Prompt examples

Contributing

Architecture

Development

Draw.io Desktop (experimental) - install path and known CSP limitation

Star History

Assessments

MSeeP.ai Security Assessment Badge

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "lgazo-drawio-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "drawio-mcp"
      ]
    }
  }
}

Available Tools

  • get-selected-cell

    This tool retrieves the selected cell on the target page of the current Draw.io document. If the target page is not currently visible, Draw.io may switch the visible page first because selection is UI-bound.

  • add-rectangle

    This tool allows you to add a new Rectangle vertex cell on the target page of the current Draw.io document.

  • add-edge

    This tool creates an edge, sometimes called also a relation, between two vertexes (cells). When source and target are the same shape (self-connector), a loop edge style is automatically applied if no custom style is provided.

  • delete-cell-by-id

    Deletes a cell from the target page, whether it is a vertex or edge.

  • get-shape-categories

    Retrieves available shape categories from the diagram's library. Library is split into multiple categories.

  • get-shapes-in-category

    Retrieve all shapes in the provided category from the diagram's library. A shape primarily contains style based on which you can create new vertex cells.

  • get-shape-by-name

    Retrieve a specific shape by its name from all available shapes in the diagram's library. It returns the shape and also the category it belongs.

  • add-cell-of-shape

    This tool allows you to add a new vertex cell on the target page of the current Draw.io document by its shape name.

  • set-cell-shape

    Updates the visual style of an existing vertex cell to match a library shape by name.

  • set-cell-data

    Sets or updates a custom attribute on an existing cell.

  • edit-cell

    Update properties of an existing vertex/shape cell by its ID. Only provided fields are modified; unspecified properties remain unchanged.

  • edit-edge

    Update properties of an existing edge by its ID. Only provided fields are modified; unspecified properties remain unchanged. Supports setting waypoints for edge geometry control.

  • list-paged-model

    Retrieves a paginated view of all cells (vertices and edges) on the target page. This tool provides access to the complete model data with essential fields only, sanitized to remove circular dependencies and excessive data.

  • list-layers

    Lists all available layers on the target page with their IDs and names.

  • set-active-layer

    Sets the active layer for creating new elements. All subsequent element creation will happen in this layer. If the target page is not currently visible, Draw.io may switch the visible page first because active-layer state is UI-bound.

  • move-cell-to-layer

    Moves a cell from its current layer to a target layer.

  • set-cell-parent

    Sets the parent of a cell, making it a child of the specified parent cell. This allows creating hierarchical relationships where moving the parent also moves its children.

  • get-active-layer

    Gets the currently active layer information for the target page. If the target page is not currently visible, Draw.io may switch the visible page first because active-layer state is UI-bound.

  • create-layer

    Creates a new layer on the target page.

  • export-diagram

    Export the target page or current diagram as SVG, PNG, or XML. Returns the diagram data as base64 (PNG) or text (SVG/XML). Optionally saves to a file.

  • import-diagram

    Import a diagram from XML, SVG with embedded XML, or PNG with embedded XML into the current Draw.io instance. target_page is required for replace and add, and optional for new-page.

  • import-mermaid

    Insert a Mermaid diagram into the target Draw.io page. Conversion runs inside the Draw.io editor via its bundled Mermaid pipeline (EditorUi.parseMermaidDiagram). mode='native' converts supported Mermaid types into native mxGraph cells; unsupported types fall back to an embedded image cell. mode='embed' always emits a single image cell that preserves the Mermaid source for re-editing inside Draw.io. target_page is required for replace and add, and optional for new-page.

  • list-documents

    Lists all connected Draw.io document instances with their stable instance IDs and basic metadata.

  • list-pages

    Lists all pages in the current Draw.io document with their index, id, name, and current-page flag.

  • get-current-page

    Gets the currently visible page metadata, including index, id, name, and whether it is active.

  • create-page

    Appends a new blank page to the current Draw.io document without changing the visible page when the runtime supports background page insertion.

  • copy-page

    Creates a copy of an existing page in the target/current Draw.io document, appends the copy to the end of the page list, and returns the copied page metadata. When possible, the previously visible page is restored after the copy is created.

  • rename-page

    Renames the selected page without changing the visible page.

Use Draw.io MCP 服务器 MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Draw.io MCP 服务器 is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Draw.io MCP 服务器 as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Draw.io MCP 服务器 MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "lgazo-drawio-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "drawio-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Draw.io MCP 服务器 MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Draw.io MCP 服务器 MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Draw.io MCP 服务器 to help me with this task?
Draw.io MCP 服务器
Sure. I read it.
Here is what I found using Draw.io MCP 服务器.

Frequently asked questions

What is the Draw.io MCP 服务器 MCP server used for?

Draw.io MCP 服务器 is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Draw.io MCP 服务器 MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Draw.io MCP 服务器 with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Draw.io MCP 服务器 MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Draw.io MCP 服务器 connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Draw.io MCP 服务器 MCP to TypingMind?

Draw.io MCP 服务器 runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Draw.io MCP 服务器 MCP provide in TypingMind?

Draw.io MCP 服务器 exposes 28 MCP tools that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Draw.io MCP 服务器 MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Draw.io MCP 服务器 requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇