MCP.so
Sign In

Mermaid Validator

@rtuin

About Mermaid Validator

A Model Context Protocol server that validates and renders Mermaid diagrams.

Basic information

Category

Other

License

MIT

Runtime

node

Transports

stdio

Publisher

rtuin

Submitted by

Richard Tuin

Config

Add this server to your MCP-compatible client using the configuration below.

{
  "mcpServers": {
    "mermaid-validator": {
      "command": "npx",
      "args": [
        "-y",
        "@rtuin/mcp-mermaid-validator"
      ]
    }
  }
}

Tools

No tools detected

We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.

Overview

What is Mermaid Validator?

Mermaid Validator is a Model Context Protocol server that validates and renders Mermaid diagrams. It enables LLMs to check diagram syntax and obtain a rendered PNG image, integrating with MCP-compatible clients.

How to use Mermaid Validator?

Configure your MCP client by adding the server to the mcp servers file with the command npx -y @rtuin/mcp-mermaid-validator@latest. The server exposes a validateMermaid tool that accepts a Mermaid diagram string and returns validation results plus a rendered PNG if valid.

Key features of Mermaid Validator

  • Validates Mermaid diagram syntax and returns rendered PNG.
  • Integrates with MCP-compatible clients via Model Context Protocol.
  • Uses Mermaid CLI for validation and rendering.
  • Returns base64-encoded PNG image on success.
  • Provides detailed error messages on failure.
  • Child process approach ensures isolation and error handling.

Use cases of Mermaid Validator

  • Ensuring Mermaid diagrams generated by LLMs are syntactically correct.
  • Rendering diagrams for preview in MCP clients.
  • Automatically validating diagram syntax in AI-assisted workflows.
  • Integrating diagram validation into MCP-based tools.

FAQ from Mermaid Validator

What does the validateMermaid tool do?

It accepts a Mermaid diagram string, validates it, and returns a confirmation text plus a base64-encoded PNG image if valid, or an error message if invalid.

What are the dependencies of Mermaid Validator?

The server depends on @modelcontextprotocol/sdk, @mermaid-js/mermaid-cli, and zod for schema validation.

How does Mermaid Validator handle errors?

It uses a nested try-catch structure to distinguish between validation errors (invalid diagram syntax) and system errors, providing detailed error information to help users fix their diagrams.

What output format does Mermaid Validator use?

It uses PNG as the default output format because it ensures better compatibility with most MCP clients, particularly Cursor, which does not support SVG.

How is Mermaid Validator invoked?

It communicates via standard input/output as an MCP server and can be run using npx with the package @rtuin/mcp-mermaid-validator@latest. For development, it can be launched via the MCP Inspector.

Comments

More Other MCP servers