d2-mcp-server

d2-mcp-server

Enables rendering, validation, formatting, and inspection of D2 diagrams via the Model Context Protocol, using WASM for rendering without requiring the d2 binary.

Category
Visit Server

README

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 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+
  • d2 binary only required for d2_format — install from d2lang.com or set D2_PATH env 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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured