
d2 diagram assistant
D2 Diagram Assistant
Repository Info
About This Server
D2 Diagram Assistant
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
D2 Diagram Assistant MCP Server
This is a Model Context Protocol (MCP) server that provides access to D2 diagram documentation and examples. It's designed to be used with AI assistants that support the MCP protocol, such as Roo Code.
Features
- Fetch comprehensive D2 diagram documentation
- Search within documentation for specific topics
- Retrieve example D2 diagram code for various diagram types
Setup
-
Copy the documentation file:
node setup.js -
Install dependencies:
npm install -
Start the server:
npm start
For stdio mode (used by Roo and other assistants):
node index.js --stdio
Available Tools
The MCP server provides the following tools:
1. fetch_d2_documentation
Fetches the entire D2 diagram documentation for general questions.
{
"tool_name": "fetch_d2_documentation",
"arguments": {}
}
2. search_d2_documentation
Semantically searches within the documentation for specific queries.
{
"tool_name": "search_d2_documentation",
"arguments": {
"query": "How to create a SQL table diagram"
}
}
3. get_d2_examples
Retrieves example D2 diagram code for various diagram types.
{
"tool_name": "get_d2_examples",
"arguments": {
"type": "network"
}
}
Available example types:
- basic
- network
- sketch
- sql
- variables
- globs
- animated
Using with Roo Code
To use this MCP server with Roo Code:
-
Start the server in stdio mode:
node index.js --stdio -
Connect Roo to this MCP server
-
Create a new task with the D2 Diagram role
D2 Diagram Examples
Basic Diagram
# Basic D2 Diagram
x -> y: hello world
Network Diagram
network: {
cell tower: {
satellites: {
shape: stored_data
style.multiple: true
}
transmitter
satellites -> transmitter: send
}
online portal: {
ui: {shape: hexagon}
}
data processor: {
storage: {
shape: cylinder
style.multiple: true
}
}
cell tower.transmitter -> data processor.storage: phone logs
}
user: {
shape: person
width: 130
}
user -> network.cell tower: make call
For more examples, use the get_d2_examples tool.
Quick Start
Clone the repository
git clone https://github.com/gdbenson/d2-diagram-assistantInstall dependencies
cd d2-diagram-assistant
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.