Skip to main content
Glama

diagramsmith

tests

Draw Mermaid and Excalidraw-style diagrams locally, and explore them as a self-contained interactive page. Live demo.

diagramsmith demo: an interactive checkout diagram, hover, details panel, guided tour, nested payment diagram and two style switches

Real output, recorded 2026-12-01.

Ask an agent for a diagram

User: How does our checkout work? Draw it for me.

Agent: I read the services and drew the checkout platform: storefront, gateway, cart, checkout, payments, inventory, orders and fulfilment, with the payment service as a nested diagram. I'm rendering the interactive explorer to diagrams/checkout-platform.html. Open it to pan, zoom, click a node for details, press Tour for the guided walk, and use Style to change the look.

The explorer is one HTML file with no CDN and no server: pan and zoom, search, click a node for a details panel, nested drill-down, a guided tour, a presenter mode, a live 7-style switcher and export to SVG, PNG or an editable .excalidraw.

Related MCP server: excalidraw-mcp

What it looks like

Mermaid sequence: an OAuth sign-in with PKCE. Diagram styles change the colours and fonts only, not the Mermaid layout.

The interactive page: select a node, see what it sends and receives, and open the diagram hidden inside it.

Install the skill

For any AI coding agent with skills:

npx skills add Zune2004/diagramsmith
gh skill install Zune2004/diagramsmith diagramsmith

On first use, if node <skill-dir>/tools/diagram.mjs doctor reports missing packages, run the first-run setup once:

node <skill-dir>/tools/setup.mjs

Claude Code plugin

/plugin marketplace add Zune2004/diagramsmith
/plugin install diagramsmith@diagramsmith

Gemini CLI extension

gemini extensions install https://github.com/Zune2004/diagramsmith

Manual copy paths

Copy the skills/diagramsmith folder to your agent's skills directory:

Agent

User-level path

Project-level path

Claude Code

~/.claude/skills/diagramsmith

.claude/skills/diagramsmith

OpenAI Codex CLI

~/.agents/skills/diagramsmith

.agents/skills/diagramsmith

Gemini CLI

~/.agents/skills/diagramsmith

.agents/skills/diagramsmith

GitHub Copilot CLI

~/.agents/skills/diagramsmith

.github/skills/diagramsmith

Cursor

~/.agents/skills/diagramsmith

.agents/skills/diagramsmith

opencode

~/.agents/skills/diagramsmith

.opencode/skills/diagramsmith

Kilo Code

~/.agents/skills/diagramsmith

.kilo/skills/diagramsmith

Cline

~/.agents/skills/diagramsmith

.agents/skills/diagramsmith

Amp

~/.agents/skills/diagramsmith

.agents/skills/diagramsmith

Goose

~/.agents/skills/diagramsmith

.agents/skills/diagramsmith

Aider (no skills)

In .aider.conf.yml:

read: [skills/diagramsmith/SKILL.md]

Chat apps (MCP)

Run diagramsmith as a stdio MCP server with "command": "npx" and "args": ["-y", "diagramsmith", "mcp"]. Rendered files are written to DIAGRAMSMITH_OUT if set, or ~/diagrams by default (<home>/diagrams). The four tools are render_mermaid, render_diagram, render_interactive and list_styles.

In hosts that support MCP Apps (io.modelcontextprotocol/ui, such as Claude Desktop, ChatGPT, and Goose), render_interactive also links to the ui://diagramsmith/explorer resource so the diagram renders inline while still saving the standalone HTML file. Inside the conversation, you see the full interactive explorer—pan and zoom, search, node details, nested diagrams, guided tour, host theme matching, live style switching, and optional fullscreen mode—without leaving the chat.

If you want to pre-install packages or check your browser beforehand, run npx -y diagramsmith doctor (or node <package-dir>/skills/diagramsmith/tools/setup.mjs).

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "diagramsmith": {
      "command": "npx",
      "args": ["-y", "diagramsmith", "mcp"]
    }
  }
}

Cursor (~/.cursor/mcp.json or .cursor/mcp.json):

{
  "mcpServers": {
    "diagramsmith": {
      "command": "npx",
      "args": ["-y", "diagramsmith", "mcp"]
    }
  }
}

VS Code (.vscode/mcp.json):

{
  "servers": {
    "diagramsmith": {
      "command": "npx",
      "args": ["-y", "diagramsmith", "mcp"]
    }
  }
}

Windsurf (~/.codeium/windsurf/mcp_config.json):

{
  "mcpServers": {
    "diagramsmith": {
      "command": "npx",
      "args": ["-y", "diagramsmith", "mcp"]
    }
  }
}

No agent

Terminal or npx:

npx diagramsmith mermaid     flow.mmd         -o flow.svg
npx diagramsmith excalidraw  spec.json        -o diagram.png
npx diagramsmith interactive spec.json        -o explorer.html --styles all
npx diagramsmith presets     -o style-gallery.html
npx diagramsmith style       list
npx diagramsmith style       set blueprint
npx diagramsmith check
npx diagramsmith doctor

If you cloned the repository directly, run the first-run setup once and invoke the CLI directly:

node skills/diagramsmith/tools/setup.mjs
node skills/diagramsmith/tools/diagram.mjs mermaid     skills/diagramsmith/tools/examples/auth-flow.mmd         -o auth-flow.svg
node skills/diagramsmith/tools/diagram.mjs excalidraw  skills/diagramsmith/tools/examples/payments-detail.json  -o payments.png
node skills/diagramsmith/tools/diagram.mjs interactive skills/diagramsmith/tools/examples/interactive-demo.json -o demo.html --styles all

What it is good for

  • A system overview with zones and one nested zoom: the checkout platform above is ten services, two zones and a payment diagram inside a node.

  • A flow with branches, retries or a failure path, where a picture beats a paragraph.

  • A request lifecycle or auth sequence, as a Mermaid block next to the code it describes.

  • Explaining a design to a person: an interactive page they can pan, search, click and present.

  • Diagrams in a README, issue or PR, where plain Mermaid renders without any tool.

Embed it on your site

Build a compact page with diagramsmith interactive map.json --embed -o static/map.html, copy the loader with diagramsmith embed-script -o static, then add one <script> tag and one <diagramsmith-explorer src="static/map.html"> element, or a plain <iframe>. The embed keeps one style, a minimal toolbar (fit, zoom, fullscreen, optional full view link), starts nothing on its own, and reads ?toolbar=, ?theme= and ?tour=1 at view time. It is a static file, so any static host can serve it; EMBED.md has recipes for GitHub Pages, Docusaurus, MkDocs and VitePress (not all tested in those tools). Recipes and limits are in docs/EMBED.md; the live demo is https://zune2004.github.io/diagramsmith/.

Built on

diagramsmith does not draw anything itself. It gives agents a spec and a workflow, then hands the drawing to proven open-source parts. Credit where it is due:

  • Mermaid and mermaid-cli render the Mermaid diagrams.

  • Excalidraw (@excalidraw/utils) draws the hand-drawn look and the editable .excalidraw files.

  • dagre lays out the boxes and arrows.

  • Puppeteer drives your own Chrome or Edge to render.

What diagramsmith adds: the JSON spec the agent writes, the 7 style presets, the interactive explorer page (nested diagrams, tour, presenter mode, style switch), and the skill, plugin and MCP packaging. Licences are in THIRD_PARTY.md.

How it compares

There are many good diagram tools for agents, and several are more popular than this one. The comparison below is honest as of December 2026. If one of these fits you better, use it.

If you want

Use

Why

Diagrams inside a chat, made without asking

Claude, ChatGPT or Gemini directly

They now draw inline visuals on their own.

Polished HTML explainers, many diagram types, code analysis, video tours

Archify

Larger and far more popular; no npm install.

Formal architecture models with C4 levels

LikeC4

A real modelling language, with drill-down and walkthroughs.

Precise, editable diagrams

draw.io MCP

Full editor, also inline in chat.

Drawing together on a live canvas

Excalidraw or tldraw

Real canvases you edit by hand.

Static Mermaid images without a browser

beautiful-mermaid

No Chrome needed.

A Mermaid block in a README

Nothing

GitHub renders Mermaid natively.

Where diagramsmith is different:

  • one offline HTML file that holds the overview and the nested diagrams inside it;

  • a hand-drawn look you can switch between 7 styles live;

  • export to an editable .excalidraw;

  • no account, no API key, no network calls.

Where it is weaker:

  • it needs Chrome or Edge and a few hundred MB of packages;

  • the explorer works for box-and-arrow diagrams, while sequence, ER and state diagrams stay plain Mermaid;

  • it does not read your code by itself;

  • layout is dagre only.

These are the next things to fix. Issues are welcome.

Commands and exit codes

Command

What it does

Exit codes

diagramsmith --version

Print the version.

0

diagramsmith mermaid <file.mmd> [-o out.svg|out.png]

Render Mermaid (needs the optional mermaid-cli and Chrome/Edge).

0 ok, 1 error, 2 no browser (prints a Mermaid block to paste instead)

diagramsmith excalidraw <spec.json|file.excalidraw> [-o out.svg|out.png]

Auto-layout a spec and render it, plus an editable .excalidraw.

0 ok, 1 error (invalid spec, duplicate id, PNG too large)

diagramsmith interactive <spec.json|file.mmd> [-o out.html]

Build the self-contained HTML explorer and self-test it in headless Chrome.

0 ok, 1 error; --strict also exits 1 when the self-test finds a problem

diagramsmith presets [-o style-gallery.html]

Render the same sample in all 7 presets.

0 ok, 1 error

diagramsmith style <list|options|show|set|reset>

List presets and options, or save a default style.

0 ok, 1 error

diagramsmith check [--strict]

Self-test every renderer.

0 all good, 1 something failed

diagramsmith doctor

Check Node, dependencies and Chrome/Edge.

0 all good, 1 something needs fixing

diagramsmith mcp

Run the stdio MCP server.

Runs until stdin closes; JSON-RPC errors are reported in-band

Limits to know

  • Rendering is local: no account, no API key, no telemetry. Diagrams are not sent anywhere; the renderer starts a local 127.0.0.1 server only.

  • It needs Node.js 20 or newer and Google Chrome or Microsoft Edge (override with CHROME_PATH or PUPPETEER_EXECUTABLE_PATH). On first install, the npm packages are a few hundred MB; the browser is reused, not downloaded.

  • A PNG export of a very large diagram (for example 300 nodes) can be too large. Use SVG, a lower --scale, or split the diagram.

  • For Mermaid, a style preset changes colours and fonts only. The hand-drawn look comes from the Excalidraw-style renderer.

  • The interactive page needs a current browser (Chrome, Edge, Firefox 113+ or Safari 16.4+); it unpacks its payload in the browser.

  • interactive pre-renders every combination of up to 3 collapsible zones, so more zones or many --styles make a bigger HTML file.

The 7 style presets

Preset

Look

sketch (default)

Hand-drawn whiteboard with soft pastels

clean

Crisp straight lines and a modern UI palette

blueprint

White technical linework on engineering blue, monospace labels, sharp corners

midnight

Dark canvas with bright neon accents

mono

Black-and-white with hatching for print

corporate

Muted tones, thin sharp lines, roomy spacing

playful

Chunky sketchy lines and bright colours on a warm page

Customize any part with npx diagramsmith style options and npx diagramsmith style set <preset> [key=value ...] [--project], or pass --preset <name> on a single render.

Privacy

Rendering is local: no account, no API key, no telemetry; your diagrams are not sent anywhere (the renderer starts a local 127.0.0.1 server only).

Licence

MIT. See LICENSE and THIRD_PARTY.md.

Development

Install the renderer dependencies once:

npm ci --prefix skills/diagramsmith/tools

Run the tests and the renderer self-test:

node --test --test-concurrency=4 tests/*.test.mjs
node skills/diagramsmith/tools/diagram.mjs check

Regenerate every picture above, including the GIF (needs Chrome or Edge and ffmpeg on PATH):

node docs/demo/make_media.mjs

The example spec is docs/demo/checkout-platform.json; the Mermaid sequence is docs/demo/oauth-sequence.mmd.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to generate and render Mermaid diagrams (flowcharts, sequence diagrams, etc.) as PNG/SVG images with local file saving and HTTP access URLs. Supports batch processing and intelligent caching for efficient diagram creation.
      1
      62 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to build, edit, organize, and export Excalidraw diagrams (architecture, flowcharts, etc.) entirely headless, producing .excalidraw files, SVG, and PNG renders.
      3,392 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables coding agents to draw and edit Excalidraw diagrams on localhost by rendering Mermaid source into a live-updating canvas synced through a context file, with support for reusable icon libraries. No API key is required.
      GNU Lesser General Public v2.1 only