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: diagrams-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.

ParametersJSON Schema
NameRequiredDescriptionDefault
typeYesDiagram type (e.g., "mermaid", "plantuml", "graphviz"). Supports the same diagram types as Kroki.io.
contentYesThe diagram content in the specified format.
outputPathYesThe complete file path where the diagram image should be saved (e.g., "/Users/username/Documents/diagram.svg").
outputFormatNoOutput image format. If unspecified, derived from outputPath extension. Options: "svg", "png", "pdf", "jpeg".
scaleNoOptional scaling factor to apply to the diagram dimensions. Default is 1.0 (no scaling). This currently only affects SVG output format by attempting to modify width/height attributes.

TDQS

A3.9/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the core functionality (converting diagram code to image file) and mentions the scale option's limitation to SVG format, but lacks details about error handling, performance characteristics, or authentication requirements.

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 efficiently structured with three sentences that each serve distinct purposes: stating the core functionality, explaining use cases, and noting a specific feature. There is no redundant or unnecessary 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?

For a tool with 5 parameters, 100% schema coverage, and no output schema, the description provides adequate context about what the tool does and when to use it, but lacks details about return values, error conditions, or performance characteristics that would be helpful for an agent.

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

Parameters3/5

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

The schema has 100% description coverage, so the baseline is 3. The description adds minimal value beyond the schema - it mentions the scale option's effect on SVG output, but doesn't provide additional context about parameter interactions or usage patterns.

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 tool's purpose with specific verbs ('download', 'converts', 'saves') and resources ('diagram image', 'local file'), and distinguishes it from the sibling tool 'generate_diagram_url' by emphasizing local file saving rather than URL generation.

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 clear context for when to use this tool ('useful for generating diagrams for presentations, documentation, or other offline use'), but does not explicitly state when not to use it or mention the sibling tool as an alternative for different use cases.

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

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
typeYesDiagram type (e.g., "mermaid" for Mermaid diagrams, "plantuml" for PlantUML, "graphviz" for GraphViz DOT, "c4plantuml" for C4 architecture diagrams, and many more). See Kroki.io documentation for all supported formats.
contentYesThe diagram content in the specified format. For Mermaid diagrams, this would be the Mermaid syntax code (e.g., "graph TD; A-->B; B-->C;").
outputFormatNoThe format of the output image. Options are: "svg" (vector graphics, default), "png" (raster image), "pdf" (document format), "jpeg" (compressed raster image), or "base64" (base64-encoded SVG for direct embedding in HTML).

TDQS

A4/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool generates URLs (not files) and mentions the external service Kroki.io, which adds useful context. However, it doesn't cover behavioral aspects like rate limits, authentication needs, error handling, or whether the URL is persistent/temporary. The description doesn't contradict annotations (none exist).

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 appropriately sized (three sentences) and front-loaded: the first sentence states the core purpose, the second explains inputs/outputs, and the third describes usage. Every sentence earns its place with no redundant information.

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?

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is reasonably complete. It covers the purpose, inputs, outputs, and usage context. However, without annotations or output schema, it could benefit from more behavioral details (e.g., URL characteristics, error cases). The 100% schema coverage helps compensate.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds minimal value beyond the schema: it mentions 'Mermaid diagram code or other supported diagram formats' which aligns with the 'type' and 'content' parameters, but doesn't provide additional syntax or format details. Baseline 3 is appropriate when the schema does the heavy lifting.

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 tool's purpose: 'Generate a URL for a diagram using Kroki.io' with specific verbs ('generate', 'takes', 'returns') and resources ('Mermaid diagram code or other supported diagram formats', 'URL to the rendered diagram'). It distinguishes from the sibling tool 'download_diagram' by focusing on URL generation rather than downloading.

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 clear context for when to use this tool: for generating URLs to display diagrams in web browsers or embed in documents. It implies an alternative (the sibling 'download_diagram' likely downloads the diagram file), but doesn't explicitly state when to choose one over the other or list exclusions.

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

TDQS

A3.9/5.0
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
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tkoba1974/mcp-kroki'

If you have feedback or need assistance with the MCP directory API, please join our Discord server