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 分