Mermaid

v0.2.0Developer Toolsstable

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

mermaiddiagrammcpmodel-context-protocolai
Share:
227
Stars
0
Downloads
0
Weekly
0/5

What is Mermaid?

Mermaid is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to model context protocol (mcp) server that converts mermaid diagrams to png images.

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • generate

Use Cases

Convert Mermaid diagrams to images
Generate diagrams dynamically
Export SVG and PNG visualizations
peng-shawn

Maintainer

LicenseMIT License
Languagejavascript
Versionv0.2.0
UpdatedMay 21, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

NPM

npx -y @peng-shawn/mermaid-mcp-server

Manual Installation

npx -y @peng-shawn/mermaid-mcp-server

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Mermaid

The Mermaid MCP Server allows AI assistants to render Mermaid diagram syntax into PNG or SVG image files on demand, bridging the gap between text-based diagram code and visual output. It exposes a single generate tool that accepts any valid Mermaid diagram — flowcharts, sequence diagrams, state machines, ER diagrams, Gantt charts, and more — and returns either an inline image (for clients that support it) or saves the file to disk. Developers and technical writers can ask Claude to design and immediately visualize system architectures, data flows, and workflows without leaving their AI assistant session.

Prerequisites

  • Node.js 18+ installed on your system
  • npx available (bundled with Node.js)
  • An MCP-compatible client such as Claude Desktop or Cursor
  • For Cursor or clients that do not display images inline: a writable folder for saving output files
1

No installation required — use npx

The server is published on npm as @peng-shawn/mermaid-mcp-server and can be run directly with npx without a separate install step.

npx -y @peng-shawn/mermaid-mcp-server
2

Add the server to Claude Desktop configuration

Edit your claude_desktop_config.json to register the Mermaid MCP server. No environment variables are required for Claude Desktop's default inline-image mode.

{
  "mcpServers": {
    "mermaid": {
      "command": "npx",
      "args": ["-y", "@peng-shawn/mermaid-mcp-server"]
    }
  }
}
3

Configure for Cursor or disk-save mode

For clients that do not support inline images (Cursor, Cline), set CONTENT_IMAGE_SUPPORTED=false. The generate tool will then require name and folder parameters and save the file to disk.

{
  "mcpServers": {
    "mermaid": {
      "command": "npx",
      "args": ["-y", "@peng-shawn/mermaid-mcp-server"],
      "env": {
        "CONTENT_IMAGE_SUPPORTED": "false"
      }
    }
  }
}
4

Restart your MCP client

Restart Claude Desktop or your MCP client so it loads the new server. The generate tool will appear in the tool list.

5

Test diagram generation

Ask Claude to draw a simple flowchart to confirm the tool is working and images are rendering correctly.

Mermaid Examples

Client configuration

Standard claude_desktop_config.json entry for the Mermaid MCP server with inline image support enabled (default behavior).

{
  "mcpServers": {
    "mermaid": {
      "command": "npx",
      "args": ["-y", "@peng-shawn/mermaid-mcp-server"]
    }
  }
}

Prompts to try

Example prompts that trigger the Mermaid generate tool for various diagram types.

- "Draw a flowchart showing a user authentication flow with success and failure paths."
- "Create a sequence diagram of how an HTTP request moves through a load balancer, API gateway, and microservice."
- "Generate an ER diagram for a blog database with users, posts, comments, and tags tables."
- "Draw a Gantt chart for a 4-week software sprint with planning, development, testing, and release phases."
- "Create a state diagram showing the lifecycle of an order from placed to delivered, with cancel and refund states."

Troubleshooting Mermaid

generate tool call fails with a Puppeteer or Chrome error

The server uses Puppeteer to render diagrams and bundles its own Chromium. On Linux servers or Docker containers, install Chrome dependencies: apt-get install -y libnss3 libatk-bridge2.0-0 libx11-xcb1 libxcomposite1 libxdamage1 libxrandr2 libgbm1 libasound2. Alternatively, set PUPPETEER_EXECUTABLE_PATH to an existing Chrome binary.

Diagram is generated but no image appears in Claude Desktop

Ensure CONTENT_IMAGE_SUPPORTED is not set to false in your config. The default (true) returns the image inline. If the response shows text instead of an image, your client version may not support image content — switch to disk-save mode and open the file manually.

Saving to disk fails with 'folder parameter required'

When CONTENT_IMAGE_SUPPORTED=false, the generate tool requires both name (filename without extension) and folder (absolute path to an existing directory) parameters. Include them in your prompt: "Save the diagram as 'arch-diagram' in /Users/yourname/diagrams/".

Frequently Asked Questions about Mermaid

What is Mermaid?

Mermaid is a Model Context Protocol (MCP) server that model context protocol (mcp) server that converts mermaid diagrams to png images. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Mermaid?

Install via npm with the command: npx -y @peng-shawn/mermaid-mcp-server. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).

Which AI clients work with Mermaid?

Mermaid works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Mermaid free to use?

Yes, Mermaid is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.

Browse More Developer Tools MCP Servers

Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "mermaid": { "command": "npx", "args": ["-y", "@peng-shawn/mermaid-mcp-server"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Mermaid?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides