Mermaid Render Mcp

io.github.tci-nebula由 GitHub 账号 tci-nebula 发布v1.3.0更新于 Oct 24, 2026

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

已验证STDIO仅桌面开发者工具媒体与设计

概览

AI 生成的概览

一个本地 MCP 服务器,把 Mermaid 图表语法渲染为 PNG、SVG 或 PDF 图片,或把流程图转换为可编辑的 draw.io 文件。

可以做什么
将 Mermaid 图表定义渲染为 PNG、SVG 或 PDF 图片,以内联 base64 返回或写入指定文件路径,可设置主题、背景、宽度和 PDF 适配。把 flowchart 和 graph 语法转换为可编辑的 draw.io XML,无需浏览器,适合需要继续编辑的图表。
适用场景
适合让助手把描述出的流程、架构或流程图变成实际图片或文档,或变成可编辑的 draw.io 文件。draw.io 方式适合不便下载 Chromium 的受限机器。
运行要求
通过 npx 作为本地进程运行,需要 Node.js 18 及以上。PNG、SVG 和 PDF 渲染在首次运行时会下载无头 Chromium(约 150 MB),需要几分钟;draw.io 方式不需要。也提供 Docker 镜像作为替代。未声明需要账号或 API 密钥。
安装前请注意
使用 output_path 时服务器会按给定路径写入文件,请只指向你打算写入的目录。渲染依赖内置的 Mermaid CLI 和无头 Chromium。draw.io 转换仅支持流程图,且节点几何尺寸为估算值。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Mermaid Render Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

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

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

Claude Desktop

Add to claude_desktop_config.json:

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):

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

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

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.gitcd mermaid-mcpnpm installclaude 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
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

来源:README.md,提交 64adfc2

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.3.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分