Skip to content

h0rv/d2-mcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

d2-mcp

A Model Context Protocol (MCP) server for working with D2: Declarative Diagramming, enabling seamless integration of diagram creation and validation into your development workflow.

Tools:

  • Compile D2 Code
    • Validate D2 syntax and catch errors before rendering
    • Get immediate feedback on diagram structure and syntax
  • Render Diagrams
    • Generate diagrams for visual feedback and refinement
    • Support for both vector (SVG) and raster (PNG) output formats

Install

Option 1: Install Binary Release

Option 2: Install via go

go install github.com/h0rv/d2-mcp@latest

Option 3: Build Locally

git clone https://github.com/h0rv/d2-mcp.git
cd d2-mcp
go build .

Setup with MCP Client

MacOS:

# Claude Desktop
$EDITOR ~/Library/Application\ Support/Claude/claude_desktop_config.json
# OTerm:
$EDITOR ~/Library/Application\ Support/oterm/config.json

Add the d2 MCP server to your respective MCP Clients config:

{
    "mcpServers": {
        "d2": {
            "command": "/YOUR/ABSOLUTE/PATH/d2-mcp",
            "args": ["--image-type", "png"]
        }
    }
}

Development

Debugging

npx @modelcontextprotocol/inspector /YOUR/ABSOLUTE/PATH/d2-mcp/d2-mcp

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages