A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images
Config is the same across clients — only the file and path differ.
{
"mcpServers": {
"mermaid": {
"args": [
"-y",
"@peng-shawn/mermaid-mcp-server"
],
"command": "npx"
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images or SVG files. This server allows AI assistants and other applications to generate visual diagrams from textual descriptions using the Mermaid markdown syntax.
Run this in your terminal to verify the server starts. Then let us know if it worked — your result helps other developers.
npx -y '@peng-shawn/mermaid-mcp-server' 2>&1 | head -1 && echo "✓ Server started successfully"
After testing, let us know if it worked:
Five weighted categories — click any category to see the underlying evidence.
No known CVEs.
Checked @peng-shawn/mermaid-mcp-server against OSV.dev.
Click any tool to inspect its schema.
Be the first to review
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Others in design / developer-tools
A Model Context Protocol (MCP) server and CLI that provides tools for agent use when working on iOS and macOS projects.
Context7 Platform -- Up-to-date code documentation for LLMs and AI code editors
XcodeBuildMCP provides tools for Xcode project management, simulator management, and app utilities.
Copy/paste detector for programming source code, supports 223 formats. AI-ready with token-efficient reporter, skill and MCP server.
MCP Security Weekly
Get CVE alerts and security updates for Mermaid Mcp Server and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images or SVG files. This server allows AI assistants and other applications to generate visual diagrams from textual descriptions using the Mermaid markdown syntax.
The server uses Puppeteer to launch a headless browser, render the Mermaid diagram to SVG, and optionally capture a screenshot of the rendered diagram. The process involves:
npx tsc
{
"mcpServers": {
"mermaid": {
"command": "npx",
"args": ["-y", "@peng-shawn/mermaid-mcp-server"]
}
}
}
env CONTENT_IMAGE_SUPPORTED=false npx -y @peng-shawn/mermaid-mcp-server
You can find a list of mermaid diagrams under ./diagrams, they are created using Cursor agent with prompt: "generate mermaid diagrams and save them in a separate diagrams folder explaining how renderMermaidPng work"
Run the server with inspector for testing and debugging:
npx @modelcontextprotocol/inspector node dist/index.js
The server will start and listen on stdio for MCP protocol messages.
Learn more about inspector here.
To install Mermaid Diagram Generator for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @peng-shawn/mermaid-mcp-server --client claude
When running in Docker containers (including via Smithery), you may need to handle Chrome dependencies:
The server now attempts to use Puppeteer's bundled browser by default
If you encounter browser-related errors, you have two options:
Option 1: During Docker image build:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true when installing PuppeteerPUPPETEER_EXECUTABLE_PATH at runtime to point to the Chrome installationOption 2: Use Puppeteer's bundled Chrome:
PUPPETEER_SKIP_CHROMIUM_DOWNLOADFor Smithery users, the latest version should work without additional configuration.
The server exposes a single tool:
generate: Converts Mermaid diagram code to a PNG image or SVG file
code: The Mermaid diagram code to rendertheme: (optional) Theme for the diagram. Options: "default", "forest", "dark", "neutral"backgroundColor: (optional) Background color for the diagram, e.g. 'white', 'transparent', '#F0F0F0'outputFormat: (optional) Output format for the diagram. Options: "png", "svg" (defaults to "png")name: Name for the generated file (required when CONTENT_IMAGE_SUPPORTED=false)folder: Absolute path to save the image/SVG to (required when CONTENT_IMAGE_SUPPORTED=false)The behavior of the generate tool depends on the CONTENT_IMAGE_SUPPORTED environment variable:
CONTENT_IMAGE_SUPPORTED=true (default): The tool retur