d2-mcp-server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| D2_PATH | No | Path to the d2 binary (only needed for d2_format tool) |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| d2_renderA | Render D2 diagram source code to SVG or ASCII art using the D2 WASM engine. D2 is a diagram scripting language. This tool compiles and renders D2 code without requiring the d2 binary — it uses the @terrastruct/d2 WASM package directly. Args:
Returns: SVG markup string (or ASCII art if ascii=true). SVG output starts with (unless no_xml_tag=true) Examples:
Error Handling:
|
| d2_validateA | Validate D2 diagram source code for syntax and semantic errors using the WASM engine. Uses compile step to detect all errors without rendering. No d2 binary required. Args:
Returns: JSON object: { "valid": boolean, // Whether the code is syntactically and semantically valid "error": string // Error message if invalid (omitted if valid) } Examples:
Error Handling:
|
| d2_inspectA | Parse and summarize the structure of D2 source code without rendering. Returns a human-readable text summary of all shapes, containers, connections, and boards (layers/steps/scenarios) in the diagram. Uses the compile step only — no rendering occurs, so this is fast (~100ms) regardless of diagram complexity. Use this INSTEAD of d2_render(ascii=true) for structural previews. The ASCII renderer has known bugs with cross-container connections and reverse edges. This tool produces reliable output for all diagram types. Args:
Returns: Structured text summary, e.g.: Shapes (4): - cp [rectangle] "Control Plane" - cp.listener [rectangle] "API Gateway" - cp.grpc [rectangle] "gRPC Server" - agent [rectangle] "Data Plane Agent" Works correctly for all diagram types:
Error handling:
|
| d2_formatA | Format D2 diagram source code using the d2 binary formatter. Normalizes whitespace, indentation, and syntax to D2's canonical style. The formatted output is semantically equivalent to the input. NOTE: This tool requires the d2 binary to be installed (unlike d2_render and d2_validate which use WASM). Install from https://d2lang.com or set D2_PATH env var. Args:
Returns: Formatted D2 source code string. Examples:
Error Handling:
|
| d2_list_themesA | List all available D2 diagram themes with their IDs and names. Use theme IDs with d2_render's theme_id parameter. No d2 binary required — theme list is built-in. Args: (none) Returns: JSON object: { "light": [{ "id": number, "name": string }], "dark": [{ "id": number, "name": string }] } Notable themes:
|
| d2_list_layoutsA | List available D2 layout engines with descriptions and feature support. Use layout names with d2_render's layout parameter. No d2 binary required — layout list is built-in. Args: (none) Returns: JSON object: { "layouts": [{ "name": string, "description": string, "features": string[] // Supported features }] } Layout guidance:
|
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ItsJooL/d2-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server