Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

D2

MCP server by d2lang Community

Renders D2 text diagrams to SVG, validates D2 source, and ships an agent skill for AI clients. Aimed at developers and writers who create diagrams from text in docs, CI and blog posts.

  • Score 94
  • 26k stars
  • MPL-2.0
  • Updated

Install D2

Built from the published package, never by AI.

claude mcp add d2 -- uvx d2lang

Run in your terminal. Add --scope user to use it in every project.

Step-by-step: install D2 in Claude Code

MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the d2 block.

About

D2 is a modern diagram scripting language that turns text into diagrams. You write D2 source in a file and run the d2 command to create an SVG. The CLI also includes d2 validate, which checks a diagram for errors and warnings and can output diagnostics as JSON, and d2 --watch, which gives a live browser preview.

D2 can also be used as a library from Go through d2lib, or from JavaScript and TypeScript through @d2lang/d2. The project lists an official agent skill that installs with npx skills add d2lang/d2 for several AI coding clients. The source does not describe MCP tools, storyboards or motion lint, so those parts of the listing are not confirmed here. D2 is open source under the Mozilla Public License 2.0 and is aimed at people who make diagrams, docs and blog posts from text.

Written from the project's README and checked against it.

What you need

  • macOS or Linux for the install script
  • x64 Windows for the MSI installer
  • uv, optional, to run the CLI with uvx d2lang

Try asking

  • Validate this D2 diagram and list any errors or warnings.
  • Render this D2 script to an SVG file named hello.svg.
  • Show me how to connect shapes with labels in D2 syntax.

Good to know

  • The source does not mention an MCP server, so the MCP listing is not confirmed by it.
  • Storyboards and motion lint from the listing description do not appear in the source.
  • After installation, D2 does not use the internet except to check for version updates.

Security check

C
  • Downloads a script from the internet and runs itIn README.md: curl -fsSL https://d2lang.com/install.sh | sh

Checked automatically: README.md. This looks for known risky patterns and is not a full audit. How grades work

What you can do with it

  • Turning text into architecture diagrams
  • Validating D2 diagram source in CI
  • Rendering diagrams for docs and blog posts

Alternatives to D2

All alternatives →

Compare with GitDiagram, mockserver or XcodeBuildMCP

D2: common questions

Does D2 collect telemetry?

No. The source says D2 does not use an internet connection after installation, except to check for version updates from GitHub periodically.

Does D2 need a browser to run?

No. The source says D2 can run entirely server-side.

Where can I get help with D2?

The source says the best way to get help is to ask on the D2 Discord. Feature requests and bug reports go to GitHub Issues.

How do I install D2?

In Claude Code run claude mcp add d2 -- uvx d2lang. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.

Is D2 the official server?

D2 is a community project by d2lang, not verified by a company domain.

Is D2 free?

The code is published under the MPL-2.0 licence. The service it connects to may have its own pricing.

Is D2 safe to use?

It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade C (downloads a script from the internet and runs it). Review the code before you install. How grades work.

What are alternatives to D2?

Similar MCP servers: GitDiagram, mockserver, XcodeBuildMCP, draw.io.

Does D2 work with ChatGPT?

Not directly. It runs locally, and ChatGPT only connects to remote servers with a URL. Use it in Claude Code, Claude Desktop, Cursor, VS Code or Codex.

Add to stack

Loading.