Skip to main content
Glama

UML-MCP: Diagram Generation via MCP

Run Tests Build Package Deploy docs GitHub stars License: MIT Python >=3.12,<3.13 MCP status

Generate UML and other diagrams through the Model Context Protocol.

At a glance

Topic

What you get

Diagrams

30+ types: UML (Class, Sequence, Activity, Use Case, State, Component, Deployment, Object), Mermaid, D2, Graphviz, TikZ, ERD, BlockDiag, BPMN, C4, and more via Kroki

MCP tools

generate_uml, validate_uml, list_diagram_types, generate_uml_batch

Outputs

SVG, PNG, PDF, JPEG, base64 (availability varies by diagram type)

Pipeline

Kroki first, then PlantUML or Mermaid.ink

Deployment

Local stdio, local HTTP, Docker, Vercel, Smithery

Source

URL

Live MCP (HTTP)

https://uml-mcp.vercel.app/mcp

Smithery catalog

Add via Smithery

Quick Start

Choose your mode

  • Remote (recommended): Fast setup over HTTP MCP with Vercel serverless runtime

  • Local: stdio process for file output and local debugging

Remote quick start (Vercel HTTP MCP)

Configuration for the public Vercel deployment:

"uml-mcp": {
  "transport": "http",
  "url": "https://uml-mcp.vercel.app/mcp"
}

Local quick start (stdio MCP)

git clone https://github.com/antoinebou12/uml-mcp.git && cd uml-mcp
uv sync
uv run python server.py

Example client configs:

  • config/cursor_config.json

  • config/claude_desktop_config.json

  • config/README.md for exact config file locations

  • Claude Code: install the bundled plugin from the repo marketplace (see below) or read docs/integrations/claude_code.md

Claude Code plugin

Adds the hosted HTTP MCP server plus a diagram skill (no settings.json paste). In Claude Code:

/plugin marketplace add https://github.com/antoinebou12/uml-mcp
/plugin install uml-mcp@uml-mcp-plugins

Use a local path instead of the GitHub URL if you already cloned this repo. Custom endpoints and validation: docs/integrations/claude_code.md.

Related MCP server: UML-MCP

Remote vs Local

  • Transport: Remote uses HTTP MCP, local uses stdio by default

  • Runtime: Remote runs on Vercel, local runs in your Python environment

  • File writes: Remote is read-only (no output_dir), local supports output_dir

  • Returned data: Both return URL + base64; local can also save files

  • Environment variables: Remote is managed server-side; local reads your env config

MCP clients must call /mcp, not the site root.

Supported Diagram Types

Category

Examples

UML (PlantUML)

Class, Sequence, Activity, Use Case, State, Component, Deployment, Object

General

Mermaid, D2, Graphviz, ERD, BlockDiag, BPMN, C4

Specialized

TikZ, Excalidraw, Nomnoml, Pikchr, Structurizr, SVGBob, WaveDrom, WireViz, …

Full list with supported formats: run python server.py --list-tools or query uml://types and uml://formats.

MCP Tools and Resources

Tools

Tool

Purpose

generate_uml

Render a diagram; omit output_dir for URL/base64 only

validate_uml

Structural validation before render; strict enables extra Mermaid/D2 checks

list_diagram_types

Same metadata as uml://types when resources are awkward

generate_uml_batch

Multiple diagrams in one call (cap: MCP_BATCH_MAX_ITEMS)

Resources (uml://)

Resource

Description

uml://types

Diagram types, backends, supported formats per type

uml://templates

Starter templates per type; see BPMN 2.0.2 guide for element and flow reference (docs)

uml://examples

Example diagrams per type; Mermaid documents named samples (sequence API, Gantt) alongside uml://examples (key mermaid)

uml://formats

Output formats per type

uml://capabilities

Type → backend → formats matrix used for validation

uml://server-info

Server name, version, tools, prompts, Kroki/PlantUML URLs

uml://workflow

Recommended plan-then-generate workflow

Deployment

Vercel

This repo includes vercel.json for serverless deployment.

  1. Connect the repo to Vercel

  2. Use https://<project>.vercel.app/mcp

  3. Keep /mcp in all MCP client URLs

Smithery

  1. Open smithery.ai/new, choose URL

  2. Enter https://<project>.vercel.app/mcp

  3. Configure display name, description, and homepage

Detailed guide: docs/integrations/vercel_smithery.md

Docker

Default image serves FastAPI on port 8000 with MCP HTTP at http://127.0.0.1:8000/mcp.

# Full local stack (local Kroki + mermaid + blockdiag)
docker compose up -d

# API + MCP only (public Kroki)
docker build -t uml-mcp . && docker run -p 8000:8000 uml-mcp

# stdio MCP subprocess mode
docker run -i uml-mcp python server.py --transport stdio

Configuration (Local runtime)

These variables apply to local/self-hosted runs. Remote Vercel endpoint settings are managed server-side.

Variable

Description

Default

KROKI_SERVER

Kroki server URL

https://kroki.io

PLANTUML_SERVER

PlantUML server URL

http://plantuml-server:8080

MCP_OUTPUT_DIR

Diagram output directory

./output

MCP_READ_ONLY

Disable file writes

false

MCP_MAX_CODE_LENGTH

Max diagram code length

500000

MCP_BATCH_MAX_ITEMS

Max items per generate_uml_batch

20

MCP_RATE_LIMIT_PER_MINUTE

HTTP rate limit per IP for diagram/MCP routes (0 = off)

0

USE_LOCAL_KROKI

Use local Kroki instance

false

USE_LOCAL_PLANTUML

Use local PlantUML instance

false

Full options: docs/configuration.md

Architecture

Typical flow when a user asks an MCP-enabled assistant for a diagram: the assistant calls generate_uml, the server renders via Kroki, then returns URLs and optional base64 to the assistant for the user.

server.py              -- MCP entry point (stdio/HTTP)
app.py                 -- FastAPI REST API + MCP HTTP at /mcp
api/app.py             -- legacy re-export of root app (Vercel FastAPI preset uses root app.py)
mcp_core/
  core/                -- config, server, CLI, utilities, diagram pipeline
  tools/               -- generate_uml, validate_uml
  prompts/             -- diagram generation prompts
  resources/           -- uml:// resource handlers
tools/kroki/           -- Kroki, PlantUML, Mermaid, D2 clients

Development

# Install dev dependencies
uv sync --all-groups

# Run tests
uv run pytest tests/ -v

# Lint
uv run ruff check . && uv run ruff format --check .

# Local CI
make ci

Documentation

Built with MkDocs + Material:

Contributing

License

MIT

Acknowledgements

PlantUML | Kroki | Mermaid | D2

Star History

GitHub Star History

Updated daily by GitHub Actions from GitHub's timestamped stargazer API. The refresh job prefers the optional STAR_HISTORY_TOKEN repository secret and safely falls back to the per-run GITHUB_TOKEN.

Available Tools

5 tools
generate_umlGenerate UmlA
Idempotent

Generate any UML or diagram by type (class, sequence, mermaid, d2, etc.)

NameRequiredDescriptionDefault
codeYes
scaleNo
themeNo
output_dirNo
diagram_typeYes
output_formatNosvg

Output Schema

NameRequiredDescription

No output parameters

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already provide idempotent and non-destructive hints, so the bar for transparency is lower. The description adds the range of supported diagram types but does not disclose potential file output behavior (e.g., output_dir) or the meaning of the code parameter.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no filler. Every word contributes to stating the action, scope, and examples.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 6 parameters and no parameter descriptions, the description is too terse to fully guide invocation. It explains what the tool does but not how to construct the required code input or what optional parameters control, though an output schema exists to mitigate return-value ambiguity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for parameter meaning. It only gives examples for diagram_type but leaves code, scale, theme, output_dir, and output_format unexplained, relying on property names alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Generate' and the resource 'any UML or diagram by type', with explicit examples (class, sequence, mermaid, d2). This distinguishes it from sibling tools like validate_uml, list_diagram_types, and generate_uml_batch.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies this is the primary single-generation tool, and sibling names suggest validation and batch alternatives. However, it does not explicitly state when not to use it or give direct comparisons to generate_uml_batch.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

generate_uml_batchGenerate Uml BatchA
Idempotent

Generate multiple diagrams in one call. Each item is like generate_uml (diagram_type, code, output_format?, theme?, scale?). Optional shared output_dir for all items. Returns a list of per-index results or errors.

NameRequiredDescriptionDefault
itemsYes
output_dirNo

Output Schema

NameRequiredDescription

No output parameters

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover idempotent and non-destructive behavior. The description adds useful context about the return format ('list of per-index results or errors') and the optional shared output_dir. This goes beyond the annotations without contradicting them.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with purpose, and includes the necessary parameter and return details without any waste. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers batch behavior, item structure, return type, and shared directory. There is an output schema for detailed return values, so the description need not repeat that. It could mention edge cases like empty items, but overall it's complete for a tool of this complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, but the description compensates by outlining the item structure with fields and optionality (diagram_type, code, output_format?, theme?, scale?) and explaining that output_dir is shared for all items. This gives the agent a clear understanding of the parameters beyond bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Generate multiple diagrams in one call', using a specific verb and resource that distinguishes it from the sibling tool generate_uml (single). It also mentions 'Each item is like generate_uml', reinforcing its role as the batch counterpart.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies batch usage by framing it as 'multiple diagrams in one call' and referencing generate_uml's parameter structure. It doesn't explicitly say when to choose this over repeated calls but conveys the benefit. No explicit exclusions, but sufficient guidance for typical use.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_diagram_typesList Diagram TypesA
Read-onlyIdempotent

List supported diagram types with Kroki backend, description, and formats (same data as uml://types resource). Use when the client cannot read resources.

NameRequiredDescriptionDefault

No parameters

Output Schema

NameRequiredDescription

No output parameters

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare read-only, idempotent, and non-destructive behavior. The description adds value by explaining the tool returns the same data as the 'uml://types resource' and enumerates the data fields (backend, description, formats), providing useful contextual insight beyond the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded: it states the action and resource in the first sentence, then gives a brief usage hint in the second. Every word earns its place, with no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a parameterless list tool with a rich output schema and thorough annotations, the description covers purpose, data source equivalence, and when to use it. It is sufficiently complete for an agent to decide when to invoke it and what to expect.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool takes no parameters, so the baseline is 4. The description makes it clear there is nothing to configure, and the empty input schema confirms this. No additional parameter explanation is needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List') and the specific resource ('supported diagram types'), adding detail on the data fields ('Kroki backend, description, and formats'). It distinguishes from sibling tools that validate or generate diagrams, making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides an explicit usage condition: 'Use when the client cannot read resources.' This gives clear context for when the tool is appropriate, though it does not explicitly mention alternatives or exclusions relative to sibling tools. The condition effectively implies that the uml://types resource is the preferred equivalent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

render_diagramRender DiagramA
Idempotent

Render a diagram and return it as an MCP image plus the server-side file path. Use this instead of generate_uml when the figure should appear in chat or be uploaded: the image needs no base64 copying in the conversation, and local_path is a file the wiki writer can upload directly.

NameRequiredDescriptionDefault
codeYes
scaleNo
themeNo
diagram_typeYes
output_formatNosvg

Output Schema

NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations cover the safety profile (readOnlyHint=false, idempotentHint=true, openWorldHint=true), and the description adds real context beyond them: the tool both returns an image and writes a server-side file, and that file is what a wiki writer uploads. It doesn't describe how theme/scale/output_format affect the rendered output, so it stops short of full disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, zero filler, with the capability stated first and the sibling differentiation immediately after. Every clause carries information an agent would otherwise have to infer.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need only partial explanation, and the description handles that. But for a 5-parameter tool with zero schema coverage, the description should at minimum clarify diagram_type values and point to the sibling list_diagram_types; that omission is a real gap for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

All 5 parameters have 0% schema description coverage, so the description carries the full burden — yet it says nothing about diagram_type, code, scale, theme, or output_format. It documents the outputs (image, local_path) but no input semantics or valid values for diagram_type, which is a required parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (render) and resource (diagram) plus the concrete deliverables: an MCP image and a server-side file path. It explicitly contrasts itself with the sibling generate_uml, so an agent can distinguish the two without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit selection rule — 'Use this instead of generate_uml when the figure should appear in chat or be uploaded' — naming both the alternative and the condition that picks it. The rationale (no base64 copying, uploadable local_path) removes any ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

validate_umlValidate UmlA
Read-onlyIdempotent

Validate a diagram by compiling it on the renderer. Runs local structure checks first, then a real Kroki compile, so valid reflects what the renderer accepts (a TikZ figure that does not compile is reported invalid). Returns errors, suggestions, compiled, and compile_ms.

NameRequiredDescriptionDefault
codeYes
strictNo
diagram_typeYes
output_formatNosvg

Output Schema

NameRequiredDescription

No output parameters

TDQS

A3.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover safety (readOnly, non-destructive, idempotent, closed-world), so the description only needed to add substance — and it does, disclosing that a real renderer compile happens and that `valid` reflects renderer acceptance rather than just local syntax. It stops short of noting that compilation is a network/latency-cost operation or how strict mode changes behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two tight sentences, front-loaded with the core action and mechanism, then the return shape. No filler, and every clause adds information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The output schema exists, so explaining return values is optional, and the compile-mechanism note is valuable context. But with 0% parameter coverage and no pointer to list_diagram_types for legal `diagram_type` values, an agent still cannot construct a correct call from the definition alone.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% across four parameters, and the description explains none of them: `diagram_type` (what values are legal), `strict` (what it tightens), `output_format`, and `code` are all left to inference. The return fields it lists are outputs, not parameters, so they don't compensate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (validate) and resource (diagram), and explains the mechanism — local structure checks plus a real Kroki compile. It is distinguishable from generate_uml and render_diagram by the emphasis on checking rather than producing output, though no sibling is named explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied (run this to learn whether a diagram will actually render), but there is no explicit when-to-use guidance, no statement of when to prefer render_diagram or generate_uml instead, and no prerequisites mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 5 tool updatesv1.3.1+ronzz.1
    • First observedgenerate_uml
    • First observedgenerate_uml_batch
    • First observedlist_diagram_types
    • First observedrender_diagram
    • First observedvalidate_uml

TDQS

A4/5.0

Scored across 5 tools

Disambiguation4/5

Each tool has a mostly distinct role: listing types, single generate, batch generate, validate, and render. The main ambiguity is between generate_uml and render_diagram, but the description explicitly steers usage ('use this instead of generate_uml when the figure should appear in chat'), which resolves most misselection risk.

Naming Consistency4/5

All names follow a snake_case verb_noun pattern (list_diagram_types, generate_uml, generate_uml_batch, validate_uml, render_diagram). Minor inconsistency: three tools use the '_uml' resource suffix while render_diagram uses '_diagram', but the convention remains readable and predictable.

Tool Count5/5

Five tools is well-scoped for a diagram generation server, with each tool earning its place (discovery, single gen, batch gen, validation, image rendering). No obvious padding or redundancy.

Completeness4/5

The core lifecycle (discover types, generate, batch, validate, render to image/file) is covered with no dead ends. Minor gaps exist around managing generated artifacts (e.g., listing or cleaning up previously written output files), but agents can work around this.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers