PluginBench
MCP Server
Active
MIT

Agentic Mermaid MCP Server

io.github.adewale/agentic-mermaid

Render, verify, and safely edit Mermaid diagrams with AI agents using structured mutations and beautiful defaults.

What is the Agentic Mermaid MCP server?

Agentic Mermaid is an MCP server that enables AI agents to create, render, and edit Mermaid diagrams with publication-ready output. It provides SVG, PNG, ASCII, and Unicode renders from a single source, plus a structured mutation API for safe, deterministic edits without regenerating entire diagrams.

Agentic Mermaid lets you describe diagrams in plain language and get back polished, renderable outputs. It's built for agents that need to draft diagrams, apply safe edits, and review results in multiple formats—all without guessing from pixels or concatenating strings. Use it when you want beautiful diagrams that look finished without a design cleanup pass.

How to install Agentic Mermaid

Copy-paste configuration for popular MCP clients.

transport: stdio
Config generated by PluginBench — verify against the source before use.
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "agentic-mermaid": {
      "command": "npx",
      "args": [
        "-y",
        "agentic-mermaid",
        "-y",
        "mcp"
      ]
    }
  }
}

Tools & capabilities

Tools this server exposes to the agent.

  • execute — Code Mode sandbox for running mermaid.* SDK operations
  • describe_sdk — Retrieve mutation schema and capabilities for a specific diagram family
  • render_svg — Render a Mermaid diagram to SVG
  • render_png — Render a Mermaid diagram to PNG with optional sizing and background
  • render_ascii — Render a Mermaid diagram to ASCII or Unicode text for terminal review
  • verify — Verify a Mermaid diagram for syntax and layout correctness
  • describe — Get a text description of a Mermaid diagram
  • mutate — Apply typed structural edits to a diagram (add/remove nodes, edges, etc.)
  • build — Build or compile a diagram with specified style and palette options

Use cases

  • Draft flowcharts, sequence diagrams, and other Mermaid diagrams via agent prompts, then render to SVG/PNG for publication
  • Review diagram layouts in ASCII/Unicode format in the terminal before committing to final renders
  • Apply safe, structured edits to existing diagrams (add nodes, change labels, reorder elements) without regenerating from scratch
  • Apply custom brand colors, typography, and visual styles (watercolor, blueprint, hand-drawn, publication-figure) to diagrams
  • Integrate diagram generation into agentic workflows with deterministic layout and verified output

Agentic Mermaid MCP server FAQ

What is Agentic Mermaid?

Agentic Mermaid is an MCP server and toolkit that helps AI agents create and edit Mermaid diagrams with publication-ready output. It provides multiple render formats (SVG, PNG, ASCII, Unicode), structured mutation APIs for safe edits, and built-in beautiful styles.

Is it free?

Yes, Agentic Mermaid is open-source under the MIT license. You can self-host the MCP server or use the free public endpoint at https://agentic-mermaid.dev/mcp.

How do I install it in Cursor or Claude?

Install via npm (`npm install agentic-mermaid`) or use the hosted MCP endpoint at `https://agentic-mermaid.dev/mcp`. For self-hosting, run `agentic-mermaid-mcp` as a stdio server or with `--transport http` for HTTP/SSE. Add the server to your MCP configuration in Cursor or Claude's settings.

Does it require authentication?

No authentication is required. The public hosted endpoint at https://agentic-mermaid.dev/mcp is unauthenticated and stateless. Self-hosted instances do not require auth either.

What diagram types does it support?

Agentic Mermaid supports all major Mermaid diagram families including flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, Gantt charts, pie charts, and more. Run `am capabilities --json` to see the complete live roster.

Can I use custom colors and styles?

Yes. Agentic Mermaid includes built-in styles (watercolor, blueprint, hand-drawn, publication-figure) and palettes. You can also author custom JSON style files and themes, or adapt VS Code themes via Shiki compatibility.

README (reference)

Source of truth, from the repository.

<div align="center">

Agentic Mermaid

Beautiful diagrams, made with your agent.

Agentic Mermaid is an open-source Mermaid toolkit for people who want AI agents to create diagrams that look finished: SVG and PNG renders, ASCII and Unicode for review, deterministic layout, and Style + Palette controls for brand colors, typography, strokes, fills, and backdrops.

It is forked from lukilabs/beautiful-mermaid. Published on npm as agentic-mermaid; the GitHub repository is adewale/agentic-mermaid; the canonical live site is agentic-mermaid.dev, a Cloudflare Workers deployment.

Agentic Mermaid: Mermaid source plus typed edit ops on the left, the verified SVG render in the middle, and the same diagram as ASCII on the right

Live Demo & Samples · Live Editor

Docs: docs index · getting started · agent guide · agent API cookbook · design system · skills · fork differences · vs Mermaid & Beautiful Mermaid · changelog

</div>

Why Agentic Mermaid

Use it when you want to describe a diagram in plain language and get back something you can publish without a design cleanup pass.

You wantAgentic Mermaid gives you
An agent to draft the diagramMermaid source plus a verified render path
Beautiful defaultsBuilt-in looks such as watercolor, blueprint, hand-drawn, and publication-figure
Brand fitStyle + Palette stacks and custom JSON palettes you can keep in your repo
Safe edits laterparseRegisteredMermaid → family narrower → mutate → verifyMermaid → serializeMermaid
Reviewable artifactsSVG, PNG, ASCII, Unicode, and JSON layout from the same source

The agent workflow is the guardrail behind the polish: agents should not guess from pixels, concatenate strings, or regenerate whole diagrams when a structured edit is available.

Highlights

  • Descriptor-registered diagram families — built-ins and namespaced extensions share one discovery and capability contract.
  • SVG, PNG, ASCII, Unicode, JSON — one resolved request with explicit graphical, terminal, and positioned-layout projections.
  • Synchronous, zero-DOM SVG renderer — no Puppeteer, no browser flash.
  • Composable styles — { style: ['hand-drawn', 'dracula'] } stacks a look over a palette; discoverable full looks cover sketch, watercolor, blueprint, accessibility, print, operational, physical-media, architecture, and editorial/report use cases. Custom styles are plain JSON records any agent can author (docs/style-authoring.md). seed re-rolls the ink, never the layout.
  • Discoverable palettes + Shiki compatibility — a theme is a palette-only style: discover the canonical catalog at runtime, theme from two colors, or adapt a VS Code theme.
  • Agent-native editing — typed mutation for every registered renderable family; source-level round-trip only for opaque fallbacks containing unmodeled syntax.
  • CLI + MCP + library — am, agentic-mermaid-mcp, agentic-mermaid, agentic-mermaid/agent, and the browser/workerd-safe agentic-mermaid/agent/core. Audit reports and trusted host-resource helpers remain repository tooling instead of published runtime entry points.

Installation

npm install agentic-mermaid       # or: bun add agentic-mermaid / pnpm add agentic-mermaid
npx --no-install agentic-mermaid --help
npx --no-install agentic-mermaid mcp

For repository development, install from source and run the Bun entrypoints (Bun 1.4.0 or later; bun upgrade if bun --version is older):

git clone https://github.com/adewale/agentic-mermaid
cd agentic-mermaid
bun install
bun run build
bun run bin/am.ts --help
bun run bin/agentic-mermaid-mcp.ts   # MCP stdio server

ESM-only. agentic-mermaid ships ES modules (there is no CommonJS build); require() consumers should use dynamic import() instead. Requires Node ≥ 22.

The am … examples below name the published bin. After a project-local npm install, invoke it from a shell as npx --no-install agentic-mermaid … (or from an npm script as am …). From a source checkout, use bun run bin/am.ts … instead.

Output quick starts

Use agentic-mermaid/agent when you want one import path for styled renders, output formats, and the structured edit API.

SVG

import { renderMermaidSVG } from 'agentic-mermaid/agent'

const svg = renderMermaidSVG(`flowchart TD
  Start --> Done`, { security: 'strict' })

PNG

import { writeFileSync } from 'node:fs'
import { renderMermaidPNG } from 'agentic-mermaid/agent'

const png = renderMermaidPNG(`flowchart TD
  Start --> Done`, {
  fitTo: { width: 1200 },
  background: '#fff',
})

writeFileSync('diagram.png', png)

CLI equivalent:

am render diagram.mmd --format png --output diagram.png

ASCII / Unicode

import { renderMermaidASCII } from 'agentic-mermaid/agent'

const unicode = renderMermaidASCII(`flowchart LR
  A --> B`)
const ascii = renderMermaidASCII(`flowchart LR
  A --> B`, { useAscii: true })

Agent quick start

If your coding agent can read repo files, point it at:

If it only has shell access:

am --agent-instructions
am capabilities --json
am preview diagram.mmd --security strict --open
am mutate diagram.mmd --op '{"kind":"add_node","id":"Cache","label":"Cache"}' --json

Zero-install prompt for a coding agent: read https://agentic-mermaid.dev/llms.txt and follow the parse → narrow → mutate → verify → serialize workflow. To wire Agentic Mermaid into another repo, run npx agentic-mermaid init-agent (or bun run bin/am.ts init-agent from a source checkout); it writes a non-clobbering AGENTS.md section, root skills/ bundle, and .mcp.json sample.

Use strict preview for human inspection and mutate --op/--ops for verified one-shot or batched edits.

For multi-step MCP edits, connect agentic-mermaid-mcp and use Code Mode execute(code) with the same mermaid.* SDK names. Stdio is the default transport; agentic-mermaid-mcp --transport http starts HTTP/SSE and managed PNG file/URL artifacts. See the agent API cookbook for copy-pasteable library, CLI, and MCP recipes.

MCP server

Agentic Mermaid ships a Model Context Protocol server so MCP-capable agents can render and safely edit diagrams without shelling out.

<!-- complete: local-mcp-tools -->
  • Self-hosted (default). agentic-mermaid-mcp runs a stdio server exposing execute (Code Mode sandbox), describe_sdk (one family's mutation schema on demand), render_png, and describe. Package runners can use npx -y agentic-mermaid mcp; the mcp argument routes the package-name binary to the same stdio server. Add --transport http for HTTP/SSE with managed PNG file/URL artifacts. See docs/mcp-http-transport.md and docs/mcp-code-mode-rationale.md.
  • Hosted. A stateless Streamable HTTP endpoint is available at https://agentic-mermaid.dev/mcp (tools: <!-- BEGIN GENERATED: hosted-mcp-tools -->execute, describe_sdk, render_svg, render_ascii, render_png, verify, describe, mutate, and build<!-- END GENERATED: hosted-mcp-tools -->; 64 KB input caps). Call describe_sdk for compact signatures or exact fields before authoring unfamiliar ops. It is MCP JSON-RPC only, not a REST render API. Hosted execute runs the same mermaid.* facade in a Cloudflare Dynamic Worker isolate with no network; hosted PNG returns base64 only.

Local-first is the default posture: prefer the library, CLI, or a self-hosted MCP for anything sensitive, offline, larger than the hosted caps, or needing local PNG file/URL artifacts. The hosted endpoint is a public, unauthenticated convenience for zero-install render/verify/describe and bounded structured edits.

Directory maintainers can use the canonical MCP listing record. Hosted data handling is described in the MCP privacy notice.

Structured edit example

import { parseRegisteredMermaid, asFlowchart, mutate, verifyMermaid, serializeMermaid } from 'agentic-mermaid/agent'

const parsed = parseRegisteredMermaid('flowchart TD\n  API --> DB')
if (!parsed.ok) throw new Error('parse failed')

const flow = asFlowchart(parsed.value)
if (!flow) throw new Error(`not a structured flowchart: ${parsed.value.kind}`)

const next = mutate(flow, { kind: 'add_node', id: 'Cache', label: 'Cache' })
if (!next.ok) throw new Error(next.error.message)

const verify = verifyMermaid(next.value)
if (!verify.ok) throw new Error(JSON.stringify(verify.warnings, null, 2))

const source = serializeMermaid(next.value)

Rules:

  • Use the matching exported as<Family> narrower before mutating an existing structured diagram.
  • Mutation ops use kind, not type.
  • Run verifyMermaid before every commit point.
  • Do not call mutate on opaque fallback bodies; the narrower returns null for unmodeled syntax.

Supported diagram families

Family support is projected from the FamilyDescriptor registry; run am capabilities --json for the live roster. (The Section A capability report is no longer published.) See diagram families for syntax examples and compatibility notes.

More documentation

Live editor and examples

Attribution

Agentic Mermaid is a fork of Beautiful Mermaid by Luki Labs. The ASCII rendering engine is based on mermaid-ascii by Alexander Grooff and extended for Agentic Mermaid.

License

MIT

Related MCP servers

KEKeyboardia logo

Create, co-edit, analyze, publish, and export collaborative step-sequencer sessions through MCP.

3
TypeScript
MIT
View repository →
RERepoRipple logo

Deterministic repository change-impact analysis for engineers and coding agents.

0
Python
MIT
View repository →
DEDerived logo

Derived

Active

Inspect and safely clean local Xcode, Simulator, and XCTest storage.

0
Swift
MIT
View repository →

Committee-reviewed market sizing, forecasts, and competitive landscape from Meridian Consensus.

Live stock, crypto, SEC filings, insider trades, FX and macro data for LLM agents.

0
JavaScript
MIT
View repository →

AI music analysis for agents: BPM, key, genres, moods, instruments and 35+ tags per track.

1
JavaScript
View repository →