Skip to main content
Glama

Local Draw.io MCP

本地 STDIO MCP 服务,用于让 Codex 直接创建和维护可编辑的 draw.io XML 文件。

工具

  • server_info:查看版本及允许访问的目录。

  • create_diagram:根据分组、节点和连线创建 .drawio。

  • inspect_diagram:读取第一页的节点、连线和几何信息。

  • validate_diagram:检查重复 ID、无效坐标、越界、失效连线和节点重叠。

  • update_diagram:添加节点/连线,或修改已有节点。

文件中的文字只作为数据处理,不作为 MCP 指令执行。

Related MCP server: draw.io MCP

本地运行

npm install
npm test
npm start

npm start 使用 STDIO,正常启动后会等待 MCP 客户端连接,不会显示交互式界面。

接入 Codex

在 Codex 桌面版中打开“设置 → MCP servers → Add server”,选择 STDIO,然后填写:

  • Command:C:\Program Files\nodejs\node.exe

  • Arguments:本项目的 src\server.mjs 绝对路径

  • Working directory:本项目目录

也可复制 config.example.toml 的内容到 ~/.codex/config.toml,修改其中路径后重启 Codex。

在 Codex CLI 中可运行:

codex mcp list

在会话输入框中可使用 /mcp 查看连接状态。

路径限制

通过以下环境变量控制访问范围,Windows 下使用分号分隔多个目录:

  • DRAWIO_MCP_READ_ROOTS

  • DRAWIO_MCP_WRITE_ROOTS

未配置时仅允许访问本 MCP 项目目录。建议只开放项目工作区,不要把整个磁盘配置为可写。

调用示例

连接后可直接告诉 Codex:

使用 drawio MCP 创建一个包含数据平台层、预警引擎层和响应反馈层的 主动预警系统.drawio,完成后运行 validate_diagram 校验。

创建工具默认不会覆盖已有文件;需要覆盖时必须显式传入 overwrite=true。

Available Tools

5 tools
create_diagramCreate draw.io diagramB

Create a new editable .drawio XML diagram from structured groups, nodes, and edges with automatic layout.

Inputs: nodes (required), output_path (required), edges, title, +4 more.

inspect_diagramInspect draw.io diagramA
Read-onlyIdempotent

Read the first page of a draw.io XML file and return nodes, edges, labels, and geometry.

Inputs: input_path (required).

server_infoDraw.io MCP server informationA
Read-onlyIdempotent

Show allowed roots and supported workflow information.

Inputs: no named parameters.

update_diagramUpdate draw.io diagramA

Add nodes/edges or update a node in an existing draw.io file. Writes a separate output unless overwrite is explicitly enabled.

Inputs: input_path (required), operations (required), output_path (required), overwrite.

validate_diagramValidate draw.io diagramA
Read-onlyIdempotent

Check draw.io XML structure, duplicate ids, invalid geometry, page bounds, dangling edges, and node overlaps.

Inputs: input_path (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clear and distinct role: informational, create, inspect, validate, and update. There is no meaningful overlap between the tools, and the descriptions make it easy for an agent to select the right one.

    Naming Consistency4/5

    Four of the five tools follow a consistent verb_noun pattern: create_diagram, inspect_diagram, validate_diagram, and update_diagram. server_info breaks the pattern by using a noun_noun form without a verb, which is a minor deviation.

    Tool Count5/5

    Five tools is a well-scoped size for a diagram-focused MCP server. Each tool contributes a necessary part of the workflow without unnecessary bloat or redundancy.

    Completeness4/5

    The core create-read-update-validate lifecycle is well covered for draw.io XML manipulation. Missing capabilities like deleting nodes/edges or inspecting more than the first page are notable but not critical gaps for common diagram workflows.

    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
      A
      quality
      D
      maintenance
      Renders diagram-as-code to PNG files on your disk, and also provides text-art previews and syntax validation, all locally without a browser or network.
      4
      16 npm
      MIT