d2-mcp
Give your agent a diagram tool. Connect once, then turn your project or notes into a diagram with D2.
1. Connect your agent
Use the hosted server. No D2 installation or API key needed.
Claude Code
Run in your terminal:
claude mcp add --scope user --transport http d2 https://d2.horv.co/mcp
Open Claude Code and check /mcp. Setup help
ChatGPT
- On ChatGPT web, open Plugins → + → Add custom MCP server.
- Name it
d2. Paste the MCP URL below under Connection; this server needs no authentication. - Review the warning, create and install the plugin, then choose
@d2in a new chat.
Requires an account or workspace that allows custom MCP servers. Availability and setup help
Codex
Run in your terminal:
codex mcp add d2 --url https://d2.horv.co/mcp
Start a new Codex session and check /mcp. Setup help
pi
With a current pi version that supports MCP, run:
pi mcp add d2 --exposure direct --url https://d2.horv.co/mcp
Start pi, or use /reload, then check /mcp. Setup help
MCP URL
https://d2.horv.co/mcp
2. Map a project you’re working on
Open your project in your agent, or paste a description into chat. Then try:
Turn the project or notes in this conversation into a clear system diagram. Use the d2 MCP tools to map the main components and label how data moves between them. Ask about missing details instead of inventing them. Validate the D2, render a PNG, and return the image plus the D2 source. Then point out one bottleneck or single point of failure.
Your agent sends diagram source to the hosted renderer. The server does not save your source or output.