Skip to main content
Glama

Diagrams MCP Server

MCP server for generating infrastructure and architecture diagrams as code using the Python diagrams library.

Python 3.11+ License: MIT Smithery

Features

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

Related MCP server: diagrams-mcp

Installation

System Requirements:

  • Graphviz must be installed:

IDEs

Install in VS Code

Install MCP Server

Claude Desktop

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"
      ]
    }
  }
}

Claude Code

Quick setup (CLI):

Published package:

claude mcp add --transport stdio math -- uvx diagrams-mcp

Local development:

claude mcp add --transport stdio math -- uvx --from /absolute/path/to/diagrams-mcp diagrams-mcp

Team setup (project-level):

Add .mcp.json to your project root:

{
  "mcpServers": {
    "diagrams": {
      "command": "uvx",
      "args": ["diagrams-mcp"]
    }
  }
}

Verify installation:

claude mcp list

Or check in IDE: View → MCP Servers, or use /mcp command.

Try It

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

Tool Reference

All tool parameters and descriptions are available in your IDE's autocomplete.

Diagram Generation (3 tools)

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

Discovery & Validation (2 tools)

Tool

Description

list_available_nodes

Search 500+ available nodes by provider, category, or keyword

validate_diagram_spec

Dry-run validation before generation

Custom Icons

Web URL Icons

  • HTTPS-only (HTTP rejected)

  • 5MB file size limit

  • 5-second download timeout

  • Image format validation (PNG, JPG)

  • Automatic caching (~/.diagrams_mcp/icon_cache)

Local File Icons

  • Path validation (file must exist)

  • Format validation

  • Sandboxed execution

Development

Running Tests

# Run all tests
uv run poe test

Development Modes

STDIO mode (for Claude Desktop integration):

uv run diagrams-mcp

HTTP mode (for containerised deployments):

uv run diagrams-mcp-http --port 8000

License

MIT License. See LICENSE file for details.

Contributing

Contributions welcome via PRs! Please ensure:

  1. Tests pass, and new ones are added if applicable

  2. Code is linted & formatted

  3. Type hints are included

  4. Clear, actionable error messages are provided

Support

For issues and questions, please open an issue on GitHub.

Available Tools

5 tools
create_diagramA
Idempotent

Generate infrastructure diagrams with 15+ providers (AWS, Azure, GCP, K8s, etc.).

Examples: AWS: nodes=[{"id":"r53","provider":"aws","category":"network","type":"Route53",...}] K8s: nodes=[{"id":"ing","provider":"k8s","category":"network","type":"Ingress",...}] Clusters: clusters=[{"name":"VPC","node_ids":["elb","ec2"],"graph_attr":{"bgcolor":"#E5F5FD"}}]

⚠️ CRITICAL: Node types must exist in diagrams library or diagram fails silently (no arrows). ALWAYS verify first: list_available_nodes(provider="aws", category="compute") For brands (Stripe, Vercel), use create_diagram_with_custom_icons instead.

Inputs: name (required), nodes (required), connections (required), clusters, +9 more. Returns: result

create_diagram_with_custom_iconsA
Idempotent

Create diagrams with custom icons from web URLs or local files.

USE WHEN: Brand logos (Stripe, Vercel, Supabase, Fly.io) not in diagrams library. GitHub avatars work well: https://avatars.githubusercontent.com/u/{org_id}

Examples: URL: custom_nodes=[{"id":"stripe","icon_source":"url","icon_path":"https://avatars.githubusercontent.com/u/856813"}] Mixed: nodes=[{...AWS nodes...}], custom_nodes=[{...}], connections=[...]

HTTPS-only for URLs, 5MB limit, PNG/JPG supported. Automatic caching.

Inputs: name (required), custom_nodes (required), connections (required), nodes, +7 more. Returns: result

create_flowchartB
Idempotent

Create process flowcharts with 24 shapes (StartEnd, Process, Decision, etc.).

Example: steps=[{"id":"start","shape":"StartEnd","label":"Start"},...] flows=[{"from_step":"start","to_step":"check"},...]

Inputs: name (required), steps (required), flows (required), direction, +4 more. Returns: result

list_available_nodesA
Read-onlyIdempotent

Discover 500+ node types across providers.

⚠️ USE THIS FIRST before create_diagram to avoid invalid node errors.

Filters: provider, category, search_term

Examples: AWS compute: provider="aws", category="compute" → EC2, Lambda, ECS, EKS... Search DBs: search_term="db" → RDS, DynamoDB, SQL across providers

Inputs: provider, category, search_term, limit. Returns: result

validate_diagram_specA
Read-onlyIdempotent

Validate diagram before generation (dry-run).

Checks: node validity, connection references, cluster memberships. Returns: {"valid": true/false, "errors": [...], "warnings": [...]}

Inputs: nodes (required), connections (required), clusters. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: create_diagram for standard infrastructure diagrams, create_diagram_with_custom_icons for diagrams with custom icons, create_flowchart for process flowcharts, list_available_nodes for discovery, and validate_diagram_spec for validation. The descriptions explicitly differentiate when to use each tool, with clear boundaries between them.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with snake_case: create_diagram, create_diagram_with_custom_icons, create_flowchart, list_available_nodes, validate_diagram_spec. The naming is predictable and readable throughout the set.

    Tool Count5/5

    With 5 tools, this server is well-scoped for diagram creation and management. Each tool earns its place by covering distinct aspects: diagram generation (2 tools), flowchart creation, node discovery, and validation. This count is appropriate for the domain without being too sparse or bloated.

    Completeness4/5

    The tool set covers the core diagram creation workflow comprehensively: discovery (list_available_nodes), validation (validate_diagram_spec), and generation for both infrastructure diagrams and flowcharts. A minor gap exists in lacking update or delete operations for existing diagrams, but agents can work around this by regenerating diagrams as needed.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers