Azure图表生成服务

该服务通过Python代码自动生成Microsoft Azure架构图、序列图、流程图和类图,适用于需要快速绘制云架构图的用户。

  • by DeepMalh44
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 DeepMalh44/azure-diagram-mcp

使用说明

用于Microsoft Azure关系图的模型上下文协议(MCP)服务器

此工具允许您自动创建Microsoft Azure架构图。 您编写一个简短的描述(使用Visual Studio Code中的GitHub Copilot生成它),服务器会将其转换为图表图像。 它非常适合那些想要快速绘制云图而无需拖动形状的人。

包含什么

此MCP服务器无缝创建 图表 使用Python图表包DSL。 此服务器允许您使用Python代码生成Microsoft Azure图、序列图、流程图和类图。

它做什么

  • 将一个简单的英语句子变成一个干净的Azure架构图(PNG)。
  • 使用Python diagrams 包和Azure图标在幕后。
  • 将图像保存到 diagrams/ 此项目中的文件夹。

特性

图表MCP服务器提供以下功能:

  1. 生成图表:使用Python代码创建Azure图表
  2. 多种图表类型:支持Azure架构、序列图、流程图、类图等
  3. 定制:自定义图表外观、布局和样式

你需要什么

  1. Visual Studio Code 安装→ 点击此处下载
  2. GitHub Copilot → 在此处启用
  3. python → 我们将按照以下步骤进行安装
  4. GraphViz (一个实际绘制图表的小程序)→ 点击此处下载 别担心,我们会一步一步走的!

设置步骤或使用.devcontainer

1.安装Python

打开终端(命令提示符、PowerShell或VS代码终端)并运行:

winget install Python.Python.3.10

⚠️ 确保将Python安装路径添加到系统的环境变量中,以便 python 在终端工作。
通常,安装程序会自动执行此操作,但如果不是,您可以按照以下步骤操作 引导.

2.安装GraphViz

从以下位置下载并安装: https://graphviz.org/download/ 在Windows上:选择MSI安装程序。 在Mac上:使用Homebrew(brew install graphviz).

3.获取MCP服务器

克隆此存储库(或下载ZIP并解压缩)。 然后打开它 VS Code.

在VS Code终端中,运行:

pip install -r requirements.txt

4.MCP配置

在MCP客户端配置中配置MCP服务器(例如,对于Visual Studio代码GitHub Copilot ~/.vscode/mcp.json):

{
  "mcpServers": {
    "Azure Diagram MCP Server": {
      "type": "stdio",
      "command": "python",
      "args": [
        "-m", "azure_diagram_mcp_server.server"
      ],
      "cwd": "PARENT_FOLDER_OF_CLONED_REPO",
    }
  }
}

或docker成功后 docker build -t azure-diagram-mcp-server .:

  {
    "mcpServers": {
      "Azure Diagram MCP Server": {
        "command": "docker",
        "args": [
          "run",
          "--rm",
          "--interactive",
          "--env",
          "azure-diagram-mcp-server:latest"
        ],
        "disabled": false,
        "autoApprove": []
      }
    }
  }

就是这样! 🎉 现在您已经安装了所有内容。

将其与GitHub Copilot一起使用

  1. 打开 VS Code GitHub Copilot Agent Mode

  2. 在聊天中键入以下内容:

    Generate an Azure Architecture Diagram with an Azure Function connected to a SQL Database through a Load Balancer
    
  3. GitHub Copilot将要执行MCP功能 generate_diagram。请点击 Allow 继续。

  4. A. PNG图像 将在中创建 diagrams 文件夹。打开它,欣赏你的Azure图表! 🚀

示例提示想法

  • Generate an Azure Architecture Diagram with an Azure Function connected to a SQL Database through a Load Balancer
  • Generate an Azure Architecture Diagram for a simple web app: Azure Front Door to App Service with Azure SQL
  • Generate an Azure Architecture Diagram to show an AKS cluster with Application Gateway and Azure SQL

示例图

Generate an Azure Architecture Diagram to show an AKS cluster with Application Gateway and Azure SQL

故障排除

  • 没有图像出现? 确保已安装GraphViz(请参阅步骤2)。
  • 副驾驶不跑? 确保GitHub Copilot扩展已启用,并且您允许它运行MCP函数。还要检查MCP服务器。
  • 还在卡住吗? 重新启动VS Code并重试。

✨ 就是这样!您现在可以创建 Azure图表(分钟) 只需几句话和GitHub Copilot。