Draw Architecture
About
Generate draw.io system architecture diagrams from text descriptions using the ZhipuAI large model.
Details
- Author
- dwgeneral
- Categories
- Developer Tools, AI, Knowledge Base
Jump to
Setup
Install Draw Architecture in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/dwgeneral/draw_architecture_mcp
Follow the installation instructions in the repository README, then restart your MCP client.
一个专业的架构图绘制 MCP 服务器,集成智谱AI大模型,能够根据文本描述自动生成 draw.io 格式的系统架构图。
- 🤖AI 驱动生成:集成智谱AI免费大模型,智能理解架构需求
- 🎨智能架构图生成:根据文本描述自动生成专业的系统架构图
- 📊Draw.io 兼容:生成标准的 .drawio 格式文件,可直接导入 draw.io 编辑
- 🏗️多种架构模式:支持微服务、分层架构、事件驱动等多种架构模式
- 🎯专业提示词:内置专业的架构设计提示词模板
- 🔧MCP 协议:基于 Model Context Protocol,可与支持 MCP 的 AI 助手集成
- 💰免费使用:使用智谱AI的免费额度,无需付费即可体验
- Python 3.8+
- 支持 MCP 的 AI 客户端(如 Claude Desktop、Cline 等)
# 克隆或下载项目 cd draw_architecture_mcp # 安装依赖 pip install -r requirements.txt
- 访问智谱AI开放平台
- 注册账号并登录
- 在控制台获取API Key(新用户有免费额度)
# 复制环境变量模板 cp .env.example .env # 编辑 .env 文件,填入你的API Key echo "ZHIPUAI_API_KEY=your_actual_api_key_here" > .env
macOS:~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:%APPDATA%\Claude\claude_desktop_config.json
{ "mcpServers": { "draw-architecture": { "command": "python3", "args": ["/path/to/draw_architecture_mcp/mcp_server.py"], "env": { "PYTHONPATH": "/path/to/draw_architecture_mcp", "ZHIPUAI_API_KEY": "your_api_key_here" } } } }
{ "mcpServers": { "draw-architecture": { "command": "python3", "args": ["/path/to/draw_architecture_mcp/mcp_server.py"], "env": { "ZHIPUAI_API_KEY": "your_api_key_here" } } } }
重启 AI 客户端,在对话中询问是否可以使用架构图生成功能。如果配置正确,AI 助手应该能够访问以下工具:
- generate_architecture_diagram: 生成架构图
- get_architecture_prompt: 获取提示词模板
- validate_drawio_file: 验证文件格式
请帮我绘制一个电商系统的架构图,包括: - 前端:Web应用、移动App - 后端:用户服务、商品服务、订单服务 - 数据库:MySQL、Redis - 消息队列:Kafka
绘制一个微服务架构的在线教育平台: 前端层: - React Web应用 - Flutter移动应用 - 管理后台 网关层: - API网关(Kong) - 负载均衡(Nginx) 业务服务层: - 用户认证服务 - 课程管理服务 - 视频播放服务 - 支付服务 - 消息通知服务 数据层: - MySQL(用户数据、课程数据) - MongoDB(视频元数据) - Redis(缓存、会话) - Elasticsearch(搜索) 基础设施: - Docker容器化 - Kubernetes编排 - 监控(Prometheus + Grafana) - 日志(ELK Stack)
- 智谱AI GLM-4-Flash:免费的大语言模型,专门优化架构图生成
- 专业提示词模板:内置完整的架构设计指导模板
- 智能回退机制:AI调用失败时自动回退到规则引擎
- 需求分析:解析用户的架构描述
- 模板整合:将用户需求与专业提示词模板结合
- AI生成:调用智谱AI生成完整的draw.io XML代码
- 格式验证:确保生成的XML符合draw.io标准
- 文件保存:保存为.drawio格式文件
- 分层架构(Layered Architecture)
- 微服务架构(Microservices)
- 事件驱动架构(Event-Driven)
- 六边形架构(Hexagonal)
- CQRS架构
- 服务网格(Service Mesh)
AI 助手会使用generate_architecture_diagram工具生成对应的 draw.io 文件。
- description(string, 必需): 架构描述
- diagram_name(string, 可选): 图表名称,默认为"系统架构图"
- output_file(string, 可选): 输出文件路径
{ "description": "微服务架构,包含用户服务、订单服务、支付服务", "diagram_name": "电商系统架构", "output_file": "./ecommerce_architecture.drawio" }
draw_architecture_mcp/ ├── mcp_server.py # MCP 服务器主文件 ├── draw_architecture_prompt.md # 提示词模板 ├── requirements.txt # Python 依赖 ├── mcp_config.json # MCP 配置示例 ├── README.md # 项目文档 └── examples/ # 示例文件 ├── sample_architecture.drawio └── usage_examples.md
# 安装开发依赖 pip install -r requirements.txt # 运行测试 pytest tests/ # 代码格式化 black mcp_server.py # 类型检查 mypy mcp_server.py
- 添加新的图表类型: 在generate_drawio_xml函数中添加新的模板
- 增强验证功能: 在validate_drawio_file工具中添加更多检查项
- 支持更多格式: 添加导出为 PNG、SVG 等格式的功能
A: 使用validate_drawio_file工具检查文件格式,常见问题包括:
A: 修改mcp_server.py中的generate_drawio_xml函数,调整颜色、字体、布局等样式参数。
- Claude Desktop
- Cline (VS Code 扩展)
- 其他支持 MCP 的 AI 工具
- Fork 项目
- 创建功能分支 (git checkout -b feature/amazing-feature)
- 提交更改 (git commit -m 'Add amazing feature')
- 推送到分支 (git push origin feature/amazing-feature)
- 创建 Pull Request
- 项目主页:GitHub Repository
- 问题反馈:Issues
- 功能建议:Discussions
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
Automatically generates documentation for code repositories by analyzing directory structures and code files using the OpenRouter API.
A coding assistant server that provides context-aware code suggestions, documentation integration, and technology detection.
Provides educational content, model information, and read-only API interactions for Lerian developers.
Integrates LLM applications with documentation sources using the Model Context Protocol.
An MCP server for query generation and documentation assistance using Claude AI.
Search Metal Framework documentation and generate code.
A lightweight Model Context Protocol (MCP) server that brings RAG (Retrieval-Augmented Generation) capabilities to your LLM over Markdown documentation stored on S3.
Analyzes source code to generate UML and flow diagrams with AI-powered explanations.
An MCP server providing searchable access to multiple AI/ML SDK documentation and source code.
Manage user feedback, roadmap, changelog and user surveys all from your favorite LLM
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





