Mermaid MCP Server

Mermaid MCP Server

Enables agents to search official Mermaid diagram syntax documentation and validate Mermaid diagram code before presenting it to users, ensuring syntactically correct flowcharts, sequence diagrams, class diagrams, and other Mermaid visualizations.

Category
Visit Server

README

Mermaid MCP Server

Model Context Protocol server that bundles the official Mermaid syntax docs and a syntax validator so agents can search, quote, and check diagrams before sending them to users.

What It Does

  • Serves Mermaid syntax Markdown as MCP resources (flowchart, sequence, class, C4, etc.) plus a guide prompt for quick routing.
  • search_mermaid_docs finds sections in the bundled docs (mermaid/docs/syntax) with optional diagram filtering and snippet/full modes. Results come from a startup cache for speed.
  • validate_mermaid runs mermaid.parse to flag syntax issues; DOM-related errors are treated as pass-through so headless environments still work.

Architecture

flowchart TD
    Client[MCP client] -->|stdio| StdioTransport
    Client -->|HTTP /mcp| HttpTransport
    StdioTransport --> Server
    HttpTransport --> Server
    Server[Mermaid MCP server] -->|registers| Resources[Docs resources + guide prompt]
    Server -->|tools| Tools
    Tools --> Search[search_mermaid_docs -> cached syntax md]
    Tools --> Validate[validate_mermaid -> mermaid.parse]
    Search --> DocsCache[Docs cache: mermaid/docs/syntax]
    Validate --> MermaidLib[Mermaid parser]

Install & Run

  • Clone (includes Mermaid submodule):
    • git clone --recurse-submodules <repo-url>
    • or, if already cloned: git submodule update --init --recursive
  • Prereq: Node 18+
  • Install: npm install
  • Build: npm run build
  • Start (STDIO for MCP clients): npm run start:stdio
  • Start (HTTP for testing): npm run start:http (health at /health, MCP endpoint at /mcp)

MCP Client Wiring (STDIO)

{
  "mcpServers": {
    "mermaid": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-mermaid/dist/server.js"]
    }
  }
}

Agent Usage Tips

  • Always search first: search_mermaid_docs with a single-term query (e.g., flowchart, subgraph, arrow); use diagram_type to narrow by file; mode: "full" returns entire docs.
  • Always validate after editing: validate_mermaid on the final diagram string.
  • Use the guide prompt for quick diagram-type routing and common pitfalls.

Tests

  • Run unit tests: npm test

Project Layout

  • src/server.ts – MCP server, resources, tools, docs cache
  • src/httpServer.ts – Express HTTP wrapper for /mcp
  • guides/guide.md prompt and config
  • mermaid/docs/syntax/ – Bundled official Mermaid syntax Markdown
  • dist/ – Built JS output

Request Flow (User → Answer)

sequenceDiagram
    participant U as User
    participant A as MCP Client/Agent
    participant S as Mermaid MCP Server
    participant Docs as Docs Cache (mermaid/docs/syntax)
    participant V as validate_mermaid (mermaid.parse)

    U->>A: Ask for Mermaid help
    A->>S: search_mermaid_docs {query}
    S-->>Docs: Read cached syntax
    Docs-->>S: Return snippets/full sections
    S-->>A: Matched reference sections
    A->>S: validate_mermaid {code}
    S->>V: Parse diagram
    V-->>S: Valid / warnings / error
    S-->>A: Validation result
    A-->>U: Deliver answer + validated diagram

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured