MCPInstall
mcp-101-mermaid logo

mcp-101-mermaid

by jsphdnl 1 stars jsphdnl/mcp-101-mermaid

Simple MCP server to create Mermaid Diagrams

READMEmain

Mermaid Diagram Creator

A real-time diagram creation tool powered by Mermaid.js with React frontend and WebSocket communication.

Overview

This application enables users to create and visualize various types of diagrams using the Mermaid syntax. The system consists of two main components:

  • Frontend: A React application that renders diagrams using Mermaid.js
  • Backend: A server that processes requests and sends diagram data to the frontend via WebSockets

Features

  • Real-time diagram rendering
  • Support for multiple diagram types:
    • Flowcharts
    • Sequence diagrams
    • Class diagrams
    • Gantt charts
    • Pie charts
  • Robust error handling with helpful syntax suggestions
  • Dark/light theme support
  • Zoom controls for diagram viewing
  • Export to SVG format

Project Structure

mermaid/
├── mermaid-app/         # React frontend application
│   ├── src/             # Source code
│   │   ├── App.jsx      # Main application component
│   │   └── App.css      # Application styling
│   ├── package.json     # Frontend dependencies
│   └── vite.config.js   # Vite configuration
│
├── mcp-server/          # Backend server
│   ├── server.js        # Main server file
│   ├── socket-server.js # WebSocket server implementation
│   ├── diagram-generators.js # Diagram generation logic
│   └── package.json     # Backend dependencies
│
└── start.js             # Script to start both frontend and backend

Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/mermaid.git
    cd mermaid
    
  2. Install dependencies for both frontend and backend:

    # Frontend dependencies
    cd mermaid-app
    bun install
    
    # Backend dependencies
    cd ../mcp-server
    bun install
    
    # Return to root
    cd ..
    
  3. Start the application:

    bun start.js
    
  4. Open your browser and navigate to http://localhost:5173

Usage

  1. The application automatically connects to the WebSocket server
  2. Diagrams sent from the server will be rendered in real-time
  3. Use the zoom controls to adjust the view
  4. Toggle between dark and light themes using the theme button
  5. Export diagrams using the export button

Diagram Syntax

The application uses Mermaid.js syntax for creating diagrams. Here are some examples:

Flowchart

graph TD
    A[Start] -->|Process| B(Process Data)
    B --> C{Decision}
    C -->|Yes| D[Result 1]
    C -->|No| E[Result 2]
    D --> F[End]
    E --> F

Sequence Diagram

sequenceDiagram
    participant User
    participant API
    participant Database
    
    User->>API: Request data
    activate API
    API->>Database: Query
    activate Database
    Database-->>API: Results
    deactivate Database
    API-->>User: Response
    deactivate API

For more syntax examples, visit the Mermaid documentation.

Error Handling

The application provides helpful error messages and syntax suggestions when diagram code contains errors.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

More Design Tool MCP servers

Similar servers from the same category.

🤖 A Model Context Protocol server for generating charts using @antvis.

TextModel+1

SlideSpeak

slidespeak

Generate presentations using the SlideSpeak API.

APIPresentation+2

Generate images using Amazon Nova Canvas.

text

Bridges to 21st.dev's Magic API for generating UI components from descriptions, fetching existing components for inspiration, and searching for company logos in various formats.

search