mermkit orchestrates Mermaid rendering engines — turning their output into the right artifact for wherever you need it: SVG files for docs, inline images for terminals, base64 for chat APIs, PNGs for CI. It wraps engines like mermaid.js and the Mermaid CLI rather than reimplementing them.
Mermaid only renders natively in a browser. mermkit bridges every other environment.
See diagrams directly in your terminal via inline images (Kitty, iTerm2, WezTerm) or ASCII fallback — no browser needed.
Post rendered previews to Slack, Discord, or GitHub. Adapters handle base64 encoding and platform-specific payload shape for you.
Generate diagram images as part of your build. If the source didn't change, the output file doesn't change.
Give AI agents a rendering tool they can call via JSON IPC, batch requests, OpenAI tool schemas, or MCP.
Everything you need to turn Mermaid source into usable artifacts.
Pluggable engine registry. Use embedded, mmdc, ascii, or register your own.
SVG, PNG, PDF, and ASCII. Pick the right format for your environment.
Inline image protocols (Kitty, iTerm2, WezTerm) with automatic ASCII/Unicode fallback.
Format rendered diagrams for Slack, Discord, and GitHub in one call.
JSON IPC server, batch rendering, OpenAI tool schemas, and an MCP server over stdio.
First-class wrappers for Python, Go, and Rust. Each one spawns serve under the hood.
Get started in three lines.
# Render a diagram to SVG
mermkit render --in diagram.mmd --out diagram.svg
# Render from stdin to PNG
echo "graph TD; A-->B" | mermkit render --stdin --format png --out out.png
# ASCII output in the terminal
mermkit render --in diagram.mmd --format ascii
from mermkit import MermkitClient
client = MermkitClient()
client.start()
result = client.render("graph TD; A-->B", format="svg")
client.close()
import { render } from "@mermkit/render";
const result = await render(
{ id: "my-diagram", source: "graph TD; A-->B" },
{ format: "svg" }
);
// result.bytes — Uint8Array of SVG
Choose your package manager.
npm install -g @mermkit/cli@latest
npx @mermkit/cli@latest render --in diagram.mmd --out diagram.svg
pip install mermkit
cargo install mermkit
Expose mermkit as an MCP server over stdio. Use the latest CLI version.
npx -y @mermkit/cli@latest mcp
{
"mcpServers": {
"mermkit": {
"command": "npx",
"args": ["-y", "@mermkit/cli@latest", "mcp"]
}
}
}
mermkit_render
mermkit_renderBatch
mermkit_extract
mermkit_term
mermkit_schema
{
"options": {
"includeDataUri": true
}
}
mermkit is engine-agnostic. It tries engines in priority order when set to auto.
| Engine | What it uses | Formats | Notes |
|---|---|---|---|
embedded (default) |
mermaid + jsdom, in-process |
SVG, PNG, PDF | Scale option not yet implemented |
mmdc |
@mermaid-js/mermaid-cli subprocess |
SVG, PNG, PDF | Set MERMKIT_MMDC_PATH for a custom binary |
ascii |
Custom TypeScript renderer | ASCII text | Flowcharts and sequence diagrams; skipped in auto mode |
stub |
Placeholder | SVG | Test double only — returns source as text, not a real diagram |