Glyphic

io.github.MS-Teja由 GitHub 账号 MS-Teja 发布v1.0.2更新于 Oct 24, 2026

Generate 18 diagram types from structured JSON natively. Built for LLMs and agents.

概览

AI 生成的概览

让助手把结构化 JSON 转成 18 种类型的图表,输出 SVG、PNG 或 React Flow JSON。

可以做什么
Glyphic 以类型化 JSON 而非手绘方式生成图表。模型输出严格的节点与边(或实体、提交等)模式,渲染前先做校验,服务器返回可缩放 SVG、高分辨率 PNG 或 React Flow JSON。它支持 18 种图表类型,包括架构图、时序图、ERD、UML 类图、状态机、流程图、甘特图、时间线、桑基图、Git 图、思维导图、饼图、象限图、用户旅程、看板、C4、矩形树图和自由画布,并提供主题、样式预设、宽高比取景、字体和 FontAwesome 图标。
适用场景
当助手需要把图表作为可重复、可编辑的产物而非一次性手写 SVG 时适用,尤其适合大型图表、文档与 CI 流水线,或把图表生成嵌入产品。也适合希望用一次经过校验的工具调用完成图表生成的智能体与 LLM 应用开发者。
运行要求
通过 npx 以 stdio 方式在本地运行 npm 包 @glyphicjs/mcp-server,需要 Node.js。未声明认证、环境变量或请求头。也可作为库使用,或自托管为 HTTP 服务。
安装前请注意
该服务器会写出渲染后的图表文件(SVG、PNG)并返回 React Flow JSON,应检查输出路径与内容。未声明凭据、支付或向第三方共享数据。README 称内置输入校验、SVG 转义和大小限制。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Glyphic,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Glyphic

A diagram is data, not a drawing.

Your model describes the diagram as typed JSON; Glyphic renders it — deterministic SVG & PNG across 18 types, validated before it draws, with no DSL and no headless browser. Diagram infrastructure for LLMs and agents that you own and build on.

[npm version] [mcp-server npm version] [npm downloads] [License: FSL / MIT] [Sponsor]

Live playground · Quick Start · Examples Gallery · Documentation · 18 Diagram Types

[Sketch architecture diagram] [Freeform canvas dashboard]


Quick Start

Glyphic gives an LLM structured data in and hands you a finished diagram out. Use it three ways.

1. MCP server — add to your AI agent in 30 seconds

It runs over stdio via npx, no install:

bash
# Claude Codeclaude mcp add glyphic -- npx -y @glyphicjs/mcp-server

For Cursor, Claude Desktop, VS Code, Windsurf, and Antigravity, add it to your client's MCP config:

json
{  "mcpServers": {    "glyphic": { "command": "npx", "args": ["-y", "@glyphicjs/mcp-server"] }  }}

Then just ask: "Draw an ERD for a blog with users, posts, and comments." The model emits the JSON, calls the tool, and the rendered diagram appears inline. See the MCP setup guide.

2. Library

bash
npm install @glyphicjs/core @glyphicjs/schema
typescript
import { processDiagram } from "@glyphicjs/core";import { writeFileSync } from "node:fs";
const result = await processDiagram({  type: "architecture",  title: "Web App",  nodes: [    { id: "web", label: "Web App", shape: "rounded", icon: "fab-react" },    { id: "api", label: "API", shape: "hexagon", icon: "fas-bolt" },    { id: "db", label: "PostgreSQL", shape: "database", icon: "fas-database" }  ],  edges: [    { source: "web", target: "api", label: "REST" },    { source: "api", target: "db", label: "SQL" }  ]});
writeFileSync("diagram.png", result.png);   // Buffer (high-res PNG)writeFileSync("diagram.svg", result.svg);   // string (scalable SVG)console.log(result.reactFlow);              // interactive React Flow JSON

See the Core API reference.

3. Self-hosted HTTP API

Need it behind your own endpoint? Glyphic can be self-hosted as an HTTP service that wraps the exact same engine — same schema in, same SVG/PNG/React Flow out — so your product or platform can generate diagrams without shipping the library to every client.

Who it's for

  • Agent & LLM-app builders — expose diagram generation as a single tool call and let the model describe it, not draw it.
  • Platform teams — embed diagram generation directly in your product behind one validated schema.
  • CI & docs pipelines — deterministic, byte-identical, versionable output with no Chromium to install or babysit.
  • React developers — get interactive React Flow JSON out of the box, not just static images.

What

Glyphic is infrastructure for generating diagrams from structured data. You give it a strict, semantic JSON document — arrays of nodes and edges, or entities, or commits — and it returns a polished diagram as:

  • SVG — pure, scalable vector markup (accessible: role="img" + <title>).
  • PNG — high-resolution raster, rendered natively via Rust (@resvg/resvg-js).
  • React Flow JSON — nodes/edges mapped for an interactive React Flow canvas.

It supports 18 diagram types (architecture, sequence, ERD, UML class, state machines, flowcharts, Gantt, timelines, Sankey, Git trees, mindmaps, pie, quadrant, user journeys, Kanban, C4, treemaps, and a freeform canvas) behind a single validated schema.

Why

Yes — a modern LLM can draw a clean six-box flowchart as raw SVG. Go ask one; for a single throwaway diagram, that's the right tool. This isn't a bet that models "can't draw."

The problem is that a drawn SVG is a dead picture. It comes out different every generation, it falls apart exactly where real diagrams live — many nodes and later edits — and to change one box you regenerate the whole thing and it drifts. Glyphic treats the diagram as data: your model describes what it means as typed JSON, and a real engine renders it. Three reasons that holds up no matter how good the model gets:

  1. A machine-authoring contract, not a DSL. The input is a strict Zod schema. Malformed model output comes back as a precise, fixable error before anything renders — so generate → validate → fix → render loops are trivial. DSLs like Mermaid parse-or-crash on a single typo (-->|label|).
  2. Deployable as infrastructure. Layout is computed by real graph engines (elkjs, d3-hierarchy/d3-sankey) and SVG is rasterized to PNG by Rust (@resvg/resvg-js) — no DOM, no headless browser, no Chromium. It runs in a CI job, a Lambda, an agent loop, or a Docker container as a normal Node dependency. This stays true regardless of model capability.
  3. Cheap and intact at scale. Hand-drawing a large diagram means emitting thousands of coordinate tokens — slow, costly, and liable to blow the model's output limit and truncate into a broken render. Your model emits compact semantic JSON instead; the heavy geometry is generated deterministically.

And because a real engine owns the layout, the diagram scales and stays editable: it nests clusters and routes edges around obstacles where hand-placed SVG turns into diagonal lines cutting through boxes, its output is byte-identical (versionable, snapshot-testable), and the JSON stays a source of truth you can diff and re-render — not a house of cards of absolute coordinates.

[The same 44-node architecture: a frontier model's one-shot raw SVG (edges tangled diagonally through boxes) above Glyphic's rendering of the identical JSON (nested tiers, routed edges)]
The same 44-node spec. Top: a current frontier model asked for raw SVG — the boxes are fine, but the edges cut diagonally through shapes and the result can't be edited without regenerating it. Bottom: Glyphic renders the identical JSON — nested tiers, edges routed around obstacles, still an editable source of truth.
Method: both produced by the same model (Claude Opus 4.8) from one brief — the top by asking it to hand-write SVG in a single pass; the bottom by asking it to emit Glyphic's typed JSON, then rendering with @glyphicjs/core (ELK layout + resvg, no browser). Same author, same content — only the draw-vs-describe boundary differs.

How it compares

FeatureGlyphicClaude ArtifactsMermaidD2
Input formatTyped JSON (Zod schema)Natural language → SVGText DSLText DSL
Renders without a browser✅ Rust (resvg)N/A (cloud-only)❌ Puppeteer/Chromium✅ Go binary
Model-agnostic✅ Any JSON-capable LLM❌ Claude only✅✅
Schema validation✅ Zod + fixable errors❌❌ Parse-or-crash❌
Native MCP server✅ @glyphicjs/mcp-serverN/A (built-in to Claude)❌❌
React Flow output✅ Interactive nodes/edges❌❌❌
Deterministic output✅ Byte-identical❌⚠️ Mostly✅
LicenseFSL → Apache-2.0ProprietaryMITMPL-2.0

See the full comparison + benchmarks.

Features

  • 🧩 18 diagram types behind one validated schema — see them all.
  • 🎨 Theming — built-in presets ("theme": "dark", plus light / pastel / mono) or a full custom palette. Theming guide.
  • 🖌️ Styles — visual personality presets: "style": "compact" (default), clean, minimal, or hand-drawn sketch. Styles guide.
  • 📺 Aspect-ratio framing — auto-fits diagrams to clean 16:9 / 9:16 frames (or set "aspectRatio"), by padding — never cropping.
  • 🔤 Fonts — any Google Font ("theme": { "fontFamily": "Outfit" }) or your own .ttf.
  • 🖼️ Native icons — drop in any FontAwesome icon ("icon": "fas-database", "icon": "fab-aws") or your own SVG via customIcons.
  • 📐 Real layout — elkjs + d3 compute nesting (VPCs/clusters), crow's-foot/UML markers, and edge routing around obstacles — staying clean at the node counts where hand-placed SVG tangles into diagonals through boxes.
  • ⚡ Native PNG — Rust rasterization, no headless browser.
  • ♿ Accessible output — every SVG ships with role="img" and a <title>.
  • 🔒 Safe by construction — strict input validation, SVG output escaping/sanitization, and size limits to resist malicious input.
  • 🧪 Multiple outputs — SVG, high-res PNG, and React Flow JSON from one call.

Supported Diagrams

18 first-class types — explore them in the Examples Gallery and the Diagram Types reference.

Architecture (nested VPCs/clusters)C4 contextFlowchart
SequenceState machineERD (crow's-foot)
UML ClassMindmapGantt
TimelineUser JourneyKanban
PieQuadrantSankey
Git graphTreemapCanvas (freeform SVG)

Monorepo architecture

A pnpm + Turborepo monorepo of three open-source libraries.

PackageWhat it is
@glyphicjs/schemaThe pure Zod validation layer — the LLM-facing contract. Validate model output before rendering.
@glyphicjs/coreThe engine: layout adapters, scene graph, SVG rendering, and rasterization.
@glyphicjs/mcp-serverOfficial Model Context Protocol server — exposes Glyphic as a native tool to Claude Desktop / Cursor.

Adding a new diagram type is one entry in packages/core/src/registry.ts plus a schema and a layout adapter — see CONTRIBUTING.

Documentation

Blog

Support

License

LICENSE — FSL / MIT.


Give your AI structured data. Let Glyphic handle the drawing.

来源:README.md,提交 ed79edb

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.2最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。