Skip to main content
Glama

diag2md-mcp

Сервер Model Context Protocol (MCP), предоставляющий ИИ-агентам программирования архитектурные ограничения C4 и UML для Draw.io, а также возможности преобразования диаграмм.

GitHub Release License: MIT TypeScript

diag2md-mcp связывает архитектурные диаграммы Draw.io (.xml, .drawio) с ИИ-агентами программирования (такими как Antigravity, Cursor, Claude Desktop и MCP-клиенты VS Code), преобразуя диаграммы C4 и UML в структурированный Mermaid Markdown в реальном времени.

Работает на базе diag2md.


Ключевые возможности

  • Автоматическое обнаружение в рабочем пространстве: сканирует каталоги проекта на предмет файлов диаграмм Draw.io, соответствующих настраиваемым glob-шаблонам (**/architecture/**/*.xml, **/*.drawio).

  • Высокопроизводительное преобразование в памяти: преобразует XML-модели Draw.io в Mermaid C4 и UML Markdown в памяти, без накладных расходов на запуск подпроцессов.

  • Поставщик контекста для ИИ (convert_diagrams_read): динамически считывает и преобразует диаграммы, предоставляя богатый архитектурный контекст непосредственно ИИ-ассистентам программирования во время чат-сессий.

  • Пакетная синхронизация диаграмм (convert_diagrams_write): поддерживает архитектурную документацию в актуальном состоянии, создавая .md-файлы рядом с исходными диаграммами.


Related MCP server: drawio-mcp

Быстрый старт

Запуск через npx

Вы можете запустить MCP-сервер напрямую без предварительной установки:

npx -y diag2md-mcp

Глобальная установка

npm install -g diag2md-mcp

Конфигурация MCP-сервера

Чтобы подключить diag2md-mcp к вашему любимому ИИ-ассистенту или MCP-клиенту, добавьте сервер в файл конфигурации клиента (например, mcp_config.json, claude_desktop_config.json, настройки MCP в Cursor или Antigravity).

Рекомендуемый способ (глобально установленный пакет)

{
  "mcpServers": {
    "diag2md-mcp": {
      "command": "diag2md-mcp"
    }
  }
}

Альтернатива: локально собранный исходный код

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

Альтернатива: по требованию через npx

{
  "mcpServers": {
    "diag2md-mcp": {
      "command": "npx",
      "args": ["-y", "diag2md-mcp"]
    }
  }
}

Справочник MCP-инструментов

diag2md-mcp предоставляет ИИ-агентам программирования 3 основных инструмента:

Имя инструмента

Описание

Аргументы

list_diagrams

Обнаруживает все файлы архитектурных диаграмм Draw.io (.xml, .drawio) в рабочем пространстве, соответствующие glob-шаблонам.

patterns (необязательный string[]), ignore (необязательный string[])

convert_diagrams_write

Пакетно сканирует файлы диаграмм в рабочем пространстве по glob-шаблонам, преобразует их и записывает обновлённые .md-файлы на диск.

patterns (необязательный string[]), diagramType (необязательный "c4" | "uml")

convert_diagrams_read

Пакетно сканирует файлы диаграмм в рабочем пространстве и возвращает преобразованный Mermaid Markdown непосредственно как контекст для ИИ-ассистента.

patterns (необязательный string[]), diagramType (необязательный "c4" | "uml")


Конфигурация сервера

Настройки MCP-сервера можно изменить с помощью переменных окружения:

Переменная окружения

Описание

Значение по умолчанию

DIAG2MD_PATTERNS

Glob-шаблоны через запятую для обнаружения файлов диаграмм.

**/architecture/**/*.xml, **/architecture/*.xml, **/*.drawio

DIAG2MD_IGNORE

Glob-шаблоны через запятую для игнорирования при поиске файлов.

**/node_modules/**, **/dist/**, **/.git/**

DIAG2MD_TYPE

Тип диаграммы преобразования по умолчанию (c4 или uml).

c4

Пример конфигурации с шаблонами env

Вы можете настроить собственные шаблоны поиска непосредственно в JSON-конфигурации MCP-сервера с помощью блока env:

{
  "mcpServers": {
    "diag2md-mcp": {
      "command": "diag2md-mcp",
      "env": {
        "DIAG2MD_PATTERNS": "**/architecture/**/*.xml, **/docs/**/*.drawio",
        "DIAG2MD_IGNORE": "**/tmp/**, **/node_modules/**",
        "DIAG2MD_TYPE": "c4"
      }
    }
  }
}

Пример динамического вызова инструмента с параметром patterns

ИИ-ассистенты или инструменты также могут динамически переопределять шаблоны поиска для каждого запроса:

{
  "name": "convert_diagrams_read",
  "arguments": {
    "patterns": [
      "**/architecture/**/*.xml",
      "**/docs/**/*.drawio"
    ]
  }
}

Разработка

# Clone the repository
git clone https://github.com/diag2md/diag2md-mcp.git
cd diag2md-mcp

# Install dependencies
npm install

# Build TypeScript to JavaScript dist/
npm run build

# Run unit tests
npm run test

# Run type checker
npm run typecheck

Лицензия

MIT © polymatic.ventures

Available Tools

3 tools
convert_diagrams_readA

Batch scan and convert all workspace diagram files (.xml, .drawio) into Mermaid Markdown, returning their content directly as AI context.

NameRequiredDescriptionDefault
patternsNoCustom glob patterns to scan for diagram files
diagramTypeNoDiagram type: "c4" or "uml" (default: "c4")

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It usefully discloses batch behavior, file-type scope, output format, and that results are returned to the caller. However, it never explicitly states the operation is non-destructive/read-only (only the name's 'read' hints at it), and it does not warn that batch-converting 'all' workspace files could produce very large context output.

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?

A single sentence with zero filler: action and scope are front-loaded, followed by output format and return semantics. Every element earns its place, and no information is repeated from the schema.

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 tool with only 2 optional parameters, no output schema, and no annotations, the description supplies the core facts: what it scans, what it produces, and where the result goes. Remaining gaps — no explicit non-destructive statement, no failure/skip semantics for unparseable files, no per-file response structure — are relatively minor given the 'content directly as AI context' framing.

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 description coverage is 100% — both patterns and diagramType already have clear descriptions in the schema. The tool description adds only marginal context (e.g., the default 'all workspace files' behavior implied by 'Batch scan and convert all'), so the baseline 3 applies; it neither compensates for gaps nor adds meaningful parameter insight.

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?

States a specific action ('Batch scan and convert'), specific resources (workspace .xml/.drawio diagram files), and explicit output (Mermaid Markdown). The clause 'returning their content directly as AI context' signals a read-style operation that contrasts with the write sibling, making the purpose unambiguous.

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?

Usage is implied — this is the tool for getting diagram content into AI context as Mermaid — but there is no explicit when-to-use guidance, no exclusions, and no mention of alternatives such as convert_diagrams_write for persisting output or list_diagrams for merely enumerating files. An agent must infer selection criteria from the name and output framing.

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

convert_diagrams_writeA

Batch scan workspace diagrams matching glob patterns and convert them to updated .md files on disk.

NameRequiredDescriptionDefault
patternsNoCustom glob patterns to scan for diagram files
diagramTypeNoDiagram type: "c4" or "uml" (default: "c4")

TDQS

A3.7/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 itself. It does say the tool writes/updates .md files on disk and that it scans in batch, which are important behaviors. However, it doesn't say whether existing files are overwritten, where new files land, or whether the operation is idempotent.

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 with no filler. The key constraints—batch scanning, glob patterns, and disk output—are front-loaded and every word earns its place.

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?

For a simple two-parameter tool, the description covers what is scanned and what is produced, but it leaves ambiguity about overwrite behavior and doesn't clarify side effects in detail. Since no annotations or output schema exist, this gap is more significant.

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%, so the baseline is 3. The description adds only 'workspace' and 'batch' context to the patterns parameter; the diagramType enum and default are already in the schema. No additional parameter meaning 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 opens with a concrete action ('Batch scan workspace diagrams matching glob patterns') and specifies the outcome ('convert them to updated .md files on disk'). This clearly names the resource and distinguishes it from the sibling tools by emphasizing disk writes.

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?

It doesn't explicitly state when to prefer this over convert_diagrams_read or list_diagrams. The 'Batch' and 'on disk' wording implies a write-oriented bulk use case, but there are no explicit alternatives or exclusion conditions.

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

list_diagramsA

Discover all Draw.io architecture diagram files (.xml, .drawio) in the workspace using glob patterns.

NameRequiredDescriptionDefault
ignoreNoCustom glob patterns to ignore during search
patternsNoCustom glob patterns to search for diagram files (e.g. ["**/*.drawio"])

TDQS

A4/5.0
Behavior3/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. 'Discover' implies a read-only search operation, and it specifies scope (workspace) and approach (glob patterns). However, it does not explicitly state that the tool returns a list of file paths, does not modify anything, or how defaults behave when no patterns are supplied.

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 focused sentence that front-loads the purpose, resource type, file extensions, and search method. No unnecessary 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 simple listing tool with two optional parameters and full schema coverage, the description is mostly complete. It clearly communicates what files are searched and how. The main gaps are the absence of explicit return-value information and default pattern behavior, but these are minor for this type of tool.

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 description coverage is 100%, and both parameters (patterns and ignore) already have meaningful descriptions. The tool description reinforces that glob patterns are involved and that .xml/.drawio files are the targets, but it does not add substantial new meaning beyond the 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 uses a specific verb ('Discover'), names the resource ('Draw.io architecture diagram files'), and lists the relevant file extensions and method ('glob patterns'). This clearly distinguishes it from sibling tools like convert_diagrams_read and convert_diagrams_write, which are about conversion rather than discovery.

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 gives clear context: use this when you need to find Draw.io diagram files in the workspace by glob patterns. It does not explicitly mention alternatives or exclusions, but the purpose is distinct enough from the convert siblings that an agent can infer when to choose this tool.

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.

  1. 3 tool updatesv1.0.0
    • First observedconvert_diagrams_read
    • First observedconvert_diagrams_write
    • First observedlist_diagrams

TDQS

A4.2/5.0

Scored across 3 tools

Disambiguation5/5

list_diagrams is clearly discovery-only, while the two convert tools are separated by output behavior: _write persists .md files to disk and _read returns content as AI context. There is no meaningful overlap between any pair.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in lowercase snake_case, using the same 'diagrams' resource. The _read/_write suffixes are a coherent way to distinguish output modes, and list_diagrams fits the pattern as an independent discovery action.

Tool Count5/5

Three tools is a well-scoped set for a focused converter utility: discover source files, convert to files, and convert to context. Each tool addresses a distinct workflow step without unnecessary expansion.

Completeness5/5

The core workflow of finding Draw.io diagrams and converting them to Mermaid Markdown is fully covered in both output modes (disk and context). No obvious dead ends or missing lifecycle operations are apparent for this narrow domain.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    A
    maintenance
    Enables AI agents to programmatically create, modify, and analyze Draw.io diagrams through the Model Context Protocol. Supports generating architectural diagrams, flowcharts, and visualizations with bidirectional communication between AI systems and Draw.io.
    13
    64 npm
    1,496
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Enables AI assistants to generate professional UML diagrams (class, use case, activity, sequence) from natural language descriptions, producing editable .drawio files compatible with diagrams.net.
    7
    64 npm
    ISC
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to create, read, update, and delete Draw.io diagrams, allowing automated generation of architectural diagrams, flowcharts, and visual documentation.
    64 npm
    MIT