Azure Diagram MCP Server
Integrates with GitHub Copilot SDK to enable natural language diagram generation using a custom agent.
Supports generating Kubernetes architecture diagrams with K8s-specific icons and components.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Azure Diagram MCP ServerGenerate an Azure diagram for a web app with Cosmos DB and Redis cache."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Azure Diagram MCP Server
An MCP server for generating professional infrastructure diagrams using the Python diagrams DSL — with first-class Azure support and GitHub Copilot SDK integration for natural language diagram generation.
graph LR
A[AI Assistant] -->|Natural Language| B[MCP Server]
B -->|Python DSL| C[Diagrams + Graphviz]
C -->|PNG| D[MCP Apps Viewer]
B -->|Security Scan| E[AST + Bandit]
E -->|Pass| CGetting Started
Step 1 — Install Prerequisites
Dependency | Install | Verify |
uv |
| |
Python 3.12+ |
|
|
Graphviz |
|
|
⚠️ Graphviz is required. Without it the MCP server will fail to start. Verify with
dot -Vbefore proceeding.
Step 2 — Verify the Server Starts
Run the server directly to confirm everything works:
uvx microsoft.azure-diagram-mcp-serverYou should see a message confirming the server is installed and ready. The server is an MCP stdio server — it's designed to be launched by an MCP client, not run directly. If it fails to install, check that Graphviz is installed (dot -V).
Step 3 — Connect to Your AI Host
Pick one of the methods below to register the server with your AI host.
Copilot CLI
Start a Copilot CLI session:
copilotInside the session, run the slash command:
/mcp addFill in the form (use Tab to move between fields):
Field
Value
Name
azure-diagramType
LocalCommand
uvx microsoft.azure-diagram-mcp-serverPress Ctrl+S to save.
Verify with
/mcp show azure-diagram— status should show ✓ Connected.
The config is saved to
~/.copilot/mcp-config.json. You can also edit that file directly:{ "servers": { "azure-diagram": { "type": "local", "command": "uvx microsoft.azure-diagram-mcp-server", "tools": ["*"] } } }
VS Code (one-click)
Or add manually to your VS Code settings.json:
{
"mcp": {
"servers": {
"azure-diagram": {
"command": "uvx",
"args": ["microsoft.azure-diagram-mcp-server"],
"env": {
"FASTMCP_LOG_LEVEL": "ERROR"
}
}
}
}
}Docker
docker build -t microsoft/azure-diagram-mcp-server .{
"mcp": {
"servers": {
"azure-diagram": {
"command": "docker",
"args": ["run", "--rm", "-i", "--env", "FASTMCP_LOG_LEVEL=ERROR",
"microsoft/azure-diagram-mcp-server:latest"]
}
}
}
}Related MCP server: fcp-drawio
Features
Feature | Description |
☁️ Azure-First | 100+ Azure service icons — App Service, Functions, Cosmos DB, AKS, and more |
🌐 Multi-Cloud | AWS, GCP, Kubernetes, on-premises, and custom icon support |
📊 Multiple Types | Architecture, sequence, flow, class, K8s, and custom diagrams |
🔒 Security Scanning | AST + Bandit code analysis before every execution |
🖼️ MCP Apps Viewer | Interactive diagram viewer with pan, zoom, download, and dark/light theme |
🤖 Copilot SDK | Natural language diagram generation via GitHub Copilot SDK |
Architecture
graph TB
subgraph "GitHub Copilot"
CLI[Copilot CLI]
VS[VS Code Copilot]
end
subgraph "MCP Server"
S[server.py<br/>FastMCP]
DT[diagram_tools.py<br/>Generation + Examples]
SC[scanner.py<br/>AST + Bandit]
V[viewer/app.html<br/>MCP Apps Viewer]
end
subgraph "Copilot SDK Layer"
CC[copilot_client.py<br/>DiagramCopilotClient]
AG[Custom Agent<br/>azure-diagram-architect]
end
CLI & VS -->|MCP stdio| S
CC -->|MCP local| S
AG --> CC
S --> DT
S --> V
DT --> SC
SC -->|Pass| DT
DT -->|Python DSL| GV[Graphviz → PNG]MCP Tools
Tool | Description |
| Execute Python diagram code with security scanning and timeout. Pre-imports all providers — just start with |
| Regenerate a diagram from updated code (app-only, used by the MCP Apps viewer). |
| Get example code by type: |
| Discover available icons by provider and service. Filter with |
Recommended Workflow
sequenceDiagram
participant User
participant Copilot as GitHub Copilot
participant MCP as MCP Server
participant App as MCP Apps Viewer
User->>Copilot: "Create an Azure web app diagram"
Copilot->>MCP: list_icons(provider_filter="azure")
MCP-->>Copilot: Available icons
Copilot->>MCP: get_diagram_examples(diagram_type="azure")
MCP-->>Copilot: Example code
Copilot->>MCP: generate_diagram(code="...")
MCP-->>Copilot: PNG + structuredContent
Copilot->>App: Render diagram in viewer
App-->>User: Interactive diagram with pan/zoomMCP Apps Viewer
The server includes an interactive MCP Apps viewer that renders diagrams inline in VS Code and the Copilot CLI. When generate_diagram returns a result, the viewer is automatically displayed.
graph LR
subgraph "MCP Server"
GD[generate_diagram] -->|CallToolResult| SC[structuredContent<br/>status + imageData]
SC --> META["_meta.ui.resourceUri<br/>ui://diagram-viewer/app.html"]
end
subgraph "MCP Apps Viewer"
META --> V[Interactive Viewer]
V --> PAN[Pan & Drag]
V --> ZOOM[Zoom In/Out]
V --> DL[Download PNG]
V --> THEME[Dark/Light Theme]
V --> FIT[Fit to View]
endFeature | Control |
Pan | Click and drag |
Zoom | Mouse wheel, |
Fit to view |
|
Download | Toolbar download button |
Theme | Toggle dark/light in toolbar |
The viewer is served as an MCP resource at ui://diagram-viewer/app.html and receives the diagram as base64-encoded PNG via structuredContent.imageData.
Quick Example
from diagrams import Diagram
from diagrams.azure.compute import AppServices, FunctionApps
from diagrams.azure.database import CosmosDb
from diagrams.azure.network import ApplicationGateway
with Diagram("Azure Web Architecture", show=False):
gateway = ApplicationGateway("Gateway")
app = AppServices("App Service")
functions = FunctionApps("Functions")
db = CosmosDb("Cosmos DB")
gateway >> app >> db
gateway >> functions >> dbCopilot SDK Integration
The server includes a GitHub Copilot SDK client that provides a natural language interface to diagram generation — describe what you want and the Copilot-powered architect generates it.
graph LR
U[User Prompt] --> CC[DiagramCopilotClient]
CC -->|Creates Session| CS[CopilotClient]
CS -->|Connects| MCP[Diagram MCP Server]
CS -->|Uses| AG[azure-diagram-architect<br/>Custom Agent]
MCP -->|Returns| IMG[PNG Diagram]Interactive CLI
uv run microsoft.azure-diagram-copilotProgrammatic Usage
import asyncio
from microsoft.azure_diagram_mcp_server.copilot_client import DiagramCopilotClient
async def main():
async with DiagramCopilotClient(model="gpt-4.1") as client:
client.on_delta(lambda delta: print(delta, end="", flush=True))
client.on_idle(lambda: print())
await client.generate(
"Create a 3-tier Azure architecture with App Gateway, "
"App Service, and Cosmos DB"
)
asyncio.run(main())BYOK (Bring Your Own Key)
Use your own LLM provider — no Copilot subscription required:
Variable | Description |
|
|
| API endpoint URL |
| API key |
|
|
| Model override (default: |
| Azure API version (default: |
export DIAGRAM_COPILOT_PROVIDER_TYPE=azure
export DIAGRAM_COPILOT_BASE_URL=https://your-resource.openai.azure.com
export DIAGRAM_COPILOT_API_KEY=your-api-key
uv run microsoft.azure-diagram-copilotResumable Sessions
client = DiagramCopilotClient(session_id="my-project-diagrams")
await client.start()
await client.generate("Create an Azure web app diagram")
# Resume later
await client.resume("my-project-diagrams")
await client.generate("Add a Redis cache to the previous diagram")
await client.stop()Development
# Setup
uv sync --group dev
# Test (140 tests, 9 skip without Graphviz)
uv run pytest tests/ -v
# Lint + format
uv run ruff check microsoft/ tests/
uv run ruff format --check microsoft/ tests/
# Type check
uv run pyright
# Coverage
uv run pytest --cov=microsoft --cov-report=term-missing tests/See AGENTS.md for comprehensive contributor documentation covering architecture, conventions, testing patterns, CI/CD, and the GitHub Pages docs site.
Documentation
📖 microsoft.github.io/diagrams-mcp-server — Full documentation built with VitePress, deployed via GitHub Pages.
cd docs-site && npm install && npm run docs:dev # Local dev serverLicense
This project is licensed under the MIT License — see the LICENSE file for details.
Contributing
This project welcomes contributions and suggestions. See AGENTS.md for the full development guide.
Available Tools
4 toolsgenerate_diagramB
Generate a diagram from Python code using the diagrams package DSL.
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python code using the diagrams package DSL to generate a diagram. Must contain a Diagram() call. | |
| filename | No | Optional output filename for the generated diagram (without extension). | |
| timeout | No | Timeout in seconds for diagram generation (1-300). | |
| workspace_dir | No | Optional workspace directory for output files. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the burden. It mentions that the code must contain a Diagram() call, but does not disclose potential errors, execution constraints, or side effects beyond the schema.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that is concise and front-loaded, containing no unnecessary words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (code execution, file output, timeout), the description is minimal. It does not address return values, error handling, or execution environment, leaving gaps for an agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The description adds no additional semantic value beyond the schema's parameter descriptions, but it reinforces the overall purpose.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action 'Generate' and the resource 'diagram from Python code using the diagrams package DSL'. It distinguishes from sibling tools like get_diagram_examples and list_icons, which serve different purposes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description does not provide any guidance on when to use this tool versus alternatives, nor does it mention prerequisites or exclusions. The agent must infer usage from context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_diagram_examplesC
Get example diagram code for the specified diagram type.
| Name | Required | Description | Default |
|---|---|---|---|
| diagram_type | No | The type of diagram examples to retrieve. Options: azure, sequence, flow, class, k8s, onprem, custom, all. | all |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations exist, so the description bears full responsibility. It indicates a read operation ('Get'), but lacks details on safety, idempotency, or error behavior. Minimal transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence with no extraneous words. Every word serves a purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema, the description should clarify return format. It only says 'example diagram code' without specifying structure, completeness, or example nature.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already describes the parameter with 100% coverage. The description adds no extra semantic value beyond referencing the type.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool retrieves example diagram code for a specified type. It distinguishes from siblings like generate_diagram (which creates) and list_icons (which lists icons), but does not explicitly differentiate.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives, nor any exclusions or contextual hints. The agent is left without context for decision-making.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_iconsB
List available diagram icons organized by provider and service.
| Name | Required | Description | Default |
|---|---|---|---|
| provider_filter | No | Optional filter to narrow results by provider name (e.g. azure, k8s, onprem). | |
| service_filter | No | Optional filter to narrow results by service name (e.g. compute, database, network). |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must cover behavioral traits. It only states the tool lists icons, lacking details on read-only nature, sort order, or any constraints.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, direct sentence with no superfluous words, effectively conveying the core functionality.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema, the description omits return format details (e.g., flat vs. hierarchical list) and pagination. This leaves gaps for an agent to understand the full result structure.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Both parameters have schema descriptions covering filter options. The description reiterates 'organized by provider and service' but adds no meaningful extra information beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool lists diagram icons organized by provider and service, which distinguishes it from sibling tools that generate or refresh diagrams.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this tool versus alternatives. The context of sibling tools suggests it is for browsing available icons, but no when-not or prerequisites are mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
refresh_diagramC
Regenerate a diagram from updated code (app-only tool).
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python code using the diagrams package DSL to regenerate a diagram. | |
| filename | No | Optional output filename for the generated diagram (without extension). | |
| timeout | No | Timeout in seconds for diagram generation (1-300). | |
| workspace_dir | No | Optional workspace directory for output files. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations are empty, so description must bear full burden. It mentions 'regenerate' implying mutation, but does not disclose side effects (e.g., overwriting files), required permissions, failure modes, or dependencies on existing diagrams. Very limited behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence, front-loaded with verb and object, includes scope constraint. No wasted words; information density is optimal for a simple tool.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
No output schema exists, yet description omits what the tool returns (e.g., file path, success status). Also lacks explanation of the 'app-only' constraint. Given the tool's simplicity, more context on return value and environment assumptions would be expected.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so each parameter is already documented. Description adds no extra meaning beyond the schema fields. Baseline score of 3 is appropriate as it does not enhance parameter understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states the action ('Regenerate a diagram') and resource ('diagram'), and adds context ('from updated code', 'app-only tool'). It hints at a specific use case compared to sibling 'generate_diagram' but does not explicitly differentiate regeneration from initial generation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives like 'generate_diagram'. The term 'app-only' is ambiguous and does not clarify prerequisites or scenarios where this tool is appropriate. No exclusion criteria or usage context beyond the name.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
4 tool updates
v0.1.1- First observed
generate_diagram - First observed
get_diagram_examples - First observed
list_icons - First observed
refresh_diagram
TDQS
Each tool has a distinct purpose: generating diagrams, fetching examples, listing icons, and refreshing. No overlap in functionality.
All tool names follow a consistent verb_noun pattern using snake_case, making the set predictable and easy to navigate.
With 4 tools, the set is well-scoped for generating and managing diagrams, though slightly thin for a full lifecycle.
Core operations are covered, but missing features like editing, exporting, or deleting diagrams create gaps that agents may need to work around.
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 Connectors
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
Official Microsoft MCP Server to query Microsoft Entra data using natural language
An MCP server that integrates with Discord to provide AI-powered features.
MCP server for generating rough-draft project plans from natural-language prompts.
Related MCP Servers
- AlicenseBqualityAmaintenanceAn MCP server that generates beautiful Excalidraw architecture diagrams with perfect auto-layout, stateful editing, and architecture-aware component styling.26148MIT
- AlicenseBqualityBmaintenanceMCP server that enables LLMs to create and edit draw.io diagrams using high-level intent commands, with automatic layout and styling.4174MIT
- AlicenseNot gradedqualityCmaintenanceProfessional AI-powered architecture diagram generator with multi-cloud support and MCP server integration. Generates beautiful, accurate diagrams with provider-specific icons for AWS, Azure, GCP, Kubernetes, and more.10MIT
- FlicenseAqualityBmaintenanceAn MCP server that generates standalone SVG architecture diagrams from text descriptions, running entirely on your machine with no dependencies or network access.8-
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/Jah-yee/diagrams-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server