MCP Servers

模型上下文协议服务器、框架、SDK 和模板的综合目录。

M
Mermaid Validator MCP
作者 @LF112

A lightweight, single-purpose MCP server that validates Mermaid diagram syntax — nothing more, nothing less.

创建于 3/4/2026
更新于 about 3 hours ago
Repository documentation and setup instructions

Mermaid Validator MCP

MCP Badge

A Model Context Protocol (MCP) server built with Bun and TypeScript that validates Mermaid diagram syntax.

Quick Start

This package is published on npm. You can run it directly with npx:

npx -y mermaid-validator-mcp

MCP Client Configuration

Add the server to your MCP client (e.g. Claude Desktop) configuration:

Using npx (recommended)

{
  "mcpServers": {
    "mermaid-validator": {
      "command": "npx",
      "args": ["-y", "mermaid-validator-mcp"]
    }
  }
}

Using local source

{
  "mcpServers": {
    "mermaid-validator": {
      "command": "bun",
      "args": [
        "/path/to/mermaid-validator-mcp/index.ts"
      ]
    }
  }
}

Or if you have it installed globally:

{
  "mcpServers": {
    "mermaid-validator": {
      "command": "mermaid-validator-mcp"
    }
  }
}

Features

  • Single tool – validate_mermaid: Pass any Mermaid diagram text and receive either a success response with the detected diagram type, or a detailed parse-error message.
  • Supports all major Mermaid diagram types: flowchart, sequence, class, pie, gantt, state, ER, gitGraph, mindmap, timeline, and more.
  • No dependency on mermaid-cli or any external rendering process.
  • Uses JSDOM to provide the minimal DOM environment required by Mermaid.

Requirements

Getting Started

# Install dependencies
bun install

# Start the MCP server (stdio mode)
bun start

Tool: validate_mermaid

Input

| Field | Type | Description | |-----------|--------|--------------------------------------| | diagram | string | The Mermaid diagram text to validate |

Output (JSON text)

Valid diagram

{ "valid": true, "diagramType": "flowchart-v2" }

Invalid diagram

{
  "valid": false,
  "error": "Parse error on line 2:\n...TD\n  --> B\n-------^\nExpecting 'SEMI', ..."
}

Development

# Run with auto-reload
bun dev

# Build
bun run build
快速设置
此服务器的安装指南

安装包 (如果需要)

npx @modelcontextprotocol/server-mermaid-validator-mcp

Cursor 配置 (mcp.json)

{ "mcpServers": { "lf112-mermaid-validator-mcp": { "command": "npx", "args": [ "lf112-mermaid-validator-mcp" ] } } }