Mermaid Validator
Validates and optionally renders Mermaid diagrams using a Python Model Context Protocol (MCP) server.
About
The Mermaid Validator is a Python-based Model Context Protocol (MCP) server designed to streamline the process of validating and rendering Mermaid diagrams. It acts as a lightweight wrapper around the official `mermaid-cli` tool, abstracting away complex file handling and command-line operations. This server empowers large language models (LLMs) by providing structured validation results, including a boolean status, detailed error messages for syntax issues, and optional base64-encoded PNG images of successfully rendered diagrams for visual confirmation. This robust feedback mechanism enables LLMs to programmatically verify diagram syntax, understand and correct errors, and visually confirm their output.
Key Features
- Validates Mermaid diagram syntax and provides structured results.
- Delivers detailed error messages for precise syntax correction.
- Optionally renders diagrams as base64-encoded PNG images for visual verification.
- Abstracts complexities of the Mermaid CLI, including temporary file management and Puppeteer configurations.
- Optimizes context length for LLM interactions by defaulting to validation-only output.
- 3 GitHub stars
Use Cases
- Assist LLMs in providing precise corrections to Mermaid diagrams by returning detailed error messages.
- Provide visual confirmation of generated diagrams to LLMs through optional image rendering.
- Enable large language models (LLMs) to programmatically validate generated Mermaid diagram syntax.