Generates sequence diagrams from Mermaid syntax or natural language descriptions, with support for multiple output formats (SVG, PNG), customizable themes, and syntax validation.
MCP Sequence Diagram Server
A Model Context Protocol (MCP) server that generates sequence diagram images using Mermaid syntax.
Features
Generate sequence diagrams from Mermaid syntax
Convert natural language descriptions to sequence diagrams
Support for multiple output formats (SVG, PNG)
Customizable themes and dimensions
Syntax validation
File output with custom naming
Installation
Clone or create the project directory:
Install dependencies:
Make the script executable:
Usage
As MCP Server
Add to your MCP client configuration:
Available Tools
1. generate_sequence_diagram
Generate a sequence diagram from Mermaid syntax.
Parameters:
diagram(required): Mermaid sequence diagram syntaxformat(optional): Output format ('svg' or 'png', default: 'svg')filename(optional): Custom filename for outputwidth(optional): Image width in pixels (default: 800)height(optional): Image height in pixels (default: 600)theme(optional): Mermaid theme ('default', 'dark', 'forest', 'neutral')
Example:
2. create_diagram_from_description
Create a sequence diagram from natural language description.
Parameters:
description(required): Natural language descriptionparticipants(optional): Array of participant namesformat(optional): Output format ('svg' or 'png')filename(optional): Custom filename
Example:
3. validate_mermaid_syntax
Validate Mermaid sequence diagram syntax.
Parameters:
diagram(required): Mermaid syntax to validate
Mermaid Sequence Diagram Syntax
Basic Syntax
Message Types
A->>B: message- Solid arrow (synchronous)A-->>B: message- Dashed arrow (asynchronous response)A-)B: message- Open arrow (asynchronous)A-xB: message- Cross arrow (lost message)
Advanced Features
Examples
Example 1: API Authentication Flow
Example 2: Natural Language
Development
Running in Development Mode
Testing the Server
You can test the server using any MCP client or by running it directly:
Troubleshooting
Common Issues
Puppeteer Installation: If Puppeteer fails to install, try:
Linux Dependencies: On Linux, you may need additional packages:
Memory Issues: For large diagrams, you may need to increase Node.js memory:
License
MIT License