mermaid-mcp-server

andrewginns/mermaid-mcp-server

3.3

If you are the rightful owner of mermaid-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A Model Context Protocol (MCP) server for validating and optionally rendering Mermaid diagrams using a Python wrapper over the Mermaid CLI.

The Mermaid MCP Server is a Python-based server designed to validate Mermaid diagrams and optionally render them as PNG images. It leverages the Mermaid CLI tool to perform these tasks, providing structured validation results that include a boolean validation status, detailed error messages, and optionally, base64-encoded PNG images of successfully rendered diagrams. This server enables LLMs to programmatically validate Mermaid diagram syntax, understand specific errors for providing helpful corrections, and receive visual confirmation of the rendered output. The server requires Node.js and the Mermaid CLI to be installed, and it uses the `uv` tool to run the server script. A Pydantic-AI MCP Client is also provided for testing purposes.

Features

  • Boolean validation status indicating correct syntax
  • Detailed error messages for failed validations
  • Optional base64-encoded PNG images for visual verification
  • Automatic file handling and cleanup
  • Structured error handling and command construction

Usages

usage with Claude Desktop

{
  "mcpServers": {
    "mermaid-validator": {
      "command": "uv",
      "args": ["run", "/path/to/mermaid_mcp_server.py"],
      "env": {
        "MCP_TRANSPORT": "stdio"
      }
    }
  }
}

usage with VS Code

{
  "mcp": {
    "servers": {
      "mermaid-validator": {
        "command": "uv",
        "args": ["run", "/path/to/mermaid_mcp_server.py"],
        "env": {
          "MCP_TRANSPORT": "stdio"
        }
      }
    }
  }
}