HD

h0rv/d2-mcp

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

24 stars 4 forks 品質 80 トレンド 8MIT

D2: 決定的なダイアグラムで動作するモデルコンテキストプロトコル(MCP)サーバーは、図作成のシームレスな統合と開発ワークフローへの検証を可能にします.

概要

D2: 決定的なダイアグラムで動作するモデルコンテキストプロトコル(MCP)サーバーは、図作成のシームレスな統合と開発ワークフローへの検証を可能にします。 * コンパイル D2 コード * レンダリング前に D2 の構文を検証し、エラーをキャッチ* グラフ構造と構文に関する即時フィードバックを得る * D2 ファイルへの直接コードまたはファイルパスを受け入れる * レンダリング図 * ビジュアルフィードバックと改良のための図を生成 * サポート PNG、SVG、および ASCII 出力形式 * D2 ファイルへの直接コードまたはファイルパスを受け入れる * パッチ D2 チートシート * リターン * マークダウン参照の形状、スタイリング、および使用状況を追跡するマークダウン および使用状況 それぞれの MCP クライアントに d2 MCP サーバーを追加します。 サーバは librsvg-convert が librsvg のデフォルトで PNG 出力を返します。 rsvg-convert が見つからない場合、サーバーは、render-d2 ツールの形式の enum から png を自動的に削除し、SVG に戻ります.

概要(AI 翻訳)

D2 ダイアグラムの有効化とレンダリングを行うための小さな Go MCP サーバー。 完全なソースとレンダリングオプションを送信し、PNG、SVG、またはテキストを受信します。 デフォルトのサーバーは、文書、アーティファクト、またはHTTPセッションを一切保持しません。 D2実行可能、ブラウザ、またはPNGコンバーターは必要ありません。

d2-mcp 2.0.0はD2 0.9.0、Go 1.27.2、および公式Go MCP SDK 1.8.0を使用します。 D2のDagre、ELK、オープンソースのTALAレイアウトがバンドルされています。 入力と制限を参照してください。

インストール

2.0.0 バイナリをインストールまたはソースからビルドし、Claude、Codex、Pi、またはVS コードを接続します。 2.0.0 と 1.2.0 の移行ノートで出荷したものを参照してください。

バイナリをインストールせずにホストされた使用のために、 [https://d2.horv.co/mcp] に接続します。 リモート HTTP クライアント コマンドを使用する。

クライアントと輸送

Stdioはデフォルトのままです。 [mcpServers]を使用してデスクトップまたは別のクライアントの場合:

ステートレス ストリーム可能な HTTP エンドポイントの場合:

ストリーム可能な HTTP MCP クライアントを http://127.0.0.1:8080/mcp に接続します。 たとえば、VS コード .vscode/mcp.json エントリ:

HTTP は JSON 応答、セッション ID なし、バックグラウンドイベントストリームを使用しません。 各呼び出しは、ソース/オプションを実行します。 その後の呼び出しは、別のレプリカに行くかもしれません。 [/mcpのGET/DELETEは405を返します.

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

d2-mcp

A small Go MCP server for validating and rendering D2 diagrams. Send complete source and rendering options; receive PNG, SVG, or text. The default server keeps no documents, artifacts, or HTTP sessions. It needs no D2 executable, browser, or PNG converter.

d2-mcp 2.0.0 uses D2 0.9.0, Go 1.27.2, and the official Go MCP SDK 1.8.0. D2’s Dagre, ELK, and open-source TALA layouts are bundled. See inputs and limits.

Install

Install a 2.0.0 binary or build from source, then connect Claude, Codex, Pi, or VS Code. See what shipped in 2.0.0 and the 1.2.0 migration notes.

For hosted use without installing a binary, connect to https://d2.horv.co/mcp using the remote HTTP client commands.

Clients and transports

Stdio remains the default. For Claude Desktop or another client using mcpServers:

{
  "mcpServers": {
    "d2": {
      "command": "/absolute/path/d2-mcp",
      "args": ["--image-type", "png"]
    }
  }
}

For a stateless Streamable HTTP endpoint:

./d2-mcp --transport http --host 127.0.0.1 --port 8080

Connect a Streamable HTTP MCP client to http://127.0.0.1:8080/mcp. For example, a VS Code .vscode/mcp.json entry:

{
  "servers": {
    "d2": {"type": "http", "url": "http://127.0.0.1:8080/mcp"}
  }
}

HTTP uses JSON responses, no session ID, and no background event stream. Every call carries its source/options; subsequent calls may go to another replica. GET/DELETE on /mcp return 405. Current MCP 2026-07-28 discovery and legacy initialization are handled by the SDK; integration tests cover 2025-03-26, 2025-06-18, 2025-11-25, and 2026-07-28 over HTTP. Stdio and legacy SSE retain their supported initialization protocols.

Send exactly one JSON-RPC object per HTTP POST. Batches are rejected on every protocol version, including legacy SSE message posts, to prevent unbounded aggregation of tool results. Disconnects cancel current-protocol (2026-07-28) work cooperatively; the SDK retains older protocol calls until their application deadline.

Legacy SSE remains available at /sse with --transport sse (or --sse). Its SDK-managed connections are stateful and need a stable server connection. Prefer HTTP for new integrations. MCP_TRANSPORT, PORT, and legacy SSE_MODE/SSE_PORT are still accepted; explicit transport/port flags take precedence, and --sse selects SSE.

GitHub で README 全文を見る

インストール

docker run --rm -i d2-mcp
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "d2": { "command": "/absolute/path/d2-mcp", "args": ["--image-type", "png"] } } }