diagram-mcp
diagram-mcp
diagram-as-codeのテキストを、ディスク上のPNGファイルにレンダリングするMCPサーバーです。ブラウザもネットワークも外部サービスも不要です。ドキュメントやチケット、READMEに貼り付けるフローチャートの生成に便利です。

ツール
render_diagram: コードをPNGに変換し、ファイルパスを返しますpreview_diagram: ダイアグラムをテキストアートとして、そのまま会話内に描画します。ファイルは書き出しませんvalidate_diagram: パースして行番号付きでエラーを報告します。何も書き出しませんdiagram_syntax: 言語リファレンス
Related MCP server: mermaid-mcp
インストール
Node.js 20.12+ が必要です。
git clone https://github.com/JVmano/diagram-mcp.git
cd diagram-mcp
npm install
npm run build次に、Claude Code に登録します:
claude mcp add diagram --scope user \
--env DIAGRAM_MCP_OUTPUT_DIR=$HOME/Documents/diagram-renders \
-- node "$(pwd)/dist/index.js"または、手動で .mcp.json / ユーザー設定に追加します:
{
"mcpServers": {
"diagram": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/diagram-mcp/dist/index.js"],
"env": { "DIAGRAM_MCP_OUTPUT_DIR": "/absolute/path/to/renders" }
}
}
}セッションを再起動してから、ダイアグラムを依頼してください。変更をプルした後は、再度 npm run build を実行してください。
言語
title "Reward approval flow"
direction TB
node event "Conversion recorded" shape=rounded
node auto "Auto-approve?" shape=diamond size=200x100
node queue "Manual review queue"
event -> auto
auto -> queue "no"図形:rect、rounded、ellipse、diamond、hexagon。接続:from -> to ["label"] [style=solid|dashed]。at=x,y による位置指定は任意です。省略すると、レイアウトが図形を配置します。完全なリファレンスについては、diagram_syntax を呼び出してください。
設定
すべてオプションで、すべてにデフォルト値があります。.env.example を参照してください。レンダリング結果は DIAGRAM_MCP_OUTPUT_DIR(デフォルト:~/Documents/diagram-renders)に出力されます。明示的な outputPath は、DIAGRAM_MCP_ALLOW_ANY_OUTPUT_PATH=true でない限り、そのディレクトリまたは作業ディレクトリの内側にある必要があります。
開発
npm test # unit tests
npm run test:e2e # builds, then drives the server over stdio
npm run verify # typecheck, test, build, e2esrc/core 内のパーサー、レイアウト、SVG生成は、ローカルのダイアグラムエディタープロジェクトと共有されています。npm run check:sync は、そのプロジェクトが隣のディレクトリにチェックアウトされている場合、それらとの差分をチェックします。
ライセンス
MIT
Available Tools
4 toolsdiagram_syntaxDiagram language referenceARead-onlyIdempotent
Return the full diagram-as-code language reference, with shapes, options and a worked example.
Inputs: no named parameters.
preview_diagramPreview diagram as textARead-onlyIdempotent
Draw the diagram as text art so it can be shown directly in the conversation. Writes no file. Use render_diagram when a PNG is needed.
Inputs: code (required), maxCols.
render_diagramRender diagram to PNGA
Render diagram-as-code text to a PNG file and return the path. Runs locally with no browser and no network. Returns an error listing the offending line numbers if the code does not parse.
Inputs: code (required), name, scale, padding, +3 more.
validate_diagramValidate diagram codeARead-onlyIdempotent
Parse diagram code and report errors and warnings with line numbers, without writing any file.
Inputs: code (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a distinct purpose: syntax reference, validation, text preview, and PNG rendering. The descriptions clearly differentiate the outputs, and render_diagram explicitly notes when to use it over preview_diagram.
Three tools follow the verb_diagram pattern (render_diagram, validate_diagram, preview_diagram), while diagram_syntax reverses the order. The convention is still readable and consistent in style, with only a minor deviation.
Four tools is well-scoped for a diagram-as-code server. Each tool covers a necessary part of the workflow without redundancy or unnecessary bulk.
The toolset covers the full authoring loop: learn the syntax, validate the code, preview as text, and render to a PNG file. There are no obvious missing operations for the stated local rendering purpose.
Maintenance
Related MCP Connectors
Render, validate, encode/decode PlantUML diagram-as-code; 22 diagram types. Free, no auth.
Draws UI wireframes from a small text language: multi-screen boards with notes and flow arrows.
Render, verify, describe, and safely edit Mermaid diagrams through MCP.
Diagrams, badges, charts and QR codes as plain image URLs you can paste into Markdown.
Related MCP Servers
- AlicenseAqualityDmaintenanceConverts Markdown files into professional diagrams such as flowcharts, mind maps, and architecture diagrams using Mermaid.js and custom SVG renderers. It enables users to list, render, and export visualizations in multiple formats including SVG, PNG, and PDF.3MIT
- AlicenseAqualityDmaintenanceRenders Mermaid diagram markup to PNG images using Puppeteer/Chromium. Enables AI-generated diagrams to be previewed inline and saved to disk.114 npmMIT
- FlicenseBqualityCmaintenanceEnables creating and maintaining technical diagrams from .dot sources, with validation, rendering to SVG/PNG/PDF, and publishing into Markdown while automatically partitioning oversized graphs.6-
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants and coding tools to turn a few lines describing a system into clean, hand-sketched architecture diagrams in a consistent style, saving them as SVG or PNG files. Supports themes, automatic product icons, groups, sequence diagrams and cloud icon packs.1MIT