Home / MCP / Mermaid Validator MCP Server

Mermaid Validator MCP Server

Provides Mermaid diagram validation and PNG rendering via MCP for AI tools.

typescript
Installation
Add the following to your MCP client configuration file.

Configuration

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

The Mermaid Validator MCP Server lets you validate and render Mermaid diagrams through the Model Context Protocol, so AI tools can confirm syntax correctness and obtain a rendered PNG image for diagrams you supply.

How to use

You connect your MCP client to the Mermaid Validator to check Mermaid syntax and receive a rendered PNG when the diagram is valid. Use it to quickly verify diagrams before embedding them in your workflows, documentation, or AI-assisted renderings.

How to install

Prerequisites: Node.js installed on your development machine. You also need npm to install and run the server.

Install dependencies and build the project.

npm install
npm run build

Run the local MCP server inspector for development.

npx @modelcontextprotocol/inspector node dist/main.js

Optional tooling commands for maintenance.

npm run format
npm run lint
npm run watch

Configuration and usage details

The server is configured to run as a local MCP server using a straightforward command. You expose a single MCP server entry that points to the Mermaid Validator tool.

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

Notes and capabilities

This server uses the Mermaid CLI to validate diagram syntax and render PNG output. It returns a textual confirmation along with a base64-encoded PNG when the diagram is valid, or an error message with details when it is not.

Security and maintenance

Keep the validator up to date by upgrading to the latest package version in the command configuration and periodically rebuilding. Treat the rendered PNG output as an opaque artifact from your diagram processing workflow.

Available tools

validateMermaid

Validates a Mermaid diagram syntax and returns a rendered PNG if valid, including a base64-encoded image and a text status.