mcp-mermaid-validator
A Model Context Protocol server that validates and renders Mermaid diagrams.
claude mcp add --transport stdio rtuin-mcp-mermaid-validator npx -y @rtuin/mcp-mermaid-validator@latest
How to use
The Mermaid Validator MCP server provides a dedicated tool to validate and render Mermaid diagrams. It exposes a validateMermaid capability via the MCP SDK: you supply Mermaid diagram syntax as input, and the tool returns either a confirmation that the diagram is valid along with a base64-encoded PNG rendering, or detailed error information if the diagram is invalid. This makes it suitable for integration with LLM workflows where you want to verify diagram syntax before rendering visuals. To use it, configure your MCP client to point at this server (for example under the mermaid-validator key). Once connected, you can pass the Mermaid diagram text to the validateMermaid tool and receive either a successful rendering or helpful error messages that include validation details and any available output from the Mermaid CLI.
How to install
Prerequisites:
- Node.js and npm installed on your system
- Access to the internet to download dependencies
Step-by-step:
- Copy the quick-start server configuration into your MCP clients file (see mcp_config):
{
"mcpServers": {
"mermaid-validator": {
"command": "npx",
"args": [
"-y",
"@rtuin/mcp-mermaid-validator@latest"
]
}
}
}
- Install dependencies and build (local development):
npm install
npm run build
- Run locally (for development) using the inspector if needed:
npx @modelcontextprotocol/inspector node dist/main.js
Note: In production or containerized environments, you typically use the mcp_config entry above to let the MCP client install the validator on demand via npx.
- Validate the setup by invoking the validateMermaid tool with a Mermaid diagram string through your MCP client.
Additional notes
Tips and notes:
- The server uses the Mermaid CLI under the hood to validate syntax and render PNG output. The PNG is returned as a base64-encoded string to maximize compatibility with various MCP clients. -stdin/stdout handling is implemented to be portable across Linux, macOS, WSL, and Windows. If you encounter stdin issues, ensure the Mermaid CLI receives input via the appropriate piping method as described in the Troubleshooting section of the README. -Common issues: invalid Mermaid syntax will yield structured error messages with details from the Mermaid CLI; ensure your diagram follows Mermaid syntax and supported diagram types. -If you need to adjust output format or path handling, check the build and runtime configuration in the source, particularly around how the Mermaid CLI is invoked and how outputs are captured.
Related MCP Servers
mcp-for-beginners
This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.
bitbucket
Bitbucket MCP - A Model Context Protocol (MCP) server for integrating with Bitbucket Cloud and Server APIs
mcp-arr
MCP server for *arr media management suite
crawlbase
Crawlbase MCP Server connects AI agents and LLMs with real-time web data. It powers Claude, Cursor, and Windsurf integrations with battle-tested web scraping, JavaScript rendering, and anti-bot protection enabling structured, live data inside your AI workflows.
dockashell
DockaShell is an MCP server that gives AI agents isolated Docker containers to work in. MCP tools for shell access, file operations, and full audit trail.
md2confluence
MCP server to upload Markdown to Confluence. Auto-converts Mermaid diagrams, code blocks, images, and tables.