Skip to main content

An MCP server that seamlessly creates infrastructure diagrams for any cloud provider using the Python diagrams package DSL

Project description

Infrastructure Diagram MCP Server

PyPI version License

Model Context Protocol (MCP) server for Multi-Cloud Infrastructure Diagrams

This MCP server seamlessly creates diagrams using the Python diagrams package DSL. Generate professional infrastructure diagrams for any cloud provider (AWS, GCP, Azure), Kubernetes, on-premises, hybrid, and multi-cloud architectures using natural language with Claude Desktop or other MCP clients.

Note: This is a derivative work based on awslabs/aws-diagram-mcp-server, extended with multi-cloud provider support and enhanced features.

Prerequisites

  1. Install GraphViz - Required for diagram generation
  2. Install uv from Astral (recommended) or use pip

Installation

The package is available on PyPI and can be installed using uvx or pip:

# Using uvx (recommended - no installation needed)
uvx infrastructure-diagram-mcp-server

# Or install with pip
pip install infrastructure-diagram-mcp-server

MCP Client Configuration

Configure the MCP server in your MCP client:

Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "infrastructure-diagrams": {
      "command": "uvx",
      "args": ["infrastructure-diagram-mcp-server"],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR"
      }
    }
  }
}

Other MCP Clients (e.g., Kiro - ~/.kiro/settings/mcp.json):

{
  "mcpServers": {
    "infrastructure-diagrams": {
      "command": "uvx",
      "args": ["infrastructure-diagram-mcp-server"],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR"
      },
      "autoApprove": [],
      "disabled": false
    }
  }
}

Windows Installation

For Windows users:

{
  "mcpServers": {
    "infrastructure-diagrams": {
      "command": "uvx",
      "args": ["infrastructure-diagram-mcp-server"],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR"
      }
    }
  }
}

Docker Installation

Build and run with Docker:

docker build -t infrastructure-diagram-mcp-server .

Then configure your MCP client:

{
  "mcpServers": {
    "infrastructure-diagrams": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "--interactive",
        "--env",
        "FASTMCP_LOG_LEVEL=ERROR",
        "infrastructure-diagram-mcp-server:latest"
      ]
    }
  }
}

Features

The Infrastructure Diagram MCP Server provides the following capabilities:

  1. Multi-Provider Support: Create diagrams for AWS, GCP, Azure, Kubernetes, on-premises, and hybrid/multi-cloud architectures
  2. 2000+ Icons: Access to icons across all major cloud providers and services
  3. Multiple Diagram Types: Infrastructure architecture, sequence diagrams, flow charts, class diagrams, and more
  4. Rich Examples: 27+ pre-built templates for AWS, GCP, Azure, K8s, hybrid, and multi-cloud patterns
  5. Customization: Customize diagram appearance, layout, styling, colors, and connections
  6. Security: Built-in code scanning to ensure secure diagram generation
  7. Seamless Display: Diagrams appear inline in Claude Desktop with automatic rendering
  8. Flexible Output: Save diagrams to PNG format in your workspace directory

How to Use

Once configured in your MCP client (e.g., Claude Desktop), you can generate diagrams using natural language:

Example Prompts:

Discover Available Icons:

List all available GCP infrastructure diagram icons

Get Example Code:

Show me examples of Azure microservices diagrams

Generate Diagrams:

Create a GCP data pipeline diagram showing Pub/Sub, Dataflow, and BigQuery
Generate an AWS serverless architecture with API Gateway, Lambda, and DynamoDB
Design a multi-cloud architecture spanning AWS, GCP, and Azure

The server will automatically:

  1. Find the appropriate icons from the 2000+ available
  2. Generate Python code using the diagrams package
  3. Create and display the PNG diagram inline
  4. Save the diagram to your workspace directory

What's New

This fork extends the original AWS Diagram MCP Server with:

  • Full Multi-Cloud Support: GCP, Azure, Kubernetes, hybrid, and multi-cloud architectures
  • 27+ Comprehensive Examples: Ready-to-use templates across all providers
  • Complete Icon Coverage: All 2000+ icons properly imported and available
  • Enhanced Display: MCP ImageContent format for seamless inline rendering
  • Bug Fixes: Resolved double .png extension and read-only filesystem issues
  • Icon Corrections: Fixed 28+ incorrect class names in examples

Code Examples

Below are Python code examples showing the diagrams package syntax. When using with Claude Desktop, you can simply describe what you want in natural language!

AWS Serverless Application

from diagrams import Diagram
from diagrams.aws.compute import Lambda
from diagrams.aws.database import Dynamodb
from diagrams.aws.network import APIGateway

with Diagram("Serverless Application", show=False):
    api = APIGateway("API Gateway")
    function = Lambda("Function")
    database = Dynamodb("DynamoDB")

    api >> function >> database

GCP Microservices

from diagrams import Diagram, Cluster
from diagrams.gcp.compute import CloudRun
from diagrams.gcp.network import LoadBalancing
from diagrams.gcp.database import SQL

with Diagram("GCP Microservices", show=False):
    lb = LoadBalancing("load balancer")
    with Cluster("Services"):
        services = [CloudRun("api"), CloudRun("worker")]
    db = SQL("database")

    lb >> services >> db

Azure Web App

from diagrams import Diagram
from diagrams.azure.web import AppService
from diagrams.azure.database import SQLServer
from diagrams.azure.storage import BlobStorage

with Diagram("Azure Web App", show=False):
    AppService("web") >> SQLServer("db") >> BlobStorage("storage")

Multi-Cloud Architecture

from diagrams import Diagram, Cluster
from diagrams.aws.compute import EC2
from diagrams.gcp.compute import CloudRun
from diagrams.azure.web import AppService

with Diagram("Multi-Cloud Setup", show=False):
    with Cluster("AWS"):
        aws = EC2("primary")
    with Cluster("GCP"):
        gcp = CloudRun("backup")
    with Cluster("Azure"):
        azure = AppService("cdn")

    aws >> [gcp, azure]

Development

Testing

The project includes a comprehensive test suite to ensure the functionality of the MCP server. The tests are organized by module and cover all aspects of the server's functionality.

To run the tests, use the provided script:

./run_tests.sh

This script will automatically install pytest and its dependencies if they're not already installed.

Or run pytest directly (if you have pytest installed):

pytest -xvs tests/

To run with coverage:

pytest --cov=infrastructure_diagram_mcp_server --cov-report=term-missing tests/

Development Dependencies

To set up the development environment, install the development dependencies:

uv pip install -e ".[dev]"

This will install the required dependencies for development, including pytest, pytest-asyncio, and pytest-cov.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request to the GitHub repository.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

This is a derivative work based on awslabs/aws-diagram-mcp-server. Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

See NOTICE file for additional attribution information.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

infrastructure_diagram_mcp_server-0.0.2.tar.gz (193.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file infrastructure_diagram_mcp_server-0.0.2.tar.gz.

File metadata

  • Download URL: infrastructure_diagram_mcp_server-0.0.2.tar.gz
  • Upload date:
  • Size: 193.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for infrastructure_diagram_mcp_server-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c0ee904add6ef83a6903ec2d3906b1bc64ed24768fdfb4f9cd36379683f1ad31
MD5 796e8a6b452ca5650a3730b3ab74e150
BLAKE2b-256 f67a61fd8e242e4c23447343265994196d5dff708ed36d1d03396828e210b1fd

See more details on using hashes here.

File details

Details for the file infrastructure_diagram_mcp_server-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: infrastructure_diagram_mcp_server-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 30.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for infrastructure_diagram_mcp_server-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0cec72529b9ae577a3025b6df909ee9184d2d940070c327558fa79c394c62e38
MD5 35da8aeab88f3fd674c1be1f75f4ae78
BLAKE2b-256 7307053a5f7a49239f890f32cc1af274b5f95342602b22a774e6e9a152c16975

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page