Mermaid Render MCP logo

Mermaid Render MCP

Renders Mermaid diagram syntax to PNG or SVG images for LLM clients

Install Mermaid Render MCP

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "mermaid-render-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mermaid-render-mcp"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

We couldn’t confirm it starts correctly

The install command didn't complete successfully in our automated test.

npx -y mermaid-render-mcp

to update! npm notice npm ERR! code ECONNRESET npm ERR! network aborted npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config' npm ERR! A complete log of this run can be found in: /home/user/.npm/_logs/2026-10-18T11_16_07_903Z-debug-0.log

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked 6d ago.

Overview

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 3d ago

Recent health check succeeded.

7/7 checks healthy over the last 46d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 9d ago via OSV.dev · mermaid-render-mcp (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

npm downloads238Package downloads in the last 30 days.
Last commit2mo agoMost recent push to the default branch.
Install checkInconclusiveInstall command did not finish in our automated test.
Directory activity5 viewsConfig copies, upvotes, and views on AllMCPs.

From the project README

mermaid-mcp

test npm

An MCP server that renders Mermaid diagrams to PNG, SVG, or PDF — or converts them to editable draw.io files. Give your LLM the ability to turn diagram syntax into actual images and documents.

Quick start

Claude Code

Terminal
claude mcp add mermaid -- npx -y mermaid-render-mcp

Claude Desktop

Add to claude_desktop_config.json:

config.json
{
  "mcpServers": {
    "mermaid": {
      "command": "npx",
      "args": ["-y", "mermaid-render-mcp"]
    }
  }
}

Note: the first run downloads headless Chromium (~150 MB), so the initial startup takes a few minutes. If you only need flowcharts and can work with editable files, the drawio fast path skips Chromium entirely.

Docker

No Node.js or Chromium download needed — the image ships with everything (including CJK fonts for Japanese/Chinese/Korean labels):

Terminal
claude mcp add mermaid -- docker run -i --rm tcinebula/mermaid-render-mcp

To use output_path, mount a host directory and write into it:

config.json
{
  "mcpServers": {
    "mermaid": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-v", "C:\\diagrams:/out", "tcinebula/mermaid-render-mcp"]
    }
  }
}

Then pass output_path: "/out/figure.pdf" and the file appears in C:\diagrams.

Remote / self-hosted (HTTP)

The same server speaks Streamable HTTP when PORT is set (or MCP_TRANSPORT=http), so it can be deployed to any container host — Railway, Fly.io, etc. — straight from the Dockerfile:

  • Endpoint: POST /mcp (health check at /healthz)
  • Set AUTH_TOKEN to require Authorization: Bearer <token>
  • output_path is disabled in HTTP mode; base64/XML responses only

From source

bash
git clone https://github.com/tci-nebula/mermaid-mcp.git
cd mermaid-mcp
npm install
claude mcp add mermaid -- node /path/to/mermaid-mcp/server.js

Tool: render_diagram

ParameterTypeDefaultDescription
syntaxstring(required)Mermaid diagram definition
formatpng | svg | pdf | drawiopngOutput format (drawio = editable draw.io XML, flowcharts only)
themedefault | dark | neutral | forestdefaultVisual theme
backgroundstringwhiteCSS colour or transparent
widthnumber1200Canvas width in px (PNG only)
pdfFitbooleantrueScale the PDF page to fit the diagram (PDF only)
output_pathstring—Write the result to this file path instead of returning base64

Returns the rendered image as base64-encoded data so MCP clients can display it inline — or, with output_path, writes the file to disk (handy for PDFs destined for printing or formal document submission).

Example

Ask your LLM:

"Draw me a flowchart of the OAuth login flow"

It generates the Mermaid syntax, calls render_diagram, and you get back a PNG.

The drawio fast path (no Chromium)

format: "drawio" is the one output that never touches a browser. It's pure JavaScript — parse, lay out with dagre, emit XML — so there's no Chromium download, no ~150 MB install, and no multi-minute first run. Conversion is effectively instant.

Reach for it when:

  • you want the diagram editable rather than flat — every shape stays a real draw.io object
  • you're on a constrained box (CI, a slim container, a locked-down laptop) where downloading Chromium isn't practical
  • you just want the diagram now and don't need a raster image
config.json
{
  "syntax": "flowchart TD\n  A[Start] --> B{OK?}\n  B -->|yes| C[Ship]\n  B -->|no| A",
  "format": "drawio",
  "output_path": "flow.drawio"
}

Open the result in draw.io (or the VS Code extension) and export to PNG/SVG/PDF from there if you do need an image — that's a complete Chromium-free round trip.

Limits

  • Flowcharts only. flowchart and graph diagrams convert; sequence, class, state, ER, and gantt throw an error. Use PNG/SVG/PDF for those.
  • theme, background, and width are ignored. Styling is draw.io's job once the file is open.
  • Node sizes are estimated from label length, not measured font metrics. draw.io re-measures text when it opens the file so boxes settle correctly — but treat the raw XML geometry as approximate.

Supported syntax: directions TD / TB / BT / LR / RL; shapes [rect], (rounded), {rhombus}, ((circle)), ([stadium]), [[subroutine]], [(cylinder)], {{hexagon}}; edges -->, ---, -.->, ==>, <-->, each optionally carrying a |label|.

How it works

PNG, SVG, and PDF rendering shells out to @mermaid-js/mermaid-cli (bundled as a dependency), which uses a headless Chromium to render diagrams. First npm install downloads Chromium (~150 MB), so it takes a few minutes.

draw.io export is pure JavaScript — a flowchart parser plus dagre layout (the same engine Mermaid uses) emit native mxGraphModel XML, so every shape stays individually editable in draw.io.

Requirements

Roadmap

  • PDF export (formal/legal document workflows)
  • draw.io XML export (editable diagrams — flowcharts)
  • npm package (mermaid-render-mcp)
  • Remote-hosted server option (Streamable HTTP transport)

License

MIT

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Mermaid Render MCP

mermaid-render-mcp is an MCP server that renders Mermaid diagram syntax into PNG, SVG, or PDF files and can convert flowcharts into editable draw.io XML. It exposes a render_diagram tool for LLM clients, supporting themes, backgrounds, PNG width control, PDF fitting, and optional file output paths. It returns base64-encoded results when not writing to disk.

Install it for Claude Code with `claude mcp add mermaid -- npx -y mermaid-render-mcp`. You can also run it from source with Node.js, or use the provided Docker image.

The server supports PNG, SVG, PDF, and draw.io output through the `render_diagram` tool. PNG, SVG, and PDF use Mermaid rendering, while `drawio` produces editable draw.io XML and is available for flowcharts only.

PNG, SVG, and PDF rendering downloads and uses headless Chromium on the first run, while the `drawio` format does not use Chromium. The draw.io fast path is pure JavaScript and is suitable when Chromium cannot be downloaded or installed.

Yes, the server supports Streamable HTTP when `PORT` is set or `MCP_TRANSPORT=http`. It exposes `POST /mcp`, provides a `/healthz` health check, and can require a bearer token through `AUTH_TOKEN`; HTTP mode returns base64 or XML responses instead of using `output_path`.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMermaid Render MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/mermaid-render-mcp?style=directory)](https://allmcps.com/mcp/mermaid-render-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/mermaid-render-mcp"><img src="https://allmcps.com/api/badge/mermaid-render-mcp?style=directory" alt="Mermaid Render MCP on AllMCPs" /></a>