diag2md-mcp
Officialdiag2md-mcp
Model Context Protocol (MCP) 服务器,为 AI 编码智能体提供 Draw.io C4 和 UML 架构约束以及图表转换能力。
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,避免子 shell 进程生成开销。
AI 上下文提供器(
convert_diagrams_read):动态读取并转换图表,在聊天会话期间直接为 AI 编码助手提供丰富的架构上下文。批量图表同步(
convert_diagrams_write):通过在图表源文件旁生成.md文件,使架构文档保持最新。
Related MCP server: drawio-mcp
快速开始
通过 npx 运行
你可以直接运行 MCP 服务器,无需预先安装:
npx -y diag2md-mcp全局安装
npm install -g diag2md-mcpMCP 服务器配置
要将 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 个核心工具:
工具名称 | 描述 | 参数 |
| 发现工作区中与 glob 模式匹配的所有 Draw.io 架构图表文件( |
|
| 批量扫描与 glob 模式匹配的工作区图表文件,进行转换,并将更新后的 |
|
| 批量扫描工作区图表文件,并直接将转换后的 Mermaid Markdown 作为上下文返回给 AI 助手。 |
|
服务器配置
MCP 服务器设置可以通过环境变量进行自定义:
环境变量 | 描述 | 默认值 |
| 用于发现图表文件的逗号分隔 glob 模式。 |
|
| 文件发现期间要忽略的逗号分隔 glob 模式。 |
|
| 默认转换图表类型( |
|
使用 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许可证
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityAmaintenanceEnables 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.13741,443MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to create, read, and edit draw.io diagrams with live preview in VS Code.21742MIT
- FlicenseNot gradedqualityFmaintenanceEnables AI assistants to create, read, and manage Draw.io diagrams programmatically through natural language interactions.1
- AlicenseAqualityBmaintenanceEnables AI assistants to generate professional UML diagrams (class, use case, activity, sequence) from natural language descriptions, producing editable .drawio files compatible with diagrams.net.774ISC
Related MCP Connectors
Let Claude, Cursor, or ChatGPT author Mermaid diagrams your team can read and share.
Generate dynamic Mermaid diagrams and charts with AI assistance. Customize styles and export diagr…
AI Agent with Architectural Memory. Impact analysis (free), tests and code from the graph (pro).
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/diag2md/diag2md-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server