Glyphic

Glyphic

An MCP server that lets agents draw 18 diagram types from JSON (no SVG, no headless browser)

Category
访问服务器

README

<div align="center"> <h1>Glyphic</h1> <p><b>AI agents can generate diagrams from structured JSON — without touching SVG.</b></p> <p>Typed JSON in, beautiful native SVG & PNG out, across 18 diagram types. Built for LLMs and autonomous agents — no fragile DSL, no headless browser.</p> </div>

<p align="center"> <a href="https://www.npmjs.com/package/@glyphicjs/core"><img src="https://img.shields.io/npm/v/@glyphicjs/core?label=%40glyphicjs%2Fcore&color=e2502f" alt="npm version" /></a> <a href="https://www.npmjs.com/package/@glyphicjs/mcp-server"><img src="https://img.shields.io/npm/v/@glyphicjs/mcp-server?label=mcp-server&color=e2502f" alt="mcp-server npm version" /></a> <a href="https://www.npmjs.com/package/@glyphicjs/core"><img src="https://img.shields.io/npm/dm/@glyphicjs/core?label=downloads&color=222" alt="npm downloads" /></a> <img src="https://img.shields.io/badge/license-FSL%20%2F%20MIT-222" alt="License: FSL / MIT" /> </p>

<p align="center"> <a href="https://glyphic.web.app/generate">Live playground</a> · <a href="#quick-start">Quick Start</a> · <a href="./docs/examples/README.md">Examples Gallery</a> · <a href="./docs/README.md">Documentation</a> · <a href="#supported-diagrams">18 Diagram Types</a> </p>

Add it to your AI agent in 30 seconds — it runs over stdio via npx, no install:

# Claude Code
claude mcp add glyphic -- npx -y @glyphicjs/mcp-server

For Cursor, Claude Desktop, VS Code, Windsurf, and Antigravity, see the MCP setup guide. Then just ask: “Draw an ERD for a blog with users, posts, and comments.”

<p align="center"> <img src="./docs/examples/01_cloud_architecture.png" alt="Cloud architecture diagram" width="320" /> <img src="./docs/examples/31_dark_cicd_pipeline.png" alt="Dark-mode CI/CD pipeline" width="430" /> </p>


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.

You can use it three ways: as a library (@glyphicjs/core), as an MCP server (so Claude Desktop / Cursor can draw diagrams as a native tool), or as a self-hosted HTTP API.

Why

If an LLM needs to produce a diagram today, it has two bad options:

  1. Draw raw SVG/Canvas. LLMs have no visual cortex — ask one to place nodes by absolute coordinate and they overlap, text overflows, and connectors cut straight through other shapes.
  2. Emit a DSL like Mermaid. Mermaid's syntax is finicky (-->|label|) and a single typo crashes the whole render. It also relies on a headless browser (Puppeteer) to run its layout, which is slow, heavy, and awkward to run server-side.

Glyphic separates semantics (what the diagram means) from visuals (where things are drawn):

  • Machine-first JSON, not a DSL. The API surface is a strict Zod schema. Models emit ordinary JSON arrays — no fragile grammar to get wrong, and validation errors come back as precise, fixable messages instead of a crash.
  • Real layout engines, no DOM. Routing, intersections, and sizing are computed by mathematical graph engines (elkjs for graphs, d3-hierarchy/d3-sankey for data) — never a browser.
  • Native rasterization. SVG is compiled to PNG by Rust (@resvg/resvg-js) directly in Node. Fast, light, and deployable anywhere — no Chromium.

The result: agents produce correct, good-looking diagrams on the first try, and you run it as a normal Node dependency.

How

Pick the integration that fits you.

1. As a library

npm install @glyphicjs/core @glyphicjs/schema
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.

2. As an MCP server (Claude Desktop / Cursor)

Add it to claude_desktop_config.json:

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

Restart Claude Desktop and ask: "Draw an architecture diagram of a React app behind an AWS load balancer talking to 3 Node services and a Postgres database." Claude emits the JSON, calls the tool, and the rendered PNG appears inline. See the MCP guide.


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 ("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 routing, nesting (VPCs/clusters), and crow's-foot/UML markers with no overlaps.
  • ⚡ 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 context Flowchart
Sequence State machine ERD (crow's-foot)
UML Class Mindmap Gantt
Timeline User Journey Kanban
Pie Quadrant Sankey
Git graph Treemap Canvas (freeform SVG)

Monorepo architecture

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

Package What it is
@glyphicjs/schema The pure Zod validation layer — the LLM-facing contract. Validate model output before rendering.
@glyphicjs/core The engine: layout adapters, scene graph, SVG rendering, and rasterization.
@glyphicjs/mcp-server Official 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

License

LICENSE. Build incredible things.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选