Skip to main content
Glama
mermaidUrl.ts658 B
import { deflateSync } from "node:zlib"; /** * Encodes mermaid text into the Base64URL deflated format used by mermaid.ink. */ function encodeMermaidToBase64Url(mermaid: string): string { const compressed = deflateSync(mermaid, { level: 9 }); return compressed .toString("base64") .replace(/\+/g, "-") .replace(/\//g, "_") .replace(/=+$/g, ""); } /** * Creates a public mermaid.ink URL for the given mermaid definition. */ export function createMermaidInkUrl( mermaid: string, variant: "svg" | "img", ): string { const encoded = encodeMermaidToBase64Url(mermaid); return `https://mermaid.ink/${variant}/pako:${encoded}`; }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hustcc/mcp-mermaid'

If you have feedback or need assistance with the MCP directory API, please join our Discord server