Skip to main content
Glama

Local Draw.io MCP

本项目提供一个本地 Draw.io MCP 服务,使用已安装的桌面版 Draw.io。

服务会维护默认工作文件:

D:\Draw-workspace\current.drawio

默认工作文件放在不带空格的目录里,避免 Draw.io 桌面版打开 Program Files (x86) 这类路径时把参数拆坏。Draw.io 可执行文件会自动从常见安装路径发现,也可以用 DRAWIO_EXE 环境变量指定。

Tools

  • start_session: 用本地 Draw.io 打开当前工作文件。

  • create_new_diagram: 写入新的 mxGraphModel/mxfile,并打开本地 Draw.io。

  • get_diagram: 读取当前本地 .drawio XML。

  • edit_diagram: 按 cell id 增删改当前图。建议先读图,但不强制。

  • export_diagram: 导出 .drawio.png.svg.pdf.jpg

如果你在桌面版 Draw.io 里手动调整了图,保存后 MCP 会继续读取同一个工作文件并在此基础上编辑。

create_new_diagramedit_diagram 会在覆盖当前图之前自动备份到 D:\Draw-workspace\backups

Related MCP server: drawio-mcp-server

安装

推荐用安装脚本注册 Codex MCP:

powershell -ExecutionPolicy Bypass -File .\scripts\install-codex.ps1

脚本会自动查找 Draw.io、创建 D:\Draw-workspace、安装依赖、注册 Codex MCP,并运行 smoke test。

Codex MCP

也可以手动注册:

codex mcp add drawio -- node "D:\Program Files (x86)\Draw.io\draw.io-mcp\src\server.js"

添加后重启 Codex,或重新打开会话,让 MCP 工具刷新。

Claude Code MCP

本服务是标准 stdio MCP Server,Claude Code 也可以直接使用:

claude mcp add drawio -- node "D:\Program Files (x86)\Draw.io\draw.io-mcp\src\server.js"

可以用下面命令检查连接状态:

claude mcp get drawio

Codex 自动安装

当用户在 Codex 里说“@CycSpring/draw.io-use 给我装上这个 MCP”时,可以按下面流程安装:

$repo = "$env:USERPROFILE\.codex\mcp\draw.io-use"
New-Item -ItemType Directory -Force (Split-Path $repo) | Out-Null

if (Test-Path "$repo\.git") {
  git -C $repo pull
} else {
  git clone https://github.com/CycSpring/draw.io-use.git $repo
}

npm --prefix $repo install
powershell -ExecutionPolicy Bypass -File "$repo\scripts\install-codex.ps1"

如果已经存在同名 drawio MCP,先移除旧配置或更新为新的 server.js 路径。

在 Codex 里怎么用

可以直接用自然语言让 Codex 画图、改图、导出图,例如:

  • “用 drawio 画一个三层架构图,并打开让我检查。”

  • “读取当前 Draw.io 图,把网关模块改成 API Gateway。”

  • “在现有图里加一个 Redis 节点,连到后端服务。”

  • “把当前图导出成 D:\Draw-workspace\exports\architecture.png。”

  • “把当前图导出成 D:\Draw-workspace\current.drawio.png,我想直接看 PNG 预览。”

常见协作流程:

  1. 让 Codex 调用 create_new_diagram 生成第一版图。

  2. 在 Draw.io 桌面版里手动微调并保存。

  3. 让 Codex 调用 get_diagram 读取最新文件。

  4. 继续让 Codex 用 edit_diagram 做局部修改,或用 export_diagram 导出成图片/PDF。

注意:create_new_diagram 会覆盖当前工作文件;如果要保留旧图,先导出或复制一份。

示例图与 Prompt

下面是用本 MCP 生成并导出的 Hermes agent / Hermes Desktop 架构图示例:

Hermes Desktop 架构图

可以把类似 prompt 直接发给 Codex 或 Claude Code:

用 drawio 画一张 Hermes agent / Hermes Desktop 架构图,风格参考清爽的分层架构图:

- 标题:Hermes Desktop 架构图
- 横向四层:桌面交互层、应用编排层、本地能力层、外部服务层
- 桌面交互层包含:用户、Hermes Desktop UI(聊天 / 设置 / 任务视图)
- 应用编排层包含:Electron Main(窗口 / 托盘 / 生命周期)、IPC / Preload Bridge(权限边界 / 事件通道)、Gateway / Agent(会话编排 / 上下文与重试)
- 本地能力层包含:MCP Tools(文件 / 终端 / Draw.io / 插件)、Local Store(配置 / 会话 / 日志 / 密钥引用)、OS Services(文件系统 / 网络 / 开机启动)
- 外部服务层包含:Model API(OpenAI / Claude / 中转服务)、远程资源(插件市场 / 版本更新)
- 用实线表示主链路:用户操作 -> UI -> IPC -> Gateway / Agent -> 模型 / 工具 -> UI 回显
- 用虚线表示辅助链路:配置、日志、系统集成、插件更新
- 布局要留白充足,模块文字短句分行,线条尽量少交叉,最后导出成 D:\Draw-workspace\current.drawio.png 方便预览

感谢

感谢@https://github.com/DayuanJiang/next-ai-draw-io

Available Tools

5 tools
create_new_diagramB

Create a new diagram from mxGraphModel or mxfile XML, save it locally, and open it in Draw.io.

ParametersJSON Schema
NameRequiredDescriptionDefault
xmlYesComplete mxGraphModel or mxfile XML.

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations, the description must disclose side effects. It states local saving and opening in Draw.io, which imply persistence and external interaction. However, it does not detail error cases, return values, or whether prior diagrams are affected, leaving gaps.

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, well-structured sentence that immediately states the action. No filler or redundant information. Highly efficient.

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

Completeness2/5

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

Given the sibling tools (edit, get, export), the description fails to explain how the created diagram is identified or retrieved later. It omits return values (e.g., diagram ID) and whether it overwrites existing files, making it incomplete for practical use.

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?

The input schema already describes the 'xml' parameter as 'Complete mxGraphModel or mxfile XML.' The description essentially repeats this, adding no new semantic meaning beyond reinforcing the format. With 100% schema coverage, baseline 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 verb (create) and resource (new diagram) along with the input format (mxGraphModel or mxfile XML). It distinguishes from sibling tools (edit, export, get) by focusing on creation.

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?

The description lacks explicit guidance on when to use this tool versus alternatives. It does not mention prerequisites, scenarios, or when not to use it, leaving the agent to infer from the action alone.

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 local .drawio file by ID-based add/update/delete operations. get_diagram is recommended but not required.

ParametersJSON Schema
NameRequiredDescriptionDefault
operationsYes

TDQS

A3.5/5.0
Behavior2/5

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

No annotations are provided, so the description bears the full burden. It mentions the edit operations but fails to disclose potential side effects (e.g., file modification, saving behavior), required permissions, or error conditions.

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 compact two sentences with no filler. It front-loads the core purpose and tacks on a helpful recommendation without redundancy.

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

Completeness2/5

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

For a mutation tool with a nested array parameter, no output schema, and no annotations, the description is insufficient. It omits workflow details (e.g., need for an existing file, persistence model, error handling) and does not clarify the expected behavior of each operation.

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

Parameters2/5

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

Schema coverage is 0% and the description adds little beyond the schema: it mentions ID-based and operation types, but does not explain the role of new_xml or the structure of operations array in detail. The agent must infer from the JSON schema.

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 verb 'Edit', the resource 'local .drawio file', and the method 'ID-based add/update/delete operations'. It distinguishes itself from siblings like create_new_diagram and get_diagram.

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?

It provides a usage hint by recommending get_diagram before editing, but does not explicitly contrast with other siblings like create_new_diagram or export_diagram, nor mention when not to use.

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

export_diagramB

Export the current local .drawio file. .drawio copies XML; png/svg/pdf/jpg use the local Draw.io exporter.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYes
formatNo

TDQS

B3/5.0
Behavior3/5

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

With no annotations, the description carries full behavioral disclosure. It explains format-specific export behaviors (drawio copies XML; others use local exporter). However, it omits side effects, required session state, or whether the file must already exist, leaving gaps.

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?

Two sentences convey the essential purpose and format-specific behavior without extraneous text. Every sentence adds value, making it highly concise.

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

Completeness2/5

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

Given no output schema, no annotations, and only 2 parameters with 0% schema description coverage, the description lacks critical context: prerequisites (e.g., active session), return value, error conditions, and exact file location semantics. Incomplete for an exporter tool.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It implies 'path' refers to the current local .drawio file and mentions format alternatives, but does not specify path constraints (e.g., absolute/relative) or format implications beyond the enum. Missing details on required parameter semantics.

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

Purpose4/5

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

The description clearly states the tool exports a local .drawio file and lists output formats. The action (export) and resource are unambiguous, but it does not differentiate from sibling tools like get_diagram or edit_diagram, which might also handle file output.

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?

The description provides no guidance on when to use this tool versus alternatives like get_diagram or create_new_diagram. No context about prerequisites or situations where this tool is inappropriate.

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

get_diagramA

Read the current local .drawio file XML.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4/5.0
Behavior3/5

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

With no annotations, the description carries full burden. It describes a read operation (non-destructive) but lacks details about potential behavioral traits such as session dependencies, file locking, or return format nuances.

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 sentence that directly states the tool's purpose without any extraneous words or redundant information.

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

Completeness4/5

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

For a zero-parameter read tool, the description covers the essential information. However, it could mention the relationship to the 'start_session' sibling or any prerequisites, but it's largely complete.

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?

No parameters are defined, so the description correctly omits parameter details. The baseline of 4 is appropriate given no additional parameter information is needed.

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 uses a specific verb ('Read') and resource ('current local .drawio file XML'), clearly distinguishing it from siblings like create_new_diagram, edit_diagram, export_diagram, and start_session.

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

Usage Guidelines3/5

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

The description implies the tool is for reading the current diagram file, but it does not provide explicit guidance on when to use it versus alternatives or when not to use it.

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

start_sessionA

Open the current .drawio file in the locally installed Draw.io desktop app.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.8/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 action without disclosing behavioral traits such as what happens if no file is open or if the desktop app is not installed.

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 sentence, concise and to the point, with no unnecessary words.

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

Completeness4/5

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

For a simple tool with no parameters and no output schema, the description is fairly complete, though it could mention prerequisites such as needing a .drawio file open or the desktop app installed.

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 and the schema coverage is 100%, so the baseline is 4. The description adds context about the action but there is no need to explain parameters.

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 verb 'Open' and the specific resource 'current .drawio file' and the target 'locally installed Draw.io desktop app'. It distinguishes itself from sibling tools which handle creation, editing, exporting, and retrieval.

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

Usage Guidelines3/5

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

The description implies usage when a .drawio file is present and the user wants to open it in the desktop app, but it does not provide explicit when-to-use or when-not-to-use guidance, nor does it mention alternatives among siblings.

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.0
    • First observedcreate_new_diagram
    • First observededit_diagram
    • First observedexport_diagram
    • First observedget_diagram
    • First observedstart_session

TDQS

A3.8/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: creating, editing, exporting, reading, and starting a session for the diagram. No overlapping functionality.

Naming Consistency5/5

All tool names follow a consistent verb_noun snake_case pattern (create_new_diagram, edit_diagram, export_diagram, get_diagram, start_session), making the set predictable.

Tool Count5/5

With 5 tools, the set is well-scoped for a single-file diagram editor—covering creation, reading, editing (including delete), exporting, and desktop app integration.

Completeness5/5

The tool surface covers the complete lifecycle of a single .drawio file: create, read, update/delete (via edit_diagram), export, and open in desktop app. No obvious gaps.

Maintenance

ActivityInactive
ResponsivenessNo issues

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

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to create and edit diagrams in the draw.io desktop app through the Model Context Protocol.
    Apache 2.0
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables LLMs to create and open diagrams in the draw.io editor, supporting inline chat previews via MCP Apps, direct editor opening with XML/CSV/Mermaid format support, and diagram export to PNG/SVG/PDF or browser URLs through multiple integration approaches.
    5,309
    Apache 2.0

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/CycSpring/draw.io-use'

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