
Agentic Mermaid
io.github.adewalev0.4.1更新於 Oct 9, 2026
Render, verify, describe, and safely edit Mermaid diagrams through MCP.
概覽
讓助理渲染、驗證、描述並以結構化方式編輯 Mermaid 圖表,輸出 SVG、PNG、ASCII、Unicode 或 JSON。
- 功能
- Agentic Mermaid 是透過 MCP 提供的 Mermaid 工具組。工具包括 execute(以 mermaid.* SDK 為基礎的 Code Mode 沙箱)、可依需求回傳某圖表族變更結構的 describe_sdk,以及 render_svg、render_ascii、render_png、verify、describe、mutate 與 build。它支援以描述元註冊的圖表族、可組合的樣式與調色盤,並提供解析、收斂、變更、驗證、序列化的結構化編輯流程,而非整張圖重新產生。
- 適用情境
- 適合讓助理起草或修改 Mermaid 圖表並取得可直接發布的成品,或對既有圖表進行安全的结构化編輯而非重寫。適用於圖表撰寫、審閱,以及匯出為 SVG、PNG 或終端輸出。
- 執行需求
- 可作為遠端 Streamable HTTP 端點執行,也可在本機執行。本機使用需要 Node.js 22 或更新版本(僅支援 ESM)以及 npm 套件 agentic-mermaid,例如以 npx agentic-mermaid mcp 啟動;預設傳輸為 stdio,另有選用的 HTTP/SSE 模式。託管端點不需要驗證或 API 金鑰。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Agentic Mermaid,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。
其他 MCP 客戶端
把它新增到你客戶端的 mcpServers 設定中。
{
"mcpServers": {
"agentic-mermaid": {
"type": "http",
"url": "https://agentic-mermaid.dev/mcp"
}
}
}README
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.
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
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.
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).seedre-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-safeagentic-mermaid/agent/core. Audit reports and trusted host-resource helpers remain repository tooling instead of published runtime entry points.
Installation
For repository development, install from source and run the Bun entrypoints
(Bun 1.4.0 or later; bun upgrade if bun --version is older):
ESM-only.
agentic-mermaidships ES modules (there is no CommonJS build);require()consumers should use dynamicimport()instead. Requires Node ≥ 22.The
am …examples below name the published bin. After a project-local npm install, invoke it from a shell asnpx --no-install agentic-mermaid …(or from an npm script asam …). From a source checkout, usebun 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
PNG
CLI equivalent:
ASCII / Unicode
Agent quick start
If your coding agent can read repo files, point it at:
skills/agentic-mermaid-diagram-workflow/SKILL.mdfor diagram authoring/editing.skills/agentic-mermaid-live-editor/SKILL.mdfor editor changes.
If it only has shell access:
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.
- Self-hosted (default).
agentic-mermaid-mcpruns a stdio server exposingexecute(Code Mode sandbox),describe_sdk(one family's mutation schema on demand),render_png, anddescribe. Package runners can usenpx -y agentic-mermaid mcp; themcpargument routes the package-name binary to the same stdio server. Add--transport httpfor HTTP/SSE with managed PNG file/URL artifacts. Seedocs/mcp-http-transport.mdanddocs/mcp-code-mode-rationale.md. - Hosted. A stateless Streamable HTTP endpoint is available at
https://agentic-mermaid.dev/mcp(tools:execute,describe_sdk,render_svg,render_ascii,render_png,verify,describe,mutate, andbuild; 64 KB input caps). Calldescribe_sdkfor compact signatures or exact fields before authoring unfamiliar ops. It is MCP JSON-RPC only, not a REST render API. Hostedexecuteruns the samemermaid.*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
Rules:
- Use the matching exported
as<Family>narrower before mutating an existing structured diagram. - Mutation ops use
kind, nottype. - Run
verifyMermaidbefore every commit point. - Do not call
mutateon opaque fallback bodies; the narrower returnsnullfor 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
- System architecture — start here for the rendered resolved-request, family-descriptor, positioned-artifact, and output-security overview (dogfooded, drift-proof).
- API reference — renderers, agent API, options, CLI/MCP pointers.
- Agent API cookbook — practical recipes for agents.
- Theming — two-color themes, built-ins, Shiki compatibility.
- Custom style cookbook — JSON style files, screenshots, schema usage, and CLI commands.
- Fonts in custom styles — font selection, SVG declarations, PNG directories, fallbacks, and browser usage.
- React integration — browser-safe, family-loaded rendering.
- ASCII output — terminal output, color modes, XY charts.
- Mermaid config — frontmatter, init directives, runtime config.
- Features, quality, security, fork differences.
- Adding diagram types for contributors.
Live editor and examples
- Examples — supported families, Style + Palette combinations, and the rich shared examples corpus.
- Live editor — SVG/PNG exports and URL sharing.
examples/agent-loop.tsexamples/mcp-vs-cli-complex-diagrams.tsexamples/agent-improve-auth-flow.ts
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
來源:README.md,提交 f9013de
工具
0版本歷史
1- v0.4.1最新Sep 16, 2026
