mcpField
M
mermaid-live-mcp - From prompt to diagram in seconds

mermaid-live-mcp - From prompt to diagram in seconds

Local
github.com/iishyfishyyAI & Agents13Updated 26w ago

About mermaid-live-mcp - From prompt to diagram in seconds

mermaid-live-mcp is an MCP server for generating Mermaid diagrams with a live browser preview. It supports diagram updates during a session and SVG or PNG export for AI assistant workflows.

Key features

  1. 01Generate Mermaid diagrams
  2. 02Open a live browser preview
  3. 03Update diagrams in real time
  4. 04List session diagrams
  5. 05Export diagrams as SVG or PNG

Use cases

  1. 01Preview a flowchart while drafting
  2. 02Revise a sequence diagram interactively
  3. 03Export a diagram for a document
  4. 04Review diagrams created in a session

MCP support

Exposes tools to generate, update, list, and export Mermaid diagrams to MCP clients. The generated diagram is rendered in a live browser preview.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"mermaid-live": {
"command": "npx",
"args": [
"-y",
"mermaid-live-mcp"
]
}
}
}
Run commandnpx -y mermaid-live-mcp

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npmmermaid-live-mcp

Tools

4

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
syntaxstringYesMermaid diagram syntax (e.g. 'graph TD; A-->B;')
titlestringNoOptional title for the browser preview tab

Details

From the project README

mermaid-live-mcp

MCP server for generating Mermaid diagrams with live browser preview. Renders diagrams in real-time and supports SVG/PNG export.

npm version

mermaid-live-mcp demo

Install

Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

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

Add to .cursor/mcp.json in your project root:

{
  "mcpServers": {
    "mermaid": {
      "command": "npx",
      "args": ["-y", "mermaid-live-mcp"]
    }
  }
}
Claude Code
claude mcp add mermaid -- npx -y mermaid-live-mcp
Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

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

Tools

ToolDescription
generate_mermaidGenerate a diagram from Mermaid syntax and open a live preview in the browser
update_diagramReplace a diagram's Mermaid syntax and re-render the live preview
list_diagramsList all diagrams generated in the current session
export_diagramWrite a diagram's SVG to disk

How it works

When you ask your AI assistant to create a diagram, mermaid-live-mcp will:

  1. Parse the Mermaid syntax
  2. Open a browser tab with a live preview
  3. Render the diagram as SVG in real-time via WebSocket
  4. Provide download buttons for SVG and PNG export

Updates to a diagram are pushed instantly to the browser — no page refresh needed.

Supported diagram types

All Mermaid diagram types are supported, including flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, Gantt charts, pie charts, git graphs, mindmaps, timelines, and more.

Development

pnpm install
pnpm build
Project structure
PackageDescription
packages/mcp-serverMCP server (published as mermaid-live-mcp)
packages/previewLive browser preview via WebSocket
packages/coreDiagram parsing, layout, and SVG rendering
packages/cliCommand-line interface

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.