Skip to main content
Glama

diag2md-mcp

Model Context Protocol (MCP)-Server, der KI-Codierungsagenten Draw.io-C4- und UML-Architektur-Leitplanken sowie Diagrammkonvertierungsfunktionen bereitstellt.

GitHub Release License: MIT TypeScript

diag2md-mcp verbindet Draw.io-Architekturdiagramme (.xml, .drawio) mit KI-Codierungsagenten (wie Antigravity, Cursor, Claude Desktop und VS Code-MCP-Clients), indem es C4- und UML-Diagramme in Echtzeit in strukturiertes Mermaid-Markdown konvertiert.

Angetrieben von diag2md.


Hauptfunktionen

  • Automatische Workspace-Erkennung: Durchsucht Projektverzeichnisse nach Draw.io-Diagrammdateien, die konfigurierbaren Glob-Mustern entsprechen (**/architecture/**/*.xml, **/*.drawio).

  • Hochleistungs-In-Memory-Konvertierung: Konvertiert Draw.io-XML-Modelle in Mermaid-Markdown für C4 und UML im Arbeitsspeicher, ohne den Overhead durch das Starten von Subshell-Prozessen.

  • KI-Kontextanbieter (convert_diagrams_read): Liest und konvertiert Diagramme dynamisch, um KI-Codierungsassistenten während Chat-Sitzungen direkt umfangreichen Architekturkontext bereitzustellen.

  • Batch-Diagrammsynchronisierung (convert_diagrams_write): Hält die Architekturdokumentation aktuell, indem .md-Dateien neben den Diagrammquellen erzeugt werden.


Related MCP server: drawio-mcp

Schnellstart

Ausführen über npx

Sie können den MCP-Server direkt ausführen, ohne ihn vorab zu installieren:

npx -y diag2md-mcp

Globale Installation

npm install -g diag2md-mcp

MCP-Server-Konfiguration

Um diag2md-mcp mit Ihrem bevorzugten KI-Assistenten oder MCP-Client zu verbinden, fügen Sie den Server zu Ihrer Client-Konfigurationsdatei hinzu (z. B. mcp_config.json, claude_desktop_config.json, Cursor- oder Antigravity-MCP-Einstellungen).

Empfohlen (Global installiertes Paket)

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

Alternative: Lokal erstellte Quelle

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

Alternative: Bei Bedarf über npx

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

MCP-Tools-Referenz

diag2md-mcp stellt KI-Codierungsagenten 3 Kern-Tools zur Verfügung:

Tool-Name

Beschreibung

Argumente

list_diagrams

Findet alle Draw.io-Architekturdiagrammdateien (.xml, .drawio) im Workspace, die Glob-Mustern entsprechen.

patterns (optional string[]), ignore (optional string[])

convert_diagrams_write

Scannt Workspace-Diagrammdateien, die Glob-Mustern entsprechen, im Batch-Modus, konvertiert sie und schreibt aktualisierte .md-Dateien auf die Festplatte.

patterns (optional string[]), diagramType (optional "c4" | "uml")

convert_diagrams_read

Scannt Workspace-Diagrammdateien im Batch-Modus und gibt konvertiertes Mermaid-Markdown direkt als Kontext für den KI-Assistenten zurück.

patterns (optional string[]), diagramType (optional "c4" | "uml")


Server-Konfiguration

Die MCP-Server-Einstellungen können über Umgebungsvariablen angepasst werden:

Umgebungsvariable

Beschreibung

Standardwert

DIAG2MD_PATTERNS

Kommagetrennte Glob-Muster zum Ermitteln von Diagrammdateien.

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

DIAG2MD_IGNORE

Kommagetrennte Glob-Muster, die bei der Dateisuche ignoriert werden.

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

DIAG2MD_TYPE

Standarddiagrammtyp für die Konvertierung (c4 oder uml).

c4

Konfigurationsbeispiel mit env-Mustern

Sie können benutzerdefinierte Suchmuster direkt in Ihrer MCP-Server-JSON-Konfiguration über den env-Block konfigurieren:

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

Beispiel für dynamische Tool-Aufrufe mit patterns

KI-Assistenten oder Tools können Suchmuster auch pro Anfrage dynamisch überschreiben:

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

Entwicklung

# 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

Lizenz

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