D2mcp MCP Server

A Model Context Protocol (MCP) server that provides D2 diagram generation and manipulation capabilities.

Local serverstdioGo

What is the D2mcp MCP server?

D2mcp mcp server connects D2mcp to AI assistants that speak the Model Context Protocol. A Model Context Protocol (MCP) server that provides D2 diagram generation and manipulation capabilities.

What D2mcp does

A Model Context Protocol (MCP) server that provides D2 diagram generation and manipulation capabilities.

Tools it exposes

Once connected, the assistant can call these 11 tools directly:

  • 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
  • Standalone — The Standalone tool exposed by this server
  • d2_create — Create a new diagram with optional initial content (unified approach):
  • d2_export — The d2_export tool exposed by this server
  • d2_save — The d2_save tool exposed by this server

Installing the d2mcp mcp server

Setup follows the standard MCP pattern: clone or install the server, then register it in your client's configuration file and restart the client. The configuration snippets on this page cover Claude Desktop, Claude Code and Cursor.

Requirements

  • 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 (convert command)

Where it fits

Developer-tool servers are usually the first ones people connect, because they turn "help me with this code" into an assistant that can actually read the repo and act on it. D2mcp sits in that group, and the shape of its toolset — d2_oracle_create, d2_oracle_set, d2_oracle_delete among others — tells you what it is really for. Worth comparing against the other developer tools servers in this directory before you commit to one, since several overlap in scope but differ sharply in setup cost and permissions.

Practical notes

  • This server runs locally, so it operates with whatever access your machine and its credentials already have. Scope that deliberately rather than by default.
  • With 11 tools exposed, expect a noticeable bump in prompt size — disable it in projects that never use D2mcp.
  • Maintained by i2y, written in Go.
  • MCP clients ask for confirmation before each tool call by default. Keep that on while you learn what the d2mcp mcp server actually does with your data.
  • Every entry in this directory is reviewed by hand before it goes live, and details are checked against the project's own documentation.

Available tools

ToolWhat it does
d2_oracle_createCreate shapes and connections incrementally
d2_oracle_setSet attributes on existing elements
d2_oracle_deleteDelete specific elements from diagrams
d2_oracle_moveMove shapes between containers
d2_oracle_renameRename diagram elements
d2_oracle_get_infoGet information about shapes, connections, or containers
d2_oracle_serializeGet the current D2 text representation of the diagram
StandaloneThe Standalone tool exposed by this server.
d2_createCreate a new diagram with optional initial content (unified approach):
d2_exportThe d2_export tool exposed by this server.
d2_saveThe d2_save tool exposed by this server.

How to install the D2mcp MCP server

**For SSE transport:**
```json
{
  "mcpServers": {
    "d2mcp": {
      "command": "/path/to/d2mcp",
      "args": ["-transport=sse", "-addr=:3000"]
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

  • 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 (convert command)

Example prompts to try

  • Use D2mcp to d2 oracle create.
  • Use D2mcp to d2 oracle set.
  • Use D2mcp to d2 oracle delete.

Frequently asked questions

It connects D2mcp to MCP-compatible AI assistants such as Claude and Cursor, exposing 11 tools (d2_oracle_create, d2_oracle_set, d2_oracle_delete, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with D2mcp directly.