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.

评论

其他 分类下的更多 MCP 服务器