npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

agentic-mermaid

v0.5.5

Published

Agentic Mermaid: render, verify, and safely edit Mermaid diagrams as ASCII, PNG, SVG, or structured agent workflows — with composable styles (hand-drawn, excalidraw, watercolor, or your own as JSON).

Readme

Agentic Mermaid

Beautiful diagrams, made with your agent.

Agentic Mermaid helps coding agents create styled diagrams from Mermaid source and edit existing diagrams through typed operations. Export SVG or PNG for documents, and ASCII or Unicode for terminal review.

It is forked from lukilabs/beautiful-mermaid. Published on npm as agentic-mermaid; the GitHub repository is adewale/agentic-mermaid; the live site is agentic-mermaid.dev.

A login flow with credential validation, an MFA decision, two retry paths, session creation and a dashboard, rendered in the hand-drawn style

A login flow with MFA, rendered directly by Agentic Mermaid. Mermaid source · Style and reproduction command

Live Demo & Samples · Live Editor

Ask your coding agent:

Read Instructions_for_agents.md in this repository, or https://agentic-mermaid.dev/llms.txt if you don't have a checkout. Draw Browser → API → Database using the hand-drawn style and nord-light palette. Verify it, then return the Mermaid source and an SVG.

Agent setup and skills · Try the same diagram in JavaScript

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

Why Agentic Mermaid

Choose a built-in style, or keep your diagram's colors and fonts in a JSON style file. Inspect the rendered result before publishing.

| You want | Agentic Mermaid gives you | |---|---| | An agent to draft the diagram | Mermaid source plus a verified render path | | Beautiful defaults | Built-in looks such as watercolor, blueprint, hand-drawn, and publication-figure | | Brand fit | Style + Palette stacks and custom JSON palettes you can keep in your repo | | Safe edits later | parseRegisteredMermaid → family narrower → mutate → verifyMermaid → serializeMermaid | | Reviewable artifacts | SVG, 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

  • Discover supported diagrams and edits — am capabilities --json reports what the installed version supports, including registered extensions.
  • SVG, PNG, ASCII, Unicode, JSON — export images, review diagrams in the terminal, or inspect positions as JSON layout.
  • Render SVG without a browser — the synchronous JavaScript API runs without a DOM or Puppeteer.
  • Composable styles — { style: ['hand-drawn', 'dracula'] } combines a look with a palette. Set colors, fonts, strokes, fills and backdrops in a JSON style. seed re-rolls the ink, never the layout.
  • Match your editor's colors — choose a built-in palette, theme from two colors, or adapt a VS Code theme with Shiki.
  • Agent-native editing — use typed operations for modeled syntax. Inputs with unmodeled syntax retain their source; source-preserving edits cover selected Class and Flowchart operations.
  • CLI + MCP + library — use am, connect agentic-mermaid-mcp, or import agentic-mermaid/agent for rendering and editing. See the API reference for the other library and browser entry points.

Installation

Requires Node.js 22 or later, or Bun 1.4.0 or later. The package is ESM-only; use import, or dynamic import() from CommonJS.

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

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

Save this as diagram.mjs:

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

const svg = renderMermaidSVG(`flowchart LR
  Browser --> API --> Database`, {
  style: ['hand-drawn', 'nord-light'],
  security: 'strict',
})

writeFileSync('diagram.svg', svg)
node diagram.mjs

Open diagram.svg to see Browser → API → Database in the hand-drawn style with the nord-light palette.

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":"set_label","target":"API","label":"API gateway"}' --json

For an existing diagram, follow parse → narrow → mutate → verify → serialize. For a new diagram, author Mermaid source, then parse and verify it. 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, use Code Mode execute(code) with the same mermaid.* SDK names. See the agent API cookbook for 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.

After installation, start the local stdio server:

npx --no-install agentic-mermaid mcp

Use the library, CLI or local MCP for private diagrams, offline work, larger inputs or local PNG files. The MCP transport guide covers HTTP/SSE and file/URL artifacts; agent setup shows how to generate a sample client configuration. The tool reference and Code Mode guide explains the available tools and multi-step edits.

An optional public, unauthenticated MCP endpoint runs at https://agentic-mermaid.dev/mcp. It accepts MCP JSON-RPC rather than REST render requests, caps inputs at 64 KB and returns PNG as base64. Hosted calls send your source or code to the server; see the privacy notice. Directory maintainers can use the MCP listing record.

Structured edit example

Change the API node's displayed label while keeping its connection to DB:

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: 'set_label', target: 'API', label: 'API gateway' })
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)
console.log(source)

Output:

flowchart TD
  API[API gateway] --> DB

The node ID is still API; its displayed label is now API gateway, and the API → DB connection remains. Verification checks for structural and geometry problems; review the rendered result and confirm it expresses your intent before saving.

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.
  • For opaque Class/Flowchart inputs, bounded source-preserving edits support Class add_member/remove_member and Flowchart set_label/rename_node. Use mutatePreservingSource, applyOps with mode: 'source-preserving', or CLI --preserve-source; MCP and the editor worker expose the same explicit mode. Save exact source and inspect the retained portability diagnostics; ambiguous ownership and unsupported dependencies refuse atomically.

Supported diagram families

Run am capabilities --json for the supported families and edit operations in your installed version. See diagram families for syntax examples and compatibility notes.

More documentation

Live editor and examples

Contributing and reporting bugs

Report a bug with the Mermaid source, render options and the result you expected. For changes to the project, read the contributor instructions for implementation and testing rules.

To work from a source checkout, use Bun 1.4.0 or later:

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

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

Native Event Modeling and ZenUML authoring and rendering have documented capability and runtime contracts.