D2 Server
БесплатноНе проверенEnables rendering, validation, formatting, and inspection of D2 diagrams via the Model Context Protocol, using WASM for rendering without requiring the d2 binar
Описание
Enables rendering, validation, formatting, and inspection of D2 diagrams via the Model Context Protocol, using WASM for rendering without requiring the d2 binary.
README
An MCP (Model Context Protocol) server for the D2 diagram language. Lets LLMs render, validate, and format D2 diagrams without requiring the d2 binary — rendering is powered by the @terrastruct/d2 WASM package.
Tools
| Tool | Description | Requires d2 binary? |
|---|---|---|
d2_render |
Compile and render D2 source to SVG | No |
d2_inspect |
Parse D2 and return a structured text summary of shapes/connections (fast preview, no rendering) | No |
d2_validate |
Check D2 syntax and return errors | No |
d2_format |
Canonically format D2 source code | Yes |
d2_list_themes |
List all available themes with IDs | No |
d2_list_layouts |
List available layout engines | No |
Install the D2 Skill
The repo ships a d2 agent skill that teaches LLMs how to write effective D2 diagrams (syntax, styling, patterns, when to use which layout engine, and how to save output).
Install it via skills.sh:
npx skills add itsjool/d2-mcp
This drops skills/d2/SKILL.md into your agent's skills directory so it's automatically available in any session.
Requirements
- Node.js 18+
d2binary only required ford2_format— install from d2lang.com or setD2_PATHenv var
Install
npm install
npm run build
Usage with Claude Code
Via npx (no install required):
{
"mcpServers": {
"d2": {
"command": "npx",
"args": ["-y", "github:itsjool/d2-mcp"]
}
}
}
Via local build:
{
"mcpServers": {
"d2": {
"command": "node",
"args": ["/path/to/d2-mcp/dist/index.js"]
}
}
}
Then start Claude Code with:
claude --mcp-config /path/to/mcp.json
Development
npm run dev # watch mode with tsx
npm run build # compile TypeScript to dist/
npm start # run compiled server
Notes
- ELK layout is significantly slower than dagre in WASM; prefer dagre unless you specifically need ancestor-to-descendant connections or container sizing
License
MIT
Установить D2 Server в Claude Desktop, Claude Code, Cursor
unyly install d2-mcp-serverСтавит в Claude Desktop, Claude Code, Cursor и VS Code — сам разбирается с npx, uvx и сборкой из исходников.
Впервые? Поставь CLI: curl -fsSL https://unyly.org/install | sh
Или настроить вручную
Выполни в терминале:
claude mcp add d2-mcp-server -- npx -y github:ItsJooL/d2-mcpFAQ
D2 Server MCP бесплатный?
Да, D2 Server MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для D2 Server?
Нет, D2 Server работает без API-ключей и переменных окружения.
D2 Server — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить D2 Server в Claude Desktop, Claude Code или Cursor?
Открой D2 Server на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
GitHub
PRs, issues, code search, CI status
автор: GitHubFilesystem
Secure file operations with configurable access controls.
Memory
Knowledge graph-based persistent memory system.
Template MCP Server
A CLI tool to create a new Model Context Protocol server project with TypeScript support, dual transport options, and an extensible structure
автор: mcpdotdirectCompare D2 Server with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории development
