MCP server for generating infrastructure and architecture diagrams as code using the Python diagrams library.
5 Diagram Tools for infrastructure, architecture, and flowcharts:
- Infrastructure Diagrams - 15+ providers (AWS, Azure, GCP, K8s, On-Prem, SaaS)
- 500+ Node Types - Compute, database, network, storage, security
- Custom Icons - Web URLs (HTTPS) and local files
- Flowcharts - 24 shapes for process diagrams
- Validation - Dry-run before generation
Advanced Capabilities:
- Multiple output formats (PNG, PDF, JPG, DOT)
- Cluster grouping with unlimited nesting
- Edge styling (colours, labels, line styles)
- Graphviz attribute customisation
System Requirements:
- Graphviz must be installed:
- macOS:
brew install graphviz - Ubuntu/Debian:
sudo apt-get install graphviz - Windows: Download from https://graphviz.org/download/
- macOS:
Add to your claude_desktop_config.json:
For published package:
{
"mcpServers": {
"diagrams": {
"command": "uvx",
"args": ["diagrams-mcp"]
}
}
}For local development:
{
"mcpServers": {
"diagrams:local": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/diagrams-mcp",
"run",
"diagrams-mcp"
]
}
}
}Quick setup (CLI):
Published package:
claude mcp add --transport stdio math -- uvx diagrams-mcpLocal development:
claude mcp add --transport stdio math -- uvx --from /absolute/path/to/diagrams-mcp diagrams-mcpTeam setup (project-level):
Add .mcp.json to your project root:
{
"mcpServers": {
"diagrams": {
"command": "uvx",
"args": ["diagrams-mcp"]
}
}
}Verify installation:
claude mcp listOr check in IDE: View → MCP Servers, or use /mcp command.
Once installed, try these prompts:
- "Create an AWS 3-tier web application diagram with Route53, ELB, EC2 instances, and RDS"
- "Generate a Kubernetes microservices architecture with ingress, services, and pods"
- "Build a flowchart for a CI/CD pipeline with decision points"
- "Create a diagram using a custom icon from my company logo URL"
- "Show me all available AWS compute nodes"
Map to tools: create_diagram, create_diagram_with_custom_icons, create_flowchart, list_available_nodes, validate_diagram_spec
All tool parameters and descriptions are available in your IDE's autocomplete.
| Tool | Description |
|---|---|
create_diagram |
Full infrastructure/architecture diagrams with all providers |
create_diagram_with_custom_icons |
Diagrams with custom node icons from URLs or local files |
create_flowchart |
Simplified flowchart creation with 24 process shapes |
| Tool | Description |
|---|---|
list_available_nodes |
Search 500+ available nodes by provider, category, or keyword |
validate_diagram_spec |
Dry-run validation before generation |
- HTTPS-only (HTTP rejected)
- 5MB file size limit
- 5-second download timeout
- Image format validation (PNG, JPG)
- Automatic caching (~/.diagrams_mcp/icon_cache)
- Path validation (file must exist)
- Format validation
- Sandboxed execution
# Run all tests
uv run poe testSTDIO mode (for Claude Desktop integration):
uv run diagrams-mcpHTTP mode (for containerised deployments):
uv run diagrams-mcp-http --port 8000MIT License. See LICENSE file for details.
Contributions welcome via PRs! Please ensure:
- Tests pass, and new ones are added if applicable
- Code is linted & formatted
- Type hints are included
- Clear, actionable error messages are provided
For issues and questions, please open an issue on GitHub.