d2-mcp-server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@d2-mcp-serverrender a D2 diagram of a simple client-server architecture"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
d2-mcp-server
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 |
| Compile and render D2 source to SVG | No |
| Parse D2 and return a structured text summary of shapes/connections (fast preview, no rendering) | No |
| Check D2 syntax and return errors | No |
| Canonically format D2 source code | Yes |
| List all available themes with IDs | No |
| List available layout engines | No |
Related MCP server: mcp-mermaid-validator
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-mcpThis 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 buildUsage 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.jsonDevelopment
npm run dev # watch mode with tsx
npm run build # compile TypeScript to dist/
npm start # run compiled serverNotes
ELK layout is significantly slower than dagre in WASM; prefer dagre unless you specifically need ancestor-to-descendant connections or container sizing
License
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
- AlicenseCqualityFmaintenanceEnables AI agents and assistants like Goose or Claude to interact with VS Code through the Model Context Protocol.Last updated762375Apache 2.0
- AlicenseBqualityCmaintenanceA Model Context Protocol server that validates and renders Mermaid diagrams.Last updated174456MIT
- Alicense-qualityCmaintenanceEnables programmatic control of the WezTerm terminal emulator through the Model Context Protocol. It allows users to manage panes, tabs, and windows while reading terminal content or sending commands directly to the terminal environment.Last updated291MIT
- AlicenseCqualityDmaintenanceEnables AI models to create and manage various types of diagrams (flowcharts, UML, network diagrams, etc.) via the Model Context Protocol.Last updated261036ISC
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
Read-only MCP server for the WebAssembly spec: instructions, types, sections, search, proposals.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
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/ItsJooL/d2-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server