Get the FREE Ultimate OpenClaw Setup Guide →

mermaid

A lightweight Model Context Protocol (MCP) server that provides real-time Mermaid diagram syntax validation with minimal memory footprint.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio freepeak-mermaid-mcp-server node /path/to/mermaid-mcp-server/server.js \
  --env DEBUG="mermaid-mcp-server:*" \
  --env NODE_ENV="development" \
  --env MEMORY_LIMIT="128" \
  --env PERFORMANCE_MONITORING="true"

How to use

This MCP server provides real-time and batch validation for Mermaid diagrams. It exposes a set of tools that let you validate single diagrams, perform real-time validation during editing, and run batch validation across multiple diagrams. You can validate a single diagram with validate_mermaid to get a quick pass/fail result along with an inferred diagram type and error details. For live editing scenarios, use mermaid_realtime_validate to receive enhanced feedback including the type of change and line number. When you need to process multiple diagrams at once, batch them with validate_mermaid_batch and inspect a concise summary plus individual results. You can also query server information and the supported diagram types via get_mermaid_info to monitor capabilities and performance metrics.

How to install

Prerequisites:

  • Node.js v18.x or newer
  • npm (included with Node.js)
  • Git

Install and run the Mermaid MCP Server locally:

  1. Clone the repository:
git clone <repository-url>
cd mermaid-mcp-server
  1. Install dependencies:
npm install
  1. Start the server (development mode):
npm run dev
  1. If you want to run via MCP client configuration, ensure your client points to the server.js entry, e.g.:
  • Command: node
  • Args: ["/path/to/mermaid-mcp-server/server.js"]
  • Environment: set appropriate variables as needed (see below)

Optional environment variables you may configure:

  • DEBUG: Enable verbose debug logs (e.g. mermaid-mcp-server:*).
  • NODE_ENV: Set to development or production.
  • MEMORY_LIMIT: Limit the memory usage (in MB).
  • PERFORMANCE_MONITORING: Enable performance metrics collection.

Additional notes

Tips and notes:

  • The server is designed for lightweight, real-time Mermaid diagram validation with minimal memory footprint.
  • Supported diagram types include Flowcharts, Sequence Diagrams, Class Diagrams, State Diagrams, ER Diagrams, Gantt, Mind Maps, Timelines, C4 Architecture, Sankey, Block, Architecture, and more.
  • Use get_mermaid_info to inspect server status, uptime, and supported diagram types.
  • For debugging startup issues, verify Node.js version (>= 18) and ensure dependencies are installed.
  • If memory usage spikes, consider batch validation or restarting the server as needed and adjust MEMORY_LIMIT.
  • Environment variables in MCP config can be tuned per deployment to balance logging, debugging, and performance.

Related MCP Servers

Sponsor this space

Reach thousands of developers