Use the Mermaid CLI from KosmoKrator to call Mermaid tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.
Mermaid can be configured headlessly with `kosmokrator integrations:configure mermaid`.
# Install KosmoKrator first if it is not available on PATH.curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash# Configure and verify this integration.kosmokrator integrations:configure mermaid --enable --read allow --write ask --jsonkosmokrator integrations:doctor mermaid --jsonkosmokrator integrations:status --json
Runtime Requirements
Install these host dependencies before calling Mermaid locally.
Name
Type
Description
mmdc
binary
Mermaid CLI is required to render diagrams.
Credentials
Authentication type: No credentialsnone. Configure credentials once, then use the same stored profile from
scripts, coding CLIs, Lua code mode, and the MCP gateway.
No credentials are required.
Call Mermaid Headlessly
Use the generic call form when another coding CLI or script needs a stable universal interface.
Every function below can be called headlessly. The generic form is stable across all integrations;
the provider shortcut is shorter but specific to Mermaid.
mermaid.render_mermaid
Write write
Render a Mermaid diagram to a PNG image. Pass valid Mermaid syntax and get back a markdown image embed.
Supported diagram types: flowchart, sequence, class, state, ER, Gantt, pie, quadrant, requirement, git graph, C4, mindmap, timeline, sankey, XY chart, block.
Example syntax:
```
graph TD
A[Start] --> B{Decision}
B -->|Yes| C[Action]
B -->|No| D[End]
```
Tips:
- Use `graph TD` for top-down flowcharts, `graph LR` for left-to-right
- Use `sequenceDiagram` for sequence diagrams
- Use `erDiagram` for entity-relationship diagrams
- Use `classDiagram` for class diagrams
- Use `stateDiagram-v2` for state diagrams
- Use `gantt` for Gantt charts
- Use `pie` for pie charts
- Use `gitgraph` for git graphs
- Use `mindmap` for mind maps
Use these parameter tables when building CLI payloads without calling integrations:schema first.
mermaid.render_mermaid
Render a Mermaid diagram to a PNG image. Pass valid Mermaid syntax and get back a markdown image embed.
Supported diagram types: flowchart, sequence, class, state, ER, Gantt, pie, quadrant, requirement, git graph, C4, mindmap, timeline, sankey, XY chart, block.
Example syntax:
```
graph TD
A[Start] --> B{Decision}
B -->|Yes| C[Action]
B -->|No| D[End]
```
Tips:
- Use `graph TD` for top-down flowcharts, `graph LR` for left-to-right
- Use `sequenceDiagram` for sequence diagrams
- Use `erDiagram` for entity-relationship diagrams
- Use `classDiagram` for class diagrams
- Use `stateDiagram-v2` for state diagrams
- Use `gantt` for Gantt charts
- Use `pie` for pie charts
- Use `gitgraph` for git graphs
- Use `mindmap` for mind maps
Mermaid diagram syntax. Must be valid Mermaid markup (e.g., starting with graph TD, sequenceDiagram, erDiagram, etc.).
title
string
no
Diagram title used as alt text (default: "Diagram").
width
integer
no
Output width in pixels (default: 1400, range: 100-4000).
theme
string
no
Mermaid theme (default: 'default').
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults
with integrations:configure. Add --force only for trusted automation that should bypass that policy.