Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Mermaid CLI

$ mmdc Official Low Risk
Mermaid · Design & Docs · MIT · macos / linux / windows

Mermaid CLI (mmdc) compiles Mermaid diagram definitions (.mmd or embedded Markdown fences) into SVG, PNG, or PDF files via headless Chromium/Puppeteer. While essential for verifying Mermaid syntax and generating visual assets, Puppeteer/Chromium dependencies make container setup heavier.

FCRS-1.0 Score
80 /100
Good
Medium Confidence
Zero-Friction Install
brew install mermaid-cli
CLI vs MCP Decision CLI Only

mmdc renders local .mmd and .md diagrams directly to SVG/PNG files in the workspace without needing an external server.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 19 / 25

Simple -i / -o CLI interface with non-zero exit codes on Mermaid syntax errors, though Puppeteer Chromium startup adds latency.

  • Non-interactive -i input.mmd -o output.svg execution
  • Fails with non-zero exit code on invalid diagram syntax
Trust & Safety 21 / 25

Local offline rendering with no credentials, though headless Chromium sandboxing needs care on Linux containers.

  • Zero cloud auth surface
  • Runs headless Chromium via Puppeteer
Setup & Portability 11 / 15

Puppeteer/Chromium browser download and Linux shared-library deps frequently trip up minimal CI containers.

  • Requires Chromium binary and OS graphics libraries
Utility & Efficiency 13 / 15

De-facto standard for rendering and syntax-checking Mermaid diagrams in docs pipelines.

  • Supports .mmd and automatic Markdown fence extraction
Maintenance & Lineage 8 / 10

Official Mermaid organization tool (mermaid-js/mermaid-cli) under MIT.

  • Official Mermaid GitHub organization
Docs & Verifiability 8 / 10

Clear README covering Docker, Puppeteer config, and CLI flags.

  • GitHub README and mmdc --help

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

No credentials required; local CLI renderer.

Side Effects
Read-Only Local Write
Cost & Quotas

Free open-source software (MIT).

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Mermaid CLI Agent Rules
- Prefer `-o <file>.svg` for crisp vector output and syntax validation.
- In Linux/Docker sandboxes, provide a `puppeteer-config.json` (`-p`) if `--no-sandbox` is required.
- Avoid rendering untrusted external Markdown files without Puppeteer isolation.

Agent-Ready Command Recipes

Safe Read-Only Queries

Check Mermaid CLI version and options
mmdc --version

Verifies mmdc installation without launching headless Chromium.

Controlled Writes & Previews

Render a Mermaid diagram to SVG
mmdc -i diagram.mmd -o dist/diagram.svg

Validates Mermaid syntax and writes the rendered SVG vector diagram to dist/diagram.svg.

Strengths for Agents

  • + Authoritative Mermaid syntax validator and SVG/PNG/PDF renderer.
  • + Can extract and transform Mermaid fences directly inside Markdown files (-i doc.md -o doc.out.md).
  • + Clean -i / -o / -t (theme) CLI flags.

Caveats & Pitfalls

  • ! Depends on headless Chromium via Puppeteer, making installs heavy and prone to sandbox issues in Docker/Linux.
  • ! Slower per-invocation startup than pure native diagram compilers like d2 or dot.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI