Skip to main content
Glama

MCP Kroki Server

An MCP (Model Context Protocol) server for converting Mermaid diagrams to SVG images using Kroki.io.

Features

  • Generate URLs for diagrams using Kroki.io

  • Download diagrams as SVG, PNG, PDF, or JPEG files

  • Support for multiple diagram formats:

    • Mermaid

    • PlantUML

    • Graphviz

    • And many more (see Kroki.io documentation)

Related MCP server: kroki_mcp

Installation

local install

git clone https://github.com/tkoba1974/mcp-kroki.git
cd mcp-kroki
npm install
npm run build

Usage

The server provides two main tools:

1. Generate Diagram URL

Generates a URL for a diagram using Kroki.io.

Parameters:

  • type: The diagram type (e.g., "mermaid", "plantuml")

  • content: The diagram content in the specified format

  • outputFormat (optional): The output format (svg, png, pdf, jpeg, base64)

2. Download Diagram

Downloads a diagram to a local file.

Parameters:

  • type: The diagram type (e.g., "mermaid", "plantuml")

  • content: The diagram content in the specified format

  • outputPath: The path where the diagram should be saved

  • outputFormat (optional): The output format (svg, png, pdf, jpeg)

  • scale (optional, number, default: 1.0): Scaling factor for the diagram dimensions. Currently only affects SVG output by attempting to modify width/height attributes. Minimum value is 0.1.

Example

// Generate a URL for a Mermaid diagram
const result = await callTool('generate_diagram_url', {
  type: 'mermaid',
  content: 'graph TD; A-->B; B-->C; C-->D;',
  outputFormat: 'svg'
});

// Download a Mermaid diagram
const result = await callTool('download_diagram', {
  type: 'mermaid',
  content: 'graph TD; A-->B; B-->C; C-->D;',
  outputPath: '/path/to/diagram.svg'
});

How It Works

The server uses the Kroki.io API to convert diagrams. The diagram content is compressed and encoded before being sent to Kroki.io.

Usage with Claude Desktop

Add to your Claude Desktop configuration file (claude_desktop_config.json):

local install:

{
  "mcpServers": {
    "mcp-kroki": {
      "command": "node",
      "args": ["/path/to/mcp-kroki/build/index.js"]
    }
  }
}

npx:

{
  "mcpServers": {
    "mcp-kroki": {
      "command": "npx",
      "args": [
        "-y",
        "@tkoba1974/mcp-kroki"
      ]
    }
  }
}

License

MIT

Available Tools

2 tools
download_diagramA

Download a diagram image to a local file. This tool converts diagram code (such as Mermaid) into an image file and saves it to the specified location. Useful for generating diagrams for presentations, documentation, or other offline use. Includes an option to scale SVG output.

Inputs: type (required), content (required), outputPath (required), outputFormat, +1 more.

generate_diagram_urlA

Generate a URL for a diagram using Kroki.io. This tool takes Mermaid diagram code or other supported diagram formats and returns a URL to the rendered diagram. The URL can be used to display the diagram in web browsers or embedded in documents.

Inputs: type (required), content (required), outputFormat.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools have clearly distinct purposes: one downloads diagrams to local files for offline use, while the other generates URLs for web-based display. There is no overlap or ambiguity between them.

    Naming Consistency5/5

    Both tools follow a consistent verb_noun pattern (download_diagram, generate_diagram_url) with the same base noun 'diagram', making them predictable and easy to understand.

    Tool Count2/5

    With only two tools, the server feels thin for a diagram generation service. It lacks essential operations like listing supported diagram formats, validating diagram code, or managing diagram styles, which would be expected for a complete toolset.

    Completeness2/5

    The server covers basic output generation (download and URL) but has significant gaps. It lacks tools for input validation, format discovery, or diagram manipulation (e.g., editing or converting formats), which are core to a diagram service domain.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Converts Markdown files into professional diagrams such as flowcharts, mind maps, and architecture diagrams using Mermaid.js and custom SVG renderers. It enables users to list, render, and export visualizations in multiple formats including SVG, PNG, and PDF.
      3
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides AI agents with tools to generate, validate, and inspect diagrams from natural-language prompts, using the Kroki rendering engine to produce SVG files.
      -
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI assistants to generate and validate 30+ UML and other diagram types (Mermaid, D2, Graphviz, BPMN, C4, and more) through the Model Context Protocol, returning rendered SVG, PNG, PDF, JPEG, or base64 output via Kroki, PlantUML, and Mermaid backends.
      4
      Apache 2.0