Microcharts

io.github.ganapativs由 GitHub 账号 ganapativs 发布v0.1.17更新于 Oct 24, 2026

Find, wire, and render microcharts — word-sized React charts with generated alt text.

已验证STDIO仅桌面开发者工具媒体与设计

概览

AI 生成的概览

一个本地 MCP 服务器,让助手找到合适的微型图表、获取接入方式,并渲染成自带替代文本的独立 SVG。

可以做什么
查找图表:按自然语言问题(可选按数据形状)对微型图表目录排序,返回匹配的图表标识和理由。获取接入信息:给出所选图表的导入路径、属性、数据形状、适用与避免建议、可运行示例和可直接渲染的样例。渲染图表:输出完整的独立 SVG 及生成的摘要和替代文本,支持内嵌样式或裸格式。读取资源:包含全部图表及元数据的目录,以及把微型图表接入代码库的提示词。同样三项能力也以 Vercel AI SDK 工具和普通函数形式导出。
适用场景
适合需要助手在聊天或代码库中内嵌小型词级图表(如迷你趋势线、子弹图、点图或 OHLC 图)的场景,并希望得到真正渲染的 SVG 和可访问的替代文本,而不是客户端可能无法渲染的图表标记。
运行要求
通过 npx 从 npm 包 @microcharts/mcp 以 stdio 在本地运行,需要 Node.js 和 npx。无需账号、API 密钥、环境变量或请求头,也没有托管服务。
安装前请注意
该服务器只读取自带的图表目录并渲染 SVG;README 称数据不会离开本机。数据形状错误或负载过大会被拒绝。安装会从 npm 拉取该包及其内置图表库,需注意常规的供应链风险。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

@microcharts/mcp

[microcharts MCP server]

An MCP server and Vercel AI-SDK toolset for microcharts — let a model find the right word-sized chart, get exactly how to wire it, and render it to a finished SVG with real alt text.

microcharts is built so a model can write charts. This is how a model calls them: not "emit some grammar and hope the client renders it," but a tool call that returns the real library's static SVG, honest by construction, with the generated describeSeries accessible name attached.

  • Runs on your machine. stdio server, distributed on npm. Nothing is hosted; no account, no key, no data leaves.
  • Works anywhere. The render tool returns self-contained SVG, so a chat surface that can't run React can still show a real chart.
  • Zero setup. npx @microcharts/mcp — the package brings its own copy of @microcharts/react.

Install

Add it to any MCP client. For Claude Desktop (claude_desktop_config.json) or Cursor (.cursor/mcp.json):

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

That's it — the client spawns the server over stdio on demand.

Tools

find_microchart(question, dataShape?)

Rank the catalog against a plain-language question. Start here when you know the question, not the chart.

find_microchart({ question: "is it trending?" })→ [{ slug: "sparkline", name: "Sparkline", why: "inline trend", dataShape: "number[]" }, …]

get_microchart(slug)

Everything needed to wire one chart: import paths, its props plus the shared props, data shape, best/avoid guidance, a copy-runnable example, and sample — that same example as JSON props, ready to pass straight to render_microchart.

get_microchart({ slug: "bullet" })→ {    staticImport: "@microcharts/react/bullet",    props: [...],    example: { code: "<Bullet value={72} target={80} bands={[50, 90]} title=\"Quota\" />" },    sample: { value: 72, target: 80, bands: [50, 90], title: "Quota" },    …  }

Every chart takes its own data shape — number[] for a sparkline, { label, value }[] for a dot plot, { open, high, low, close }[] for OHLC — so sample is the shortest path from "which chart" to "a render that works".

render_microchart(type, data?, props?, format?)

Render to a finished, self-contained SVG plus its generated alt text. Pass the series as data; put other props (value, target, curve, color, width) in props.

render_microchart({ type: "sparkline", data: [132, 148, 141, 165, 159, 182] })→ {    svg: "<svg …><style>…</style>…</svg>",    summary: "Trending up 38%. Range 132 to 182. Last value 182.",    mimeType: "image/svg+xml", width: 80, height: 20  }

format is "svg" (default, styles embedded — drops into any surface) or "bare" (no CSS, for pages that already load @microcharts/react/styles.css).

Missing or wrong-shaped data is rejected by name rather than passed through to React, so a caller gets "dot-plot" needs \data`. Data shape: { label, value }[]. Call get_microchart("dot-plot") for a ready-to-render sample.` instead of a stack trace. Oversized payloads are refused too — a microchart is a word-sized mark.

It also exposes two resources: microcharts://catalog (every chart + metadata) and microcharts://agent-setup (the prompt for wiring microcharts into a codebase).

Use it from the Vercel AI SDK

The same three capabilities ship as AI-SDK tools (on the /ai-sdk subpath, so the core never pulls in ai):

ts
import { microchartsTools } from "@microcharts/mcp/ai-sdk";import { streamText } from "ai";
const result = streamText({  model,  tools: microchartsTools,  prompt: "Summarise this quarter and show the revenue trend as a chart.",});

The functions are exported directly too — findChart, getChart, renderChart — if you want them without the tool wrapper.

Versioning

This server bundles the chart catalog and renders with @microcharts/react (installed as a normal dependency). Its version tracks its own changes; a compatible library is pulled in automatically. The library version a given snapshot was cut from is on the microcharts://catalog resource.

Links

MIT

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

工具

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

版本历史

1
  1. v0.1.17最新Sep 16, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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