D

D2mcp

by RecursiveFunctions · io.github.RecursiveFunctions/d2mcp

Enables AI assistants to create, validate, render, export, save, and incrementally edit D2 diagrams using complete source or the Oracle API, with bundled layouts, themes, and workspace-secured assets.

oci Local · stdio GlamaOfficial MCP Registry High confidence

Install

Add to ~/Library/Application Support/Claude/claude_desktop_config.json

Windows / Linux path
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "io-github-recursivefunctions-d2mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "-e",
        "addr=<YOUR_VALUE>",
        "-e",
        "base-url=<YOUR_VALUE>",
        "-e",
        "base-path=<YOUR_VALUE>",
        "-e",
        "stateless=<YOUR_VALUE>",
        "-e",
        "transport=<YOUR_VALUE>",
        "-e",
        "keep-alive=<YOUR_VALUE>",
        "-e",
        "endpoint-path=<YOUR_VALUE>",
        "-e",
        "workspace-root=<YOUR_VALUE>",
        "-e",
        "heartbeat-interval=<YOUR_VALUE>",
        "-e",
        "remote-asset-timeout=<YOUR_VALUE>",
        "-e",
        "remote-asset-max-bytes=<YOUR_VALUE>",
        "ghcr.io/recursivefunctions/d2mcp:0.5.0"
      ]
    }
  }
}

Restart Claude Desktop to activate the new server.

Add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)

Windows / Linux path
Windows: .cursor\mcp.json (project) or %USERPROFILE%\.cursor\mcp.json (global)
Linux: .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)
{
  "mcpServers": {
    "io-github-recursivefunctions-d2mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "-e",
        "addr=<YOUR_VALUE>",
        "-e",
        "base-url=<YOUR_VALUE>",
        "-e",
        "base-path=<YOUR_VALUE>",
        "-e",
        "stateless=<YOUR_VALUE>",
        "-e",
        "transport=<YOUR_VALUE>",
        "-e",
        "keep-alive=<YOUR_VALUE>",
        "-e",
        "endpoint-path=<YOUR_VALUE>",
        "-e",
        "workspace-root=<YOUR_VALUE>",
        "-e",
        "heartbeat-interval=<YOUR_VALUE>",
        "-e",
        "remote-asset-timeout=<YOUR_VALUE>",
        "-e",
        "remote-asset-max-bytes=<YOUR_VALUE>",
        "ghcr.io/recursivefunctions/d2mcp:0.5.0"
      ]
    }
  }
}

Cursor usually picks up config changes automatically; if the server does not appear, reload the window.

Add to .mcp.json (project) or ~/.claude.json (global)

Windows / Linux path
Windows: .mcp.json (project) or %USERPROFILE%\.claude.json (global)
Linux: .mcp.json (project) or ~/.claude.json (global)
{
  "mcpServers": {
    "io-github-recursivefunctions-d2mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "-e",
        "addr=<YOUR_VALUE>",
        "-e",
        "base-url=<YOUR_VALUE>",
        "-e",
        "base-path=<YOUR_VALUE>",
        "-e",
        "stateless=<YOUR_VALUE>",
        "-e",
        "transport=<YOUR_VALUE>",
        "-e",
        "keep-alive=<YOUR_VALUE>",
        "-e",
        "endpoint-path=<YOUR_VALUE>",
        "-e",
        "workspace-root=<YOUR_VALUE>",
        "-e",
        "heartbeat-interval=<YOUR_VALUE>",
        "-e",
        "remote-asset-timeout=<YOUR_VALUE>",
        "-e",
        "remote-asset-max-bytes=<YOUR_VALUE>",
        "ghcr.io/recursivefunctions/d2mcp:0.5.0"
      ]
    }
  }
}

The server will be available in the next Claude Code session.

Add to .vscode/mcp.json

Windows / Linux path
Windows: .vscode\mcp.json
Linux: .vscode/mcp.json
{
  "servers": {
    "io-github-recursivefunctions-d2mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "-e",
        "addr=<YOUR_VALUE>",
        "-e",
        "base-url=<YOUR_VALUE>",
        "-e",
        "base-path=<YOUR_VALUE>",
        "-e",
        "stateless=<YOUR_VALUE>",
        "-e",
        "transport=<YOUR_VALUE>",
        "-e",
        "keep-alive=<YOUR_VALUE>",
        "-e",
        "endpoint-path=<YOUR_VALUE>",
        "-e",
        "workspace-root=<YOUR_VALUE>",
        "-e",
        "heartbeat-interval=<YOUR_VALUE>",
        "-e",
        "remote-asset-timeout=<YOUR_VALUE>",
        "-e",
        "remote-asset-max-bytes=<YOUR_VALUE>",
        "ghcr.io/recursivefunctions/d2mcp:0.5.0"
      ]
    }
  }
}

Reload the VS Code window to activate.

Add to ~/.codeium/windsurf/mcp_config.json

Windows / Linux path
Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json
Linux: ~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "io-github-recursivefunctions-d2mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "-e",
        "addr=<YOUR_VALUE>",
        "-e",
        "base-url=<YOUR_VALUE>",
        "-e",
        "base-path=<YOUR_VALUE>",
        "-e",
        "stateless=<YOUR_VALUE>",
        "-e",
        "transport=<YOUR_VALUE>",
        "-e",
        "keep-alive=<YOUR_VALUE>",
        "-e",
        "endpoint-path=<YOUR_VALUE>",
        "-e",
        "workspace-root=<YOUR_VALUE>",
        "-e",
        "heartbeat-interval=<YOUR_VALUE>",
        "-e",
        "remote-asset-timeout=<YOUR_VALUE>",
        "-e",
        "remote-asset-max-bytes=<YOUR_VALUE>",
        "ghcr.io/recursivefunctions/d2mcp:0.5.0"
      ]
    }
  }
}

Restart Windsurf (or refresh its MCP servers panel) to activate the new server.

Windsurf Next uses ~/.codeium/windsurf-next/mcp_config.json. Devin Desktop (the Windsurf rebrand) uses ~/.config/devin/mcp_config.json and imports the Windsurf file.

Add to ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

Windows / Linux path
Windows: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
{
  "mcpServers": {
    "io-github-recursivefunctions-d2mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "-e",
        "addr=<YOUR_VALUE>",
        "-e",
        "base-url=<YOUR_VALUE>",
        "-e",
        "base-path=<YOUR_VALUE>",
        "-e",
        "stateless=<YOUR_VALUE>",
        "-e",
        "transport=<YOUR_VALUE>",
        "-e",
        "keep-alive=<YOUR_VALUE>",
        "-e",
        "endpoint-path=<YOUR_VALUE>",
        "-e",
        "workspace-root=<YOUR_VALUE>",
        "-e",
        "heartbeat-interval=<YOUR_VALUE>",
        "-e",
        "remote-asset-timeout=<YOUR_VALUE>",
        "-e",
        "remote-asset-max-bytes=<YOUR_VALUE>",
        "ghcr.io/recursivefunctions/d2mcp:0.5.0"
      ]
    }
  }
}

Cline reloads cline_mcp_settings.json automatically; if the server does not appear, reload the VS Code window.

Open it from Cline's MCP Servers panel → Configure. Roo Code uses a different file and format.

Configuration

Environment variables this server reads. Secrets stay on your machine.

NameRequiredDescription
addr No Address to listen on (default: ":3000") Default: :3000
base-url No Base URL for SSE endpoints (auto-generated if not specified)
base-path No Base path for SSE endpoints (default: "/mcp") Default: /mcp
stateless No Enable stateless mode (default: false) Default: false
transport No Transport protocol: stdio, sse, or streamable. Default: sse. Default: sse
keep-alive No Keep-alive interval in seconds (default: 30) Default: 30
endpoint-path No Endpoint path for Streamable HTTP (default: "/mcp") Default: /mcp
workspace-root No Confine imports, local images, and saved files to named workspace roots. Format: name=path. Can be repeated. Default root is the server's current working directory.
heartbeat-interval No Heartbeat interval in seconds (default: 30) Default: 30
remote-asset-timeout No Timeout for remote assets (e.g., 30s).
remote-asset-max-bytes No Maximum bytes for remote assets.

Similar servers