by peng-shawn
Mermaid Diagram Generator converts Mermaid diagrams to crisp PNGs with customizable themes and backgrounds for perfect v
Converts Mermaid diagram code into PNG images or SVG files using headless browser rendering. Supports multiple themes and customizable backgrounds for generating visual diagrams from text.
Mermaid Diagram Generator is a community-built MCP server published by peng-shawn that provides AI assistants with tools and capabilities via the Model Context Protocol. Mermaid Diagram Generator converts Mermaid diagrams to crisp PNGs with customizable themes and backgrounds for perfect v It is categorized under productivity, developer tools.
You can install Mermaid Diagram Generator in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
MIT
Mermaid Diagram Generator is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
Add new capabilities to Claude beyond text generation
Example
Access external data sources, execute code, interact with tools and services
Transform Claude from chatbot to action-taking agent
Provide Claude with access to relevant context and data
Example
Load project documentation, access knowledge bases, query databases
Get more accurate, context-aware responses
Automate multi-step workflows combining AI and external tools
Example
Research → Summarize → Create document → Send notification
Complete complex tasks end-to-end without manual steps
Share your MCP server with the developer community
According to our notes, Mermaid Diagram Generator benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.
Mermaid Diagram Generator is among the better-indexed MCP projects we tried; the explainx.ai summary tracks the official description.
Mermaid Diagram Generator has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.
Mermaid Diagram Generator reduced integration guesswork — categories and install configs on the listing matched the upstream repo.
Useful MCP listing: Mermaid Diagram Generator is the kind of server we cite when onboarding engineers to host + tool permissions.
Strong directory entry: Mermaid Diagram Generator surfaces stars and publisher context so we could sanity-check maintenance before adopting.
According to our notes, Mermaid Diagram Generator benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.
Mermaid Diagram Generator is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.
I recommend Mermaid Diagram Generator for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
Strong directory entry: Mermaid Diagram Generator surfaces stars and publisher context so we could sanity-check maintenance before adopting.
showing 1-10 of 57
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 returns the image/SVG directly in the responseCONTENT_IMAGE_SUPPORTED=false: The tool saves the image/SVG to the specified folder and returns the file pathCONTENT_IMAGE_SUPPORTED: Controls whether images are returned directly in the response or saved to disk
true (default): Images are returned directly in the responsefalse: Images are saved to disk, requiring name and folder parameters// Generate a flowchart with default settings
{
"code": "flowchart TD
A[Start] --> B{Is it?}
B -->|Yes| C[OK]
B -->|No| D[End]"
}
// Generate a sequence diagram with forest theme and light gray background
{
"code": "sequenceDiagram
Alice->>John: Hello John, how are you?
John-->>Alice: Great!",
"theme": "forest",
"backgroundColor": "#F0F0F0"
}
// Generate a class diagram and save it to disk as PNG
{
"code": "classDiagram
Class01 <|-- AveryLongClass
Class03 *-- Class04
Class05 o-- Class06",
"theme": "dark",
"name": "class_diagram",
"folder": "/path/to/diagrams"
}
// Generate a state diagram as SVG
{
"code": "stateDiagram-v2
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]",
"outputFormat": "svg",
"name": "state_diagram",
"folder": "/path/to/diagrams"
}
Yes, but it doesn't support the theme and backgroundColor options. Plus, having a dedicated server makes it easier to create mermaid diagrams with different MCP clients.
Cursor doesn't support inline images in responses yet.
This project uses GitHub Actions to automate the publishing process to npm.
Make sure all your changes are committed and pushed
Run the release script with either a specific version number or a semantic version increment:
# Using a specific version number
npm run release 0.1.4
# Using semantic version increments
npm run release patch # Increments the patch version (e.g., 0.1.3 → 0.1.4)
npm run release minor # Increments the minor version (e.g., 0.1.3 → 0.2.0)
npm run release major # Increments the major version (e.g., 0.1.3 → 1.0.0)
The script will:
git tag v0.1.4 # Use the appropriate version number
git push origin v0.1.4
Note: You need to set up the NPM_TOKEN secret in your GitHub repository settings. To do this:
NPM_TOKEN with your npm token as the valueMIT
Prerequisites
Time Estimate
15-60 minutes depending on server complexity
Steps
Troubleshooting
✓ Do
✗ Don't
💡 Pro Tips
Architecture
Model Context Protocol standardizes how AI hosts (Claude, Cursor) communicate with external tools and data sources through server implementations.
Protocols
Compatibility
✓ Use when
Use when you need Claude to access external data, execute actions, or integrate with tools. Best for extending AI capabilities beyond conversation.
✗ Avoid when
Avoid when native integrations exist (use official APIs directly), for real-time critical systems, or when security/compliance requires zero external dependencies.