Mermaid图表生成服务

MCP Mermaid是一个动态生成Mermaid图表和AI图表的服务,支持多种导出格式和传输协议。

  • by hustcc
  • TypeScript
  • 混合部署
  • 646 星标
  • 更新于
在 GitHub 查看 hustcc/mcp-mermaid

使用说明

MCP美人鱼

生成 美人鱼 使用AI MCP动态绘制图表。您还可以使用:

  • mcp服务器图表 生成图表、图形、地图。
  • 信息图 生成信息图,例如 Timeline, Comparison, List, Process 等等。
  • 🖼️ figure.ling.pub/gallery 浏览和共享使用mcp mermaid和其他工具创建的AI生成的图表和图形。

✨ 特性

  • 完全支持的所有功能和语法 Mermaid.

  • 支持配置 backgroundColor 和 theme,使大型AI模型能够输出丰富的样式配置。

  • 支持导出到 base64, svg, mermaid, file,远程友好 svg_url, png_url 格式,带有验证 Mermaid 以促进模型多轮输出正确的语法和图形。使用 outputType: "file" 自动将PNG图表保存到磁盘供AI代理使用,或通过公共mermaid.ink链接共享图表的URL模式。

🤖 用法

与一起使用 Desktop APP,如Claude、VSCode、Cline、Cherry Studio等,在下面添加MCP服务器配置。在Mac系统上:

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

On Window系统:

{
  "mcpServers": {
    "mcp-mermaid": {
      "command": "cmd",
      "args": [
        "/c",
        "npx",
        "-y",
        "mcp-mermaid"
      ]
    }
  }
}

此外,您还可以在阿里云、modelscope、glama.ai、smithery.ai或其他具有HTTP、SSE协议的平台上使用它。

接入点:

  • 上海证券交易所 http://localhost:3033/sse
  • 可流式传输: http://localhost:1122/mcp

可用的Docker标签:

  • susuperli/mcp-mermaid:latest -最新稳定版本
  • 查看所有可用标签 Docker 中心

🚰 使用SSE或流媒体传输运行

选项1:全局安装

全局安装软件包:

npm install -g mcp-mermaid

使用首选传输选项运行服务器:

# For SSE transport (default endpoint: /sse)
mcp-mermaid -t sse

# For Streamable transport with custom endpoint
mcp-mermaid -t streamable

方案2:地方发展

如果您在本地使用源代码:

# Clone and setup
git clone https://github.com/hustcc/mcp-mermaid.git
cd mcp-mermaid
npm install
npm run build

# Run with npm scripts
npm run start:sse        # SSE transport on port 3033
npm run start:streamable # Streamable transport on port 1122

接入点

然后,您可以访问服务器:

  • SSE运输: http://localhost:3033/sse
  • 可流动运输: http://localhost:1122/mcp (本地)或 http://localhost:3033/mcp (全球)

🎮 CLI选项

运行MCP服务器时,您还可以使用以下CLI选项。使用run-cli命令选项 -h.

MCP Mermaid CLI

Options:
  --transport, -t  Specify the transport protocol: "stdio", "sse", or "streamable" (default: "stdio")
  --port, -p       Specify the port for SSE or streamable transport (default: 3033)
  --endpoint, -e   Specify the endpoint for the transport:
                    - For SSE: default is "/sse"
                    - For streamable: default is "/mcp"
  --help, -h       Show this help message

🔨 发展

安装依赖项:

npm install

构建服务器:

npm run build

启动MCP服务器

使用MCP检查器(用于调试):

npm run start

使用不同的传输协议:

# SSE transport (Server-Sent Events)
npm run start:sse

# Streamable HTTP transport
npm run start:streamable

直接节点命令:

# SSE transport on port 3033
node build/index.js --transport sse --port 3033

# Streamable HTTP transport on port 1122
node build/index.js --transport streamable --port 1122

# STDIO transport (for MCP client integration)
node build/index.js --transport stdio

🐳 Docker使用

使用Docker运行MCP Mermaid:

# Pull the image
docker pull susuperli/mcp-mermaid:latest

# Run with SSE transport (default)
docker run -p 3033:3033 susuperli/mcp-mermaid:latest --transport sse

# Run with streamable transport
docker run -p 1122:1122 susuperli/mcp-mermaid:latest --transport streamable --port 1122

📄 许可证

麻省理工学院@hustcc.