Mermaid MCP Server
@andrewginns
About Mermaid MCP Server
Python MCP Server abstracting the official mermaid-cli for ease of use
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"mermaid-mcp-server-andrewginns": {
"command": "npx",
"args": [
"@mermaid-js/mermaid-cli",
"--version"
]
}
}
}Tools
No tools detected
Fetch the live tool list by running this server in a temporary sandbox using the button above.
Overview
What is Mermaid MCP Server?
Mermaid MCP Server is a Model Context Protocol (MCP) server that validates Mermaid diagram syntax and optionally renders them as PNG images. It wraps the Mermaid CLI tool to provide LLMs with structured validation results, including boolean status, detailed error messages, and optional base64‑encoded images. Designed for developers integrating diagram validation into AI workflows.
How to use Mermaid MCP Server?
Configure the server in your MCP client (e.g., Claude Desktop) using uv and the provided Python script. The server exposes a single tool validate_mermaid_diagram that accepts diagram_text (required) and return_image (optional, default false). Example configuration JSON is included in the README, and local testing can be done via make install and make test.
Key features of Mermaid MCP Server
- Validates Mermaid diagram syntax with structured error messages
- Optionally returns base64-encoded PNG images of diagrams
- Manages temporary files, puppeteer config, and command construction automatically
- Context‑length optimised (images disabled by default)
- Supports standard
stdiotransport for MCP clients - Includes a Pydantic AI test client using Gemini models
Use cases of Mermaid MCP Server
- AI‑powered diagramming assistants that validate user‑provided Mermaid syntax
- Automated documentation pipelines that verify diagram correctness before rendering
- LLM agents that need to generate and visually confirm Mermaid diagrams
FAQ from Mermaid MCP Server
What does the server validate?
It validates Mermaid diagram syntax using the Mermaid CLI. Returns is_valid: true/false and a detailed error message if validation fails.
What are the runtime dependencies?
Node.js with npm, Mermaid CLI (npm install -g @mermaid-js/mermaid-cli), and Python with uv. All are required even if only using the server component.
Why does the tool not return an image by default?
Returning images (base64 strings) can consume significant LLM context length (10KB–100KB+). Disabling images by default preserves context for longer conversations.
How are temporary files handled?
The server automatically creates and cleans up temporary .mmd and .png files, generates puppeteer configuration, and manages subprocess commands. No manual file management is needed.
Can I test the server locally?
Yes. Use make install to set up dependencies and make test to run validation tests. A test script using Pydantic AI with Gemini models is also provided.
Frequently asked questions
What does the server validate?
It validates Mermaid diagram syntax using the Mermaid CLI. Returns `is_valid: true/false` and a detailed error message if validation fails.
What are the runtime dependencies?
Node.js with npm, Mermaid CLI (`npm install -g @mermaid-js/mermaid-cli`), and Python with `uv`. All are required even if only using the server component.
Why does the tool not return an image by default?
Returning images (base64 strings) can consume significant LLM context length (10KB–100KB+). Disabling images by default preserves context for longer conversations.
How are temporary files handled?
The server automatically creates and cleans up temporary `.mmd` and `.png` files, generates puppeteer configuration, and manages subprocess commands. No manual file management is needed.
Can I test the server locally?
Yes. Use `make install` to set up dependencies and `make test` to run validation tests. A test script using Pydantic AI with Gemini models is also provided.
Basic information
More Other MCP servers
Production-ready MCP integrations for AI applications
Klavis-AIKlavis AI: MCP integration platforms that let AI agents use tools reliably at any scale
Activepieces
activepiecesAI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
🚀 Model Context Protocol (MCP) Curriculum for Beginners
microsoftThis 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,
Inbox Zero AI
elie222The world's best AI personal assistant for email. Open source app to help you reach inbox zero fast.
Nginx UI
0xJackyYet another WebUI for Nginx
Comments