MCP.so
ログイン

Mermaid Validator MCP Server

@rtuin

基本情報

カテゴリ

その他

ライセンス

MIT

トランスポート

stdio

作者

rtuin

投稿者

Richard Tuin

Mermaid Validator MCP Server について

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

#mcp#mermaid-validator#diagram-rendering

Mermaid Validator MCP Server の設定

以下の設定を使って、このサーバーを MCP 対応クライアントに追加してください。

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

Mermaid Validator MCP Server のツール

1

Validates a Mermaid diagram and returns the rendered image (PNG or SVG) if valid

概要

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.

よくある質問

1

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.

2

What are the dependencies of Mermaid Validator?

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

3

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.

4

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.

5

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.

コメント

「その他」の他のコンテンツ