generate_mermaid_diagram_stream
Generate a Mermaid diagram as a base64-encoded image streamed directly to the client via SSE transport, with customizable theme, background color, and format.
Instructions
Generate a Mermaid diagram and return it directly as a base64-encoded image.
SYSTEM PREREQUISITES:
Node.js must be installed (v14 or higher)
Mermaid CLI must be installed globally: npm install -g @mermaid-js/mermaid-cli
The 'mmdc' command must be available in the system PATH
Python 3.8 or higher with MCP tools installed
MCP client must support SSE transport and binary/base64 image handling
IMPORTANT TRANSPORT REQUIREMENTS:
REQUIRES SSE TRANSPORT MODE ONLY
Will NOT work with STDIO transport
DO NOT use this endpoint if your MCP client doesn't support SSE transport
DO NOT use this endpoint if your client can't handle binary/base64 image data
PARAMETER GUIDANCE:
code: Valid Mermaid diagram syntax (see https://mermaid.js.org/)
theme: Theme name for the diagram. MUST be one of: ["default", "neutral", "dark", "forest", "base"]
default: Default theme for all diagrams
neutral: Great for black and white documents that will be printed
dark: Works well with dark-colored elements or dark-mode
forest: Contains shades of green
base: The only theme that can be modified for customization
backgroundColor: Optional hex color code (e.g., '#FFFFFF') or color name (e.g., 'white', 'transparent')
format: Output format. Recommended: "png". Also supports "pdf". "svg" is available but not recommended. Defaults to "png" if not specified.
RESPONSE:
Returns the diagram as a base64-encoded image in the specified format
No file system access or permissions required
Image data is streamed directly back to the client
USE CASE: Best suited for scenarios where:
The client is using SSE transport mode
The client can handle base64-encoded image data
No need to persist the image to disk
No file system access is available or desired
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| theme | No | ||
| backgroundColor | No | ||
| format | No |