MCP Sequence Diagram Server

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.

Category
Visit Server

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

  1. Clone or create the project directory:
mkdir mcp-sequence-diagram-server
cd mcp-sequence-diagram-server
  1. Install dependencies:
npm install
  1. 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 syntax
  • format (optional): Output format ('svg' or 'png', default: 'svg')
  • filename (optional): Custom filename for output
  • width (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 description
  • participants (optional): Array of participant names
  • format (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

  1. Puppeteer Installation: If Puppeteer fails to install, try:
npm install puppeteer --unsafe-perm=true --allow-root
  1. 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
  1. 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

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

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.

Official
Featured
Python
graphlit-mcp-server

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.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured