d2-mcp
d2-mcp
D2ダイアグラム言語用のMCPサーバーです。MCP互換のAIアシスタントからD2ダイアグラムをコンパイル、検証、探索できます。
ネイティブのD2 CLIバイナリ(Dockerイメージに自動インストール済み)を使用して、ダイアグラムをSVGおよびPNGにコンパイルします。
ツール
ツール | 説明 |
| D2ソースコード → SVG/PNG。レイアウトエンジン、テーマ、スケッチモード、ダークテーマ、マルチボードターゲットなどをサポート。 |
| レンダリングせずにD2構文をチェック。有効性ステータスとエラーの詳細を返します。 |
| 利用可能なすべてのD2テーマ(ライトおよびダーク)をID付きで一覧表示します。 |
| 利用可能なレイアウトエンジン( |
| icons.terrastruct.comのアイコンをカテゴリ(AWS、GCP、Azure、K8s、dev、essentials、tech)別に閲覧します。 |
Related MCP server: PlantUML MCP Server
リソース
リソース | 説明 |
| Markdown形式の完全なD2言語構文リファレンス。 |
ローカル開発
前提条件
Node.js 22+
D2 CLI — d2lang.com からインストールするか、
D2_PATH環境変数にバイナリの場所を設定してください。アイコン(オプション) —
scripts/download-icons.sh ./iconsを実行し、ICONS_DIR=./iconsを設定してローカルアイコン解決を有効にします。これを行わない場合、アイコンURLはそのままD2 CLIに渡されます。
npm install
npm run build
npm start自動リロード付きの開発用:
npm run devサーバーはデフォルトでポート3000で起動します(PORT環境変数で上書き可能)。
ヘルスチェック:
GET /healthMCPエンドポイント:
POST /mcp(ストリーミング可能なHTTPトランスポート)
環境変数
変数 | デフォルト | 説明 |
|
| HTTPサーバーポート |
|
| D2 CLIバイナリへのパス(デフォルトでは |
|
| ローカル解決用にダウンロードされたSVGアイコンを含むディレクトリ |
デプロイ (Render)
このプロジェクトには、Render へのワンクリックデプロイ用の Dockerfile と render.yaml ブループリントが含まれています。Dockerイメージは、ビルド時に自動的にD2 CLIバイナリをインストールし、すべてのアイコンをダウンロードします。
このリポジトリをGitHubにプッシュします
Renderで新しい Blueprint を作成し、リポジトリを接続します
Renderが自動的に
render.yamlを検出し、デプロイします
または、以下のように Web Service を手動で作成します:
環境: Docker
ヘルスチェックパス:
/healthプラン: Free
MCPサーバーへの接続
デプロイ後、ストリーミング可能なHTTP経由で接続するようにMCPクライアントを設定します:
{
"mcpServers": {
"d2": {
"url": "https://your-service.onrender.com/mcp"
}
}
}URLを実際のRenderサービスURL(ローカルの場合は http://localhost:3000/mcp)に置き換えてください。
Compileツールのオプション
パラメータ | 型 | 説明 | |
| string | D2ソースコード(必須) | |
|
|
| レイアウトエンジン(デフォルト: dagre) |
| boolean | 手書きスケッチモード | |
| integer | テーマID( | |
| integer | ダークモードテーマID | |
| integer | パディング(ピクセル単位、デフォルト: 100) | |
| boolean | SVGをビューボックスの中央に配置 | |
| number | スケール係数(デフォルト: 画面に合わせる) | |
| string | マルチボードダイアグラムのターゲットボード | |
| integer | マルチボードSVGのアニメーション間隔(ms) | |
| boolean | HTML埋め込み用にXML宣言を省略 |
ライセンス
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI assistants to generate and render Mermaid diagrams (flowcharts, sequence diagrams, etc.) as PNG/SVG images with local file saving and HTTP access URLs. Supports batch processing and intelligent caching for efficient diagram creation.1121MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to generate UML diagrams from text descriptions using PlantUML, supporting multiple output formats (PNG, SVG, PDF), syntax validation, and diagram source extraction.11MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to create and validate workflow diagrams using FlowZap's text-based DSL. Generates shareable playground URLs for visualizing flowcharts, process diagrams, and CI/CD pipelines through natural language descriptions.73175MIT
- FlicenseNot gradedqualityDmaintenanceEnables the dynamic generation of various software development diagrams, such as flowcharts, sequence diagrams, and architecture diagrams, using Mermaid syntax. It includes tools for diagram validation and provides instructions for exporting results to multiple formats including SVG and PNG.
Related MCP Connectors
Generate dynamic Mermaid diagrams and charts with AI assistance. Customize styles and export diagr…
Create, validate, edit, export (markdown/svg/png/mermaid), and search JSON Canvas files.
Let Claude, Cursor, or ChatGPT author Mermaid diagrams your team can read and share.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ryanmccauley/d2-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server