MCP Sequence Diagram Server
Generates sequence diagram images from Mermaid syntax or natural language descriptions, supporting multiple output formats (SVG, PNG) with customizable themes and dimensions.
README
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:
mkdir mcp-sequence-diagram-server
cd mcp-sequence-diagram-server
- Install dependencies:
npm install
- Make the script executable:
chmod +x index.js
Usage
As MCP Server
Add to your MCP client configuration:
{
"mcpServers": {
"sequence-diagram": {
"command": "node",
"args": ["index.js"],
"cwd": "/path/to/your/mcp-sequence-diagram-server"
}
}
}
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:
{
"diagram": "sequenceDiagram\n Alice->>Bob: Hello Bob, how are you?\n Bob-->>Alice: Great!",
"format": "svg",
"filename": "greeting_sequence"
}
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:
{
"description": "User logs in. Server validates credentials. Server returns authentication token.",
"participants": ["User", "Server"],
"format": "png"
}
3. validate_mermaid_syntax
Validate Mermaid sequence diagram syntax.
Parameters:
diagram(required): Mermaid syntax to validate
Mermaid Sequence Diagram Syntax
Basic Syntax
sequenceDiagram
participant A as Alice
participant B as Bob
A->>B: Hello Bob, how are you?
B-->>A: Great!
A-)B: See you later!
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
sequenceDiagram
participant C as Client
participant S as Server
participant D as Database
C->>S: Login Request
alt successful case
S->>D: Query User
D-->>S: User Data
S-->>C: Login Success
else failure case
S-->>C: Login Failed
end
Note over C,S: Session established
loop every minute
C->>S: Heartbeat
S-->>C: ACK
end
Examples
Example 1: API Authentication Flow
{
"diagram": `sequenceDiagram
participant Client
participant API
participant Auth
participant Database
Client->>API: POST /login
API->>Auth: Validate credentials
Auth->>Database: Query user
Database-->>Auth: User data
Auth-->>API: Token
API-->>Client: 200 OK + JWT`,
"format": "svg",
"filename": "auth_flow"
}
Example 2: Natural Language
{
"description": "Customer places order. System checks inventory. Payment is processed. Order confirmation is sent.",
"participants": ["Customer", "System", "Payment", "Inventory"],
"format": "png"
}
Development
Running in Development Mode
npm run dev
Testing the Server
You can test the server using any MCP client or by running it directly:
node index.js
Troubleshooting
Common Issues
- Puppeteer Installation: If Puppeteer fails to install, try:
npm install puppeteer --unsafe-perm=true --allow-root
- Linux Dependencies: On Linux, you may need additional packages:
sudo apt-get install -y libgbm-dev gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
- Memory Issues: For large diagrams, you may need to increase Node.js memory:
node --max-old-space-size=4096 index.js
License
MIT License
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
E2B
Using MCP to run code via e2b.