Skip to main content
Glama

diag2md-mcp

AIコーディングエージェントにDraw.io C4およびUMLアーキテクチャのガードレールと変換機能を提供するModel Context Protocol (MCP)サーバー。

GitHub Release License: MIT TypeScript

diag2md-mcp は、C4およびUMLダイアグラムをリアルタイムに構造化されたMermaid Markdownへ変換することで、Draw.ioアーキテクチャ図(. xml、. drawio)とAIコーディングエージェント(Antigravity、Cursor、Claude Desktop、VS Code MCPクライアントなど)を橋渡しします。

提供: diag2md。


主な機能

  • 自動ワークスペース検出: 設定可能なglobパターン(**/architecture/**/*.xml、**/*.drawio)に一致するDraw.ioダイアグラムファイルをプロジェクトディレクトリからスキャンします。

  • 高性能インメメモリ変換: サブシェルプロセス起動のオーバーヘッドなしに、Draw.io XMLモデルをインメメモリでMermaid C4 & UML Markdownに変換します。

  • AIコンテキストプロバイダー (convert_digrams_read): ダイアグラムを動的に読み取って変換し、チャットセッション中にAIコーディングアシスタントへリッチなアーキテクチャコンテキストを直接提供します。

  • ダイアグラム一括同期 (convert_digrams_write): ダイアグラムソースと一緒に.mdファイルを生成することで、アーキテクチャドキュメントを最新の状態に保ちます。


Related MCP server: drawio-mcp

クイックスタート

npx での実行

MCPサーバーは事前インストールなしで直接実行できます:

npx -y diag2md-mcp

グローバルインストール

npm install -g diag2md-mcp

MCPサーバー設定

diag2md-mcp をお気に入りのAIアシスタントやMCPクライアントに接続するには、クライアント設定ファイル(例: mcp_config.json、claude_desktop_config.json、Cursor、AntigravityのMCP設定)にサーバーを追加します。

推奨(グローバルインストール済みパッケージ)

{
  "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 はAIコーディングエージェントに3つのコアツールを公開しています:

Tool Name

Description

Arguments

list_diagrams

ワークスペース内でglobパターンに一致するすべてのDraw.ioアーキテクチャ図ファイル(.xml、.drawio)を検出します。

patterns (任意の string[]), ignore (任意の string[])

convert_diagrams_write

globパターンに一致するワークスペースのダイアグラムファイルを一括スキャンし、変換して、更新された.mdファイルをディスクに書き込みます。

patterns (任意の string[]), diagramType (任意の "c4" | "uml")

convert_diagrams_read

ワークスペースのダイアグラムファイルを一括スキャンし、変換されたMermaid MarkdownをAIアシスタント向けのコンテキストとして直接返します。

patterns (任意の string[]), diagramType (任意の "c4" | "uml")


サーバー設定

MCPサーバーの設定は環境変数でカスタマイズできます:

Environment Variable

Description

Default Value

`DIAG2MD_PATTERNS`

ダイアグラムファイルを検出するためのカンマ区切りのglobパターン。

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

`DIAG2MD_IGNORE`

ファイル検出時に無視するカンマ区切りのglobパターン。

`/node_mdules/, /dist/, /. git/`

`DIAG2MD_TYPE`

デフォルトの変換ダイアグラムタイプ(`c4` または `uml`)。

`c4`

`env` パターンを使用した設定例

MCPサーバーのJSON設定で`env`ブロックを使用すると、カスタム検索パターンを直接設定できます:

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

`patterns` を使用した動的ツール呼び出し例

AIアシスタントやツールは、リクエストごとに検索パターンを動的に上書きすることもできます:

{
  "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.

Inputs: patterns, diagramType.

convert_diagrams_writeA

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

Inputs: patterns, diagramType.

list_diagramsA

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

Inputs: ignore, patterns.

Tool Schema Changelog

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

Loading tool schema changelog…

    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.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      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
      1,500
      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
      109 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.
      MIT