mermaid-local-mcp
Renders Mermaid diagram code to high-resolution PNG images with configurable theme, background color, and scale, and returns mermaid.live preview/edit links.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mermaid-local-mcp Render this Mermaid diagram to a PNG: flowchart LR A-->B"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mermaid-local-mcp
A local MCP (Model Context Protocol) server that renders Mermaid diagrams and returns PNG images. Designed for visual feedback loops in Claude Code -- render a diagram, inspect it visually, fix issues, re-render.
Why?
Cloud-based Mermaid rendering MCPs depend on external APIs that can go down (503 errors, rate limits). This server runs entirely locally using mermaid-cli (mmdc), so it's fast, free, and always available.
mermaid-local-mcp | Cloud MCP | |
Dependency | Local only | External API |
Reliability | No 503s | Can go down |
Offline | Works | Doesn't work |
Speed | Fast (local render) | Network roundtrip |
Cost | Free | Free (for now) |
Related MCP server: vizcharter
Features
Renders Mermaid code to high-resolution PNG via Puppeteer/mmdc
Returns images directly to Claude for visual inspection
Generates mermaid.live preview links automatically
Reports syntax errors with actionable details
Supports themes:
default,forest,dark,neutralConfigurable scale (1-5x), background color
Setup
1. Clone
git clone https://github.com/ryu1maniwa/mermaid-local-mcp.git
cd mermaid-local-mcp
npm install2. Configure Claude Code
Add to your project's .mcp.json:
{
"mcpServers": {
"mermaid-local": {
"command": "node",
"args": ["/path/to/mermaid-local-mcp/index.mjs"]
}
}
}Or add to your global ~/.claude/settings.json:
{
"mcpServers": {
"mermaid-local": {
"command": "node",
"args": ["/path/to/mermaid-local-mcp/index.mjs"]
}
}
}3. Allow the tool (optional)
In .claude/settings.json, add to permissions:
{
"permissions": {
"allow": ["mcp__mermaid-local"]
}
}Tool: render_mermaid
Renders Mermaid diagram code to a PNG image.
Parameters
Parameter | Type | Default | Description |
| string | (required) | Mermaid diagram code |
| enum |
|
|
| string |
| Background color ( |
| number |
| Scale factor 1-5 for resolution |
Returns
On success:
PNG image (base64-encoded, displayed inline by Claude)
mermaid.live preview/edit link
On error:
Syntax error details from mmdc stderr
mermaid.live link for debugging
Usage with the feedback loop skill
This MCP pairs with a Claude Code agent skill for autonomous Mermaid diagram improvement:
Extract Mermaid blocks from markdown files
Render each diagram via
render_mermaidVisually inspect the returned PNG for issues (text overlap, layout problems, poor contrast)
Fix the Mermaid code
Re-render and verify
Update the source markdown file
See SKILL.md for the complete skill definition.
Requirements
Node.js >= 18
npx (comes with npm)
@mermaid-js/mermaid-cliis invoked via npx automatically (no global install needed)
License
MIT
Available Tools
1 toolrender_mermaidA
Render Mermaid diagram code to PNG image locally using mmdc. Returns the rendered image for visual inspection. Use this for feedback loops: render -> inspect -> fix -> re-render.
Inputs: mermaidCode (required), scale, theme, backgroundColor.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
There is only one tool, so there is no possibility of confusing it with another operation. Its purpose is clearly stated as rendering Mermaid code to PNG.
The single tool follows a clear verb_noun pattern: render_mermaid. With only one name, there is no inconsistency to assess.
A single render tool is well matched to this server's focused purpose, though the surface is slightly thin compared with broader multi-tool servers. It earns its place as the core operation.
The core rendering workflow is fully covered, including the render-inspect-fix loop. Minor optional gaps exist, such as explicit validation or additional output formats, but they are not essential for the stated purpose.
Maintenance
Related MCP Connectors
Render Mermaid, Graphviz, Vega-Lite, Chart.js or SVG code to PNG, SVG or PDF, with error lines.
Let Claude, Cursor, or ChatGPT author Mermaid diagrams your team can read and share.
Render, verify, describe, and safely edit Mermaid diagrams through MCP.
Generate dynamic Mermaid diagrams and charts with AI assistance. Customize styles and export diagr…
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI assistants to generate and render Mermaid diagrams (flowcharts, sequence diagrams, etc.) as PNG/SVG images with local file saving and HTTP access URLs. Supports batch processing and intelligent caching for efficient diagram creation.164 npm1MIT
- AlicenseAqualityDmaintenanceEnables Claude Code to create and edit presentation-grade visualizations such as cloud architecture diagrams, charts, KPI dashboards, and poster infographics, with auto-layout, themes, and export to SVG, PNG, JPG, and PDF.6MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude to draw Mermaid diagrams as live, inline canvases in the reply instead of printing them as code blocks. The rendered diagram can be zoomed, panned, re-themed, expanded in height, and flipped to a highlighted, copyable source view.MIT
- AlicenseAqualityCmaintenanceEnables Claude to generate PlantUML diagrams from natural-language requests and render them directly in chat as PNG, SVG, or ASCII art, with syntax-error feedback, shareable URLs, and URL decoding.3MIT