AIGUI

io.github.liliang-cnv0.48.0更新于 Oct 4, 2026

Let coding agents draw charts, diagrams, 3D, molecules and animated topologies as PNGs or live pages

概览

AI 生成的概览

让编码助手把图表、示意图、3D 场景、分子和基础设施拓扑渲染为 PNG 或本地实时页面。

功能
AIGUI 把助手编写的 markdown 块转换为图片:ECharts 图表、Mermaid 示意图、KaTeX 数学公式、仪表盘、3D 场景、由 SMILES 生成的分子、轨道、知识图谱以及分步拓扑。工具包括用于查询块语法的 aigui_guide、生成 PNG 的 aigui_render、打开实时页面的 aigui_open、按查找替换修改页面的 aigui_edit、导出 PNG、PDF、HTML、GIF 或 WebM 的 aigui_export、根据 docker-compose 或 Kubernetes 清单绘制系统的 aigui_topology,以及读取用户评论的 aigui_feedback。无头浏览器会在助手看到结果前检查标签重叠、文字被裁切或过小以及对比度不足等问题。
适用场景
当助手的回答用图片比文字更易理解时适用,例如根据数据文件生成图表、架构示意图,或从真实部署配置读取的基础设施拓扑。也适合用户希望在渲染页面上留言、再由助手修改的工作流程。
运行要求
以 npm 包 @ai-gui/mcp 通过 stdio 在本地运行,需要 Node.js 18.11 或更高版本。首次绘图会下载约 100 MB 的无头浏览器,可用 AIGUI_NO_BROWSER_DOWNLOAD=1 跳过并改用已安装的 Chrome 或 Edge。无需账号或 API 密钥。可选变量包括 AIGUI_OUT_DIR、AIGUI_NO_OPEN、AIGUI_OPEN_IMAGES、AIGUI_PLUGIN_DIR 和 AIGUI_BROWSER_CHANNEL。
安装前请注意
会话运行期间页面通过 127.0.0.1 上由系统选择的端口提供,且仅提供页面目录。输出默认写入缓存目录。自定义块是普通浏览器脚本,其 HTML 会被净化,但仍属于加载到页面中的第三方代码。除非禁用,首次运行会下载浏览器。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

@ai-gui/mcp

[npm] [license] [CI]

Let your coding agent draw. An MCP server — and the engine of the AIGUI plugin for Claude Code and Codex — that turns charts, diagrams, maths, 3D scenes, molecules, orbits, dashboards and step-by-step infrastructure topologies into PNGs the agent can check, or a live page in your browser.

[A failover topology, drawn and played by the agent]

Live demos · Source · All packages

Install

Claude Code — the plugin also brings the skills that tell the agent when a picture beats text:

text
/plugin marketplace add liliang-cn/aigui/plugin install aigui@aigui

Codex:

sh
codex plugin marketplace add liliang-cn/aiguicodex plugin add aigui@aigui

Any MCP client — run aigui-mcp over stdio:

sh
npm install -g @ai-gui/[email protected]claude mcp add aigui -- aigui-mcp

Requires Node.js 18.11+. The first drawing downloads a headless browser (about 100 MB, once); everything runs locally, with no account or API key.

What it draws

21 block types: ECharts charts (3D too), Mermaid, KaTeX, dashboards and data walls, 3D scenes, molecules from SMILES, orbits and collisions, topologies whose steps play, knowledge graphs, geometry, function plots, optics, mechanics, labelled figures, candlesticks, tables and more. Nine of them render straight to PNG; all of them draw in a page.

Tools

ToolWhat it does
aigui_guideLists the blocks, or returns the exact syntax for the ones named — read before writing a block.
aigui_renderDraws the blocks in a markdown string as PNGs, returned to the agent and saved to disk.
aigui_openOpens the whole answer as a live page: charts to hover, 3D to turn, topologies and walls that play.
aigui_editChanges part of a page by find-and-replace, without sending the whole answer again.
aigui_exportSaves a page as PNG, PDF, one self-contained HTML file, or a GIF / WebM of it playing.
aigui_topologyDraws a system from its docker-compose file or Kubernetes manifests.
aigui_feedbackReads the comments the user left on a page's blocks.

Why it can be trusted

  • Numbers come from your files. Pass data: {"sales": "/abs/path/sales.csv"} and write {"$data":"sales","column":"revenue"} in the chart — or pick, sum, count, max, min, avg. The figures are read from the file, never retyped by the model, and the result names the file behind each block.
  • Every drawing is checked. A headless browser looks for labels on top of each other, text cut off or under 9 px, poor contrast and crowded charts, and tells the agent to fix them before you see anything.
  • Topologies from real config. aigui_topology reads what is actually deployed, not what the model remembers.
  • Local. Pictures go to ~/.cache/aigui/images, pages to ~/.cache/aigui/pages, listed newest first in pages/index.html. A page loads nothing from the network.

Custom blocks

Add your own block type in three files — no build step, no fork:

sh
npx @ai-gui/cli plugin new ticket   # writes ~/.config/aigui/plugins/ticket/
FileWhat it is
aigui.jsonName, fences, a one-line description, whether it may render to PNG
plugin.jsA plain browser script registering an AIGuiPlugin: (globalThis.__aiguiPacks ??= {}).ticket = (theme, still) => [...]. Its HTML is sanitized like any plugin's.
spec.mdThe rules the model follows to write the block

It then appears in aigui_guide as [custom] and draws in pages, PNGs and exports. Blocks installed when a session starts are named in the tool descriptions too: in a measured run, agents used a custom block in 9 of 9 sessions with that, against 5 of 9 without. A broken folder is skipped with its reason; a name that collides with a built-in block is refused.

Comments from the page

While the session runs, pages are served on 127.0.0.1 (a port the system picks) with a Comment button: pick a block, say what should change, send. The agent reads it with aigui_feedback and edits the page. Only the pages directory is served.

Configuration

VariableEffect
AIGUI_OUT_DIRWhere pictures and pages go. Default ~/.cache/aigui (XDG_CACHE_HOME honoured).
AIGUI_NO_OPEN=1Write pages without opening them.
AIGUI_OPEN_IMAGES=1Also open aigui_render's PNGs in the image viewer — the plugins set it, since a terminal cannot show images.
AIGUI_PLUGIN_DIRWhere custom blocks live. Default ~/.config/aigui/plugins.
AIGUI_NO_BROWSER_DOWNLOAD=1Skip the headless-browser download; draw with an installed Chrome or Edge.
AIGUI_BROWSER_CHANNELPin a browser: chromium, chrome or msedge.

Programmatic use

ts
import { createServer, callTool, renderToContent, writePage } from "@ai-gui/mcp"

createServer() returns the McpServer unconnected, for a host with its own transport; callTool(name, args) runs one tool directly.

License

MIT © Liang Li

来源:packages/mcp/README.md,提交 b3a8bd7

工具

0
工具元数据尚未被收录。

版本历史

1
  1. v0.48.0最新Oct 4, 2026