| 1 | # <img src="https://mermaid.js.org/favicon.svg" height="24"/> MCP Mermaid  [](https://github.com/hustcc/mcp-mermaid/actions/workflows/build.yml) [](https://www.npmjs.com/package/mcp-mermaid) [](https://smithery.ai/server/@hustcc/mcp-mermaid) [](https://www.npmjs.com/package/mcp-mermaid) [](https://archestra.ai/mcp-catalog/hustcc__mcp-mermaid) |
| 2 | |
| 3 | Generate <img src="https://mermaid.js.org/favicon.svg" height="14"/> [mermaid](https://mermaid.js.org/) diagram and chart with AI MCP dynamically. Also you can use: |
| 4 | |
| 5 | - <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*ZFK8SrovcqgAAAAAAAAAAAAAemJ7AQ/original" height="14"/> [mcp-server-chart](https://github.com/antvis/mcp-server-chart) to generate chart, graph, map. |
| 6 | - <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*EdkXSojOxqsAAAAAQHAAAAgAemJ7AQ/original" height="14"/> [Infographic](https://github.com/antvis/Infographic) to generate infographic, such as `Timeline`, `Comparison`, `List`, `Process` and so on. |
| 7 | - 🖼️ [figure.ling.pub/gallery](https://figure.ling.pub/gallery) to browse and share AI-generated diagrams and figures created with mcp-mermaid and other tools. |
| 8 | |
| 9 | |
| 10 | ## ✨ Features |
| 11 | |
| 12 | - Fully support all features and syntax of `Mermaid`. |
| 13 | - Support configuration of `backgroundColor` and `theme`, enabling large AI models to output rich style configurations. |
| 14 | |
| 15 | - Support exporting to `base64`, `svg`, `mermaid`, `file`, and remote-friendly `svg_url`, `png_url` formats, with validation for `Mermaid` to facilitate the model's multi-round output of correct syntax and graphics. Use `outputType: "file"` to automatically save PNG diagrams to disk for AI agents, or the URL modes to share diagrams through public mermaid.ink links. |
| 16 | |
| 17 | |
| 18 | <img width="720" alt="mcp-mermaid" src="https://mermaid.js.org/header.png" /> |
| 19 | |
| 20 | |
| 21 | ## 🤖 Usage |
| 22 | |
| 23 | To use with `Desktop APP`, such as Claude, VSCode, Cline, Cherry Studio, and so on, add the MCP server config below. On Mac system: |
| 24 | |
| 25 | ```json |
| 26 | { |
| 27 | "mcpServers": { |
| 28 | "mcp-mermaid": { |
| 29 | "command": "npx", |
| 30 | "args": [ |
| 31 | "-y", |
| 32 | "mcp-mermaid" |
| 33 | ] |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | ``` |
| 38 | |
| 39 | On Window system: |
| 40 | |
| 41 | ```json |
| 42 | { |
| 43 | "mcpServers": { |
| 44 | "mcp-mermaid": { |
| 45 | "command": "cmd", |
| 46 | "args": [ |
| 47 | "/c", |
| 48 | "npx", |
| 49 | "-y", |
| 50 | "mcp-mermaid" |
| 51 | ] |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | ``` |
| 56 | |
| 57 | Also, you can use it on aliyun, modelscope, glama.ai, smithery.ai or others with HTTP, SSE Protocol. |
| 58 | |
| 59 | **Access Points:** |
| 60 | - SSE: `http://localhost:3033/sse` |
| 61 | - Streamable: `http://localhost:1122/mcp` |
| 62 | |
| 63 | **Available Docker Tags:** |
| 64 | - `susuperli/mcp-mermaid:latest` - Latest stable version |
| 65 | - View all available tags at [Docker Hub](https://hub.docker.com/repository/docker/susuperli/mcp-mermaid/tags) |
| 66 | |
| 67 | |
| 68 | ## 🚰 Run with SSE or Streamable transport |
| 69 | |
| 70 | ### Option 1: Global Installation |
| 71 | |
| 72 | Install the package globally: |
| 73 | |
| 74 | ```bash |
| 75 | npm install -g mcp-mermaid |
| 76 | ``` |
| 77 | |
| 78 | Run the server with your preferred transport option: |
| 79 | |
| 80 | ```bash |
| 81 | # For SSE transport (default endpoint: /sse) |
| 82 | mcp-mermaid -t sse |
| 83 | |
| 84 | # For Streamable transport with custom endpoint |
| 85 | mcp-mermaid -t streamable |
| 86 | ``` |
| 87 | |
| 88 | ### Option 2: Local Development |
| 89 | |
| 90 | If you're working with the source code locally: |
| 91 | |
| 92 | ```bash |
| 93 | # Clone and setup |
| 94 | git clone https://github.com/hustcc/mcp-mermaid.git |
| 95 | cd mcp-mermaid |
| 96 | npm install |
| 97 | npm run build |
| 98 | |
| 99 | # Run with npm scripts |
| 100 | npm run start:sse # SSE transport on port 3033 |
| 101 | npm run start:streamable # Streamable transport on port 1122 |
| 102 | ``` |
| 103 | |
| 104 | ### Access Points |
| 105 | |
| 106 | Then you can access the server at: |
| 107 | |
| 108 | - SSE transport: `http://localhost:3033/sse` |
| 109 | - Streamable transport: `http://localhost:1122/mcp` (local) or `http://localhost:3033/mcp` (global) |
| 110 | |
| 111 | ## 🎮 |