Mermaid MCP Server logo

Mermaid MCP Server

by MCP-Mirror / peng-shawn

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images. This server allows AI assistants and other applications to generate visual diagrams from textual descriptions using the Mermaid markdown syntax.

View on GitHub

Last updated: N/A

What is Mermaid MCP Server?

The Mermaid MCP Server is a tool that converts Mermaid diagram code into PNG images. It acts as a server implementing the Model Context Protocol (MCP), enabling AI assistants and other applications to generate visual diagrams from text.

How to use Mermaid MCP Server?

The server can be used with various tools like Claude desktop, Cursor, and Cline. It accepts Mermaid code as input and returns a PNG image, either directly or by saving it to disk, depending on the CONTENT_IMAGE_SUPPORTED environment variable. It can also be installed automatically via Smithery.

Key features of Mermaid MCP Server

  • Converts Mermaid diagram code to PNG images

  • Supports multiple diagram themes (default, forest, dark, neutral)

  • Customizable background colors

  • Uses Puppeteer for high-quality headless browser rendering

  • Implements the MCP protocol for seamless integration with AI assistants

  • Flexible output options: return images directly or save to disk

  • Error handling with detailed error messages

Use cases of Mermaid MCP Server

  • Generating diagrams from AI assistant prompts

  • Visualizing data and processes in applications

  • Creating documentation with embedded diagrams

  • Integrating diagram generation into automated workflows

FAQ from Mermaid MCP Server

Doesn't Claude desktop already support mermaid via canvas?

Yes, but it doesn't support the theme and backgroundColor options. Plus, having a dedicated server makes it easier to create mermaid diagrams with different MCP clients.

Why do I need to specify CONTENT_IMAGE_SUPPORTED=false when using with Cursor?

Cursor doesn't support inline images in responses yet.

How do I install Chrome dependencies when running in Docker?

You can either skip Chromium download and install Chrome in your Docker container, or ensure your container has the necessary dependencies for Puppeteer's bundled Chrome.

What parameters does the 'generate' tool accept?

The 'generate' tool accepts 'code' (Mermaid diagram code), 'theme' (optional theme), 'backgroundColor' (optional background color), 'name' (required when CONTENT_IMAGE_SUPPORTED=false), and 'folder' (required when CONTENT_IMAGE_SUPPORTED=false).

What does the CONTENT_IMAGE_SUPPORTED environment variable control?

It controls whether images are returned directly in the response (true) or saved to disk (false).