Home / MCP / Mermaid Diagram Generator Server

Mermaid Diagram Generator Server

Flask-based MCP server that renders Mermaid diagrams from Mermaid syntax using mermaid-cli.

python
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "mermaid_mcp": {
            "command": "python",
            "args": [
                "server.py"
            ]
        }
    }
}

You can run a lightweight Flask server that converts Mermaid syntax into rendered diagrams on demand. This MCP server is useful for automating diagram generation in documentation, dashboards, and development workflows without embedding rendering logic directly into your client apps.

How to use

Start the server locally and connect to it from your MCP client to generate diagrams on demand. You provide Mermaid syntax, optional theme and background, and you receive a PNG image of the rendered diagram. Use it to integrate diagram rendering into documentation pipelines, CI checks, or interactive tooling.

How to install

pip install -r requirements.txt
npm install -g @mermaid-js/mermaid-cli
python server.py
```

By default, the server runs on http://localhost:5000.

Additional notes

The server creates a local temporary storage directory named temp_files within the project folder to hold intermediate files. This avoids permission issues with system temp directories, works well in virtual environments, and automatically cleans up files older than 30 minutes.