
i2y/d2mcp
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
D2図生成と操作機能を提供するモデルコンテキストプロトコル(MCP)サーバー.
概要
D2図生成と操作機能を提供するモデルコンテキストプロトコル(MCP)サーバー。 D2は、テキストをダイアグラムに変える近代的な図形です。 このMCPサーバーは、ClaudeのようなAIアシスタントがプログラム的にD2図を作成、レンダリング、エクスポート、および保存することができます。 サーバは、MCP プロトコルを介して 10 個のツールを提供し、最適な AI アシスタントの統合のための説明を強化し、Oracle API を使用して、シンプルな図レンダリングと洗練された増分図の両方を可能にします.
概要(AI 翻訳)
D2図生成と操作機能を提供するモデルコンテキストプロトコル(MCP)サーバー。
D2は、テキストをダイアグラムに変える近代的な図形です。 このMCPサーバーは、ClaudeのようなAIアシスタントがプログラム的にD2図を作成、レンダリング、エクスポート、および保存することができます。
サーバは、MCP プロトコルを介して 10 個のツールを提供し、最適な AI アシスタントの統合のための説明を強化し、Oracle API を使用して、シンプルな図レンダリングと洗練された増分図の両方を可能にします。
Oracle API の統合により、AI アシスタントは、図を増分的に構築・変更できるようになりました。これにより、以下のような機能が完璧に実現できます。
- アーキテクチャ図に会話を変換する
- 要件が議論されているように、フローチャートを段階的に構築
- データベーススキーマからエンティティティティリレーション図を作成する
- コード解析からシステム図を生成
- 開始することなく、ユーザーのフィードバックに基づいて図を定義する
##特徴
##基本図操作
- d2 create - オプションの初期コンテンツ(統一されたアプローチ)で新しい図を作成
- d2 export - 様々なフォーマットに図をエクスポート(SVG、PNG、PDF)
- d2 save - 既存の図をファイルに保存する
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
D2 MCP Server
A Model Context Protocol (MCP) server that provides D2 diagram generation and manipulation capabilities.
D2 is a modern diagram scripting language that turns text to diagrams. This MCP server allows AI assistants like Claude to create, render, export, and save D2 diagrams programmatically.
The server provides 10 tools through the MCP protocol with enhanced descriptions for optimal AI assistant integration, enabling both simple diagram rendering and sophisticated incremental diagram building using the Oracle API.
With the new Oracle API integration, AI assistants can now build and modify diagrams incrementally, making it perfect for:
- Converting conversations into architecture diagrams
- Building flowcharts step-by-step as requirements are discussed
- Creating entity relationship diagrams from database schemas
- Generating system diagrams from code analysis
- Refining diagrams based on user feedback without starting over
Features
Basic Diagram Operations
- d2_create - Create new diagrams with optional initial content (unified approach)
- d2_export - Export diagrams to various formats (SVG, PNG, PDF)
- d2_save - Save existing diagrams to files
Oracle API for Incremental Editing
- d2_oracle_create - Create shapes and connections incrementally
- d2_oracle_set - Set attributes on existing elements
- d2_oracle_delete - Delete specific elements from diagrams
- d2_oracle_move - Move shapes between containers
- d2_oracle_rename - Rename diagram elements
- d2_oracle_get_info - Get information about shapes, connections, or containers
- d2_oracle_serialize - Get the current D2 text representation of the diagram
Additional Features
- 20 themes - Support for all D2 themes (18 light + 2 dark)
Project Structure
d2mcp/
├── cmd/ # Application entry point
├── internal/
│ ├── domain/ # Business entities and interfaces
│ │ ├── entity/ # Domain entities
│ │ └── repository/ # Repository interfaces
│ ├── usecase/ # Business logic
│ ├── infrastructure/ # External implementations
│ │ ├── d2/ # D2 library integration
│ │ └── mcp/ # MCP server implementation
│ └── presentation/ # MCP handlers
│ └── handler/ # Tool handlers
└── pkg/ # Public packages
Prerequisites
- Go 1.24.3 or higher
- D2 v0.6.7 or higher (included as dependency)
- For PNG/PDF export (optional):
rsvg-convert(from librsvg) or- ImageMagick (
convertcommand)
Installation
From Source
# Clone the repository
git clone https://github.com/i2y/d2mcp.git
cd d2mcp
# Build the binary
make build
# Or build for all platforms
make build-all
Using Go Install
go install github.com/i2y/d2mcp/cmd@latest
Building
# Simple build
make build
# Run directly
make run
# Cross-platform builds
make build-all
Usage
With Claude Desktop
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →設定
{
"mcpServers": {
"d2mcp": {
"command": "/path/to/d2mcp",
"args": ["-transport=stdio"]
}
}
}