Metadata-Version: 2.4
Name: infrastructure-diagram-mcp-server
Version: 0.0.1
Summary: An MCP server that seamlessly creates infrastructure diagrams for any cloud provider using the Python diagrams package DSL
Project-URL: Source, https://github.com/andrewmoshu/diagram-mcp-server
Author: Infrastructure Diagram MCP
License: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.12
Requires-Dist: bandit>=1.8.6
Requires-Dist: boto3>=1.40.53
Requires-Dist: diagrams>=0.24.4
Requires-Dist: mcp[cli]>=1.23.0
Requires-Dist: pydantic>=2.12.2
Requires-Dist: sarif-om>=1.0.4
Requires-Dist: setuptools>=80.9.0
Requires-Dist: starlette>=0.48.0
Requires-Dist: urllib3>=2.5.0
Description-Content-Type: text/markdown

# Infrastructure Diagram MCP Server

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

This MCP server seamlessly creates [diagrams](https://diagrams.mingrammer.com/) using the Python diagrams package DSL. This server allows you to generate professional infrastructure diagrams for **any cloud provider** (AWS, GCP, Azure), Kubernetes, on-premises, hybrid, and multi-cloud architectures using Python code.

## Prerequisites

1. Install `uv` from [Astral](https://docs.astral.sh/uv/getting-started/installation/) or the [GitHub README](https://github.com/astral-sh/uv#installation)
2. Install Python using `uv python install 3.10`
3. Install GraphViz https://www.graphviz.org/

## Installation


Configure the MCP server in your MCP client configuration (e.g., for Kiro, edit `~/.kiro/settings/mcp.json`):

```json
{
  "mcpServers": {
    "awslabs.aws-diagram-mcp-server": {
      "command": "uvx",
      "args": ["awslabs.aws-diagram-mcp-server"],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR"
      },
      "autoApprove": [],
      "disabled": false
    }
  }
}
```
### Windows Installation

For Windows users, the MCP server configuration format is slightly different:

```json
{
  "mcpServers": {
    "awslabs.aws-diagram-mcp-server": {
      "disabled": false,
      "timeout": 60,
      "type": "stdio",
      "command": "uv",
      "args": [
        "tool",
        "run",
        "--from",
        "awslabs.aws-diagram-mcp-server@latest",
        "awslabs.aws-diagram-mcp-server.exe"
      ],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR",
        "AWS_PROFILE": "your-aws-profile",
        "AWS_REGION": "us-east-1"
      }
    }
  }
}
```


or docker after a successful `docker build -t awslabs/aws-diagram-mcp-server .`:

```json
  {
    "mcpServers": {
      "awslabs.aws-diagram-mcp-server": {
        "command": "docker",
        "args": [
          "run",
          "--rm",
          "--interactive",
          "--env",
          "FASTMCP_LOG_LEVEL=ERROR",
          "awslabs/aws-diagram-mcp-server:latest"
        ],
        "env": {},
        "disabled": false,
        "autoApprove": []
      }
    }
  }
```

## 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**: 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. **Flexible Output**: Save diagrams to PNG format in your workspace directory

## Quick Examples

### AWS Serverless Application
```python
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
```python
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
```python
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
```python
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:

```bash
./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):

```bash
pytest -xvs tests/
```

To run with coverage:

```bash
pytest --cov=awslabs.aws_diagram_mcp_server --cov-report=term-missing tests/
```

For more information about the tests, see the [tests README](https://github.com/awslabs/mcp/blob/main/src/aws-diagram-mcp-server/tests/README.md).

### Development Dependencies

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

```bash
uv pip install -e ".[dev]"
```

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