Skip to main content

MCP server for rendering diagrams using mingrammer/diagrams, Mermaid, and PlantUML

Project description

diagrams-mcp-server

PyPI

MCP server for generating cloud architecture diagrams, flowcharts, sequence diagrams, and more — powered by three rendering engines: mingrammer/diagrams, Mermaid, and PlantUML.

Example diagram

Getting Started

Hosted (Recommended)

Connect to the public hosted server — no installation required. All rendering engines and dependencies are pre-installed.

Add to your MCP client configuration:

{
  "mcpServers": {
    "diagrams-mcp": {
      "url": "https://diagrams-mcp-production.up.railway.app/mcp"
    }
  }
}

That's it — you're ready to generate diagrams.

Local Installation

Prerequisites

Graphviz is required for the core diagram rendering engine. Mermaid CLI and PlantUML are optional — install them only if you need those specific rendering engines.

Dependency Required for Install
Graphviz render_diagram (cloud architecture) brew install graphviz
Mermaid CLI render_mermaid (flowcharts, sequence, etc.) npm install -g @mermaid-js/mermaid-cli
Java + PlantUML render_plantuml (UML diagrams) brew install openjdk + download plantuml.jar

Note: The hosted server has all dependencies pre-installed. Local prerequisites only apply if you're running the server yourself.

Install the server

Via uvx (recommended):

uvx diagrams-mcp-server

Via pip:

pip install diagrams-mcp-server

From source:

pip install git+https://github.com/ByteOverDev/diagrams-mcp.git

Configure your MCP client

After installing, add to your MCP client configuration:

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

Or if installed via pip:

{
  "mcpServers": {
    "diagrams-mcp": {
      "command": "diagrams-mcp-server"
    }
  }
}

Available Tools

Discovery

  • list_providers()list[str] — List all diagram providers (aws, gcp, k8s, azure, onprem, etc.)
  • list_services(provider)list[str] — List service categories within a provider (e.g. awscompute, database, network)
  • list_nodes(provider, service)list[dict] — List node classes for a provider.service pair with import paths
  • search_nodes(query)list[dict] — Search for nodes by keyword across all providers (e.g. "postgres", "lambda")

Rendering

  • render_diagram(code)Image (PNG) — Execute a Python script using mingrammer/diagrams in a sandboxed subprocess. Returns a rendered cloud architecture diagram.
  • render_mermaid(definition)Image (PNG/SVG) — Render a Mermaid diagram definition (flowcharts, sequence, class, ER, state, Gantt, and more).
  • render_plantuml(definition)Image (PNG) — Render a PlantUML diagram definition (sequence, class, component, activity, state, deployment).

Cross-Provider Equivalence

  • find_equivalent(node, target_provider?)dict — Find equivalent services across cloud providers (e.g. EC2ComputeEngine on GCP).
  • list_categories()list[dict] — List all 30 infrastructure role categories with mapped nodes across providers.

Resources

The server provides reference documentation accessible via MCP resource URIs:

URI Description
diagrams://reference/diagram Diagram constructor parameters, defaults, and usage
diagrams://reference/edge Edge operators, labels, styling, and chaining
diagrams://reference/cluster Cluster nesting, styling, and graph attributes
diagrams://reference/mermaid Mermaid syntax examples for 6 diagram types
diagrams://reference/plantuml PlantUML syntax examples for 6 diagram types

Examples

Cloud Architecture (mingrammer/diagrams)

"Draw an AWS architecture with an ALB routing to two ECS services, backed by RDS and ElastiCache"

from diagrams import Diagram, Cluster
from diagrams.aws.network import ALB
from diagrams.aws.compute import ECS
from diagrams.aws.database import RDS, ElastiCache

with Diagram("ECS Service", direction="LR"):
    lb = ALB("ALB")

    with Cluster("ECS Cluster"):
        services = [ECS("Web"), ECS("API")]

    lb >> services
    services[0] >> ElastiCache("Cache")
    services[1] >> RDS("Database")

Flowchart (Mermaid)

"Create a flowchart showing a CI/CD pipeline"

graph LR
    A[Push to main] --> B[Run Tests]
    B --> C{Tests pass?}
    C -->|Yes| D[Build Image]
    C -->|No| E[Notify Team]
    D --> F[Deploy to Staging]
    F --> G[Deploy to Production]

Sequence Diagram (PlantUML)

"Show the authentication flow between a client, API gateway, and auth service"

PlantUML sequence diagram

@startuml
Client -> "API Gateway": POST /login
"API Gateway" -> "Auth Service": Validate credentials
"Auth Service" --> "API Gateway": JWT token
"API Gateway" --> Client: 200 OK + token
Client -> "API Gateway": GET /data (Bearer token)
"API Gateway" -> "Auth Service": Verify token
"Auth Service" --> "API Gateway": Valid
"API Gateway" --> Client: 200 OK + data
@enduml

Development

# Clone and install
git clone https://github.com/ByteOverDev/diagrams-mcp.git
cd diagrams-mcp
pip install -e ".[dev]"

# Run tests
pytest

# Lint and format
ruff check .
ruff format .

# Run the MCP server locally (stdio mode)
diagrams-mcp-server

Supported Providers

The render_diagram tool supports all providers from the mingrammer/diagrams library, including:

AWS, GCP, Azure, Kubernetes, On-Premise, AlibabaCloud, OCI, OpenStack, DigitalOcean, Elastic, Outscale, Generic, and Custom nodes.

Use list_providers() and search_nodes(query) to discover available nodes.

License

MIT

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

diagrams_mcp_server-0.1.0.tar.gz (136.3 kB view details)

Uploaded Source

Built Distribution

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

diagrams_mcp_server-0.1.0-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file diagrams_mcp_server-0.1.0.tar.gz.

File metadata

  • Download URL: diagrams_mcp_server-0.1.0.tar.gz
  • Upload date:
  • Size: 136.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for diagrams_mcp_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ec7851e86badf1a73f01bdd7f8b20addd4ee06c9fbfc8ab36de5466b9d4acebd
MD5 0c7a9290f24ef545c6f2c4b113833405
BLAKE2b-256 b9703eb60529858e1cdac4cb5993852f61644102923eab7c75b3241972840d1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for diagrams_mcp_server-0.1.0.tar.gz:

Publisher: release.yml on ByteOverDev/diagrams-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file diagrams_mcp_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for diagrams_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4172d31ae24abdfd4b22fa36369452a29cdcda52d5628bf21d29b6aeac94b38f
MD5 5167cfd5e3a9744c8eb32cb3db397439
BLAKE2b-256 24b080a710108ce9a1adf61b0fb3729aeace597135cf85be9f190a3f68a11f9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for diagrams_mcp_server-0.1.0-py3-none-any.whl:

Publisher: release.yml on ByteOverDev/diagrams-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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