mcp-mermaid-validator
The Mermaid Validator is a Model Context Protocol server designed to validate and render Mermaid diagrams, facilitating LLMs to process these visual formats. It integrates with the Mermaid CLI for robust diagram interpretation and rendering, providing outputs in PNG format for enhanced compatibility.
MCP Server: Mermaid Validator
A Model Context Protocol server that validates and renders Mermaid diagrams. This server enables LLMs to validate and render Mermaid diagrams.
Usage
Quick Start
You can configure your MCP client to use the Mermaid Validator by adding it to your mcp servers file.
Architecture
High-Level Architecture
This project is structured as a simple TypeScript Node.js application that:
- Validates Mermaid diagrams and returns rendered PNG output.
- Uses the Model Context Protocol SDK for MCP compatibility.
- Leverages the Mermaid CLI for diagram validation and rendering.
Component Functionality
The core functionality is implemented in the main component:
- Creates an MCP server instance.
- Registers a validateMermaid tool.
- Uses the Mermaid CLI to validate and render diagrams.
Dependencies
External Libraries
- @modelcontextprotocol/sdk: SDK for implementing Model Context Protocol
- @mermaid-js/mermaid-cli: CLI tool for Mermaid diagrams
API Specification
validateMermaid Tool
Purpose: Validates a Mermaid diagram and returns the rendered PNG if valid.
Technical Decisions
- Uses PNG as the output format for compatibility.
- Utilizes Node.js child processes for rendering.