mcp-chart-forge

mcp-chart-forge

A professional chart generation MCP server for Claude Code. Drop a charts-theme.json into any project and Claude can generate beautiful, on-brand charts output as slide-ready PNG and SVG files — fully local, no API keys required.

Category
访问服务器

README

mcp-chart-forge

A professional chart generation MCP server for Claude Code. Drop a charts-theme.json into any project and Claude can generate beautiful, on-brand charts output as slide-ready PNG and SVG files — fully local, no API keys required.

How it works

  1. You add mcp-chart-forge to your Claude Code MCP config (once)
  2. You drop a charts-theme.json into your project root (optional — ships with sensible defaults)
  3. Claude generates charts via natural language: "Make a bar chart of Q1 revenue by region"
  4. PNG + SVG files land in ./charts/ (or wherever your theme configures)

The server uses Vega-Lite for chart specs and sharp for server-side PNG rendering — no browser, no Electron, no API keys.


Installation

1. Install dependencies and build

git clone https://github.com/you/mcp-chart-forge.git
cd mcp-chart-forge
npm install
npm run build

2. Add to Claude Code

claude mcp add --transport stdio chart-forge -- node /absolute/path/to/mcp-chart-forge/dist/index.js

Replace /absolute/path/to/mcp-chart-forge with the actual path on your machine.

Or add manually to ~/.claude/claude_desktop_config.json:

{
  "mcpServers": {
    "chart-forge": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-chart-forge/dist/index.js"]
    }
  }
}

3. Set up your theme (optional)

cp /path/to/mcp-chart-forge/charts-theme.example.json ./charts-theme.json
# Edit charts-theme.json to match your brand colors, fonts, and output size

chart-forge walks up the directory tree from wherever Claude Code is running, so placing charts-theme.json at your project root (or monorepo root) is all you need.


Available tools

Tool Description
generate_bar_chart Bar chart (vertical or horizontal, optionally grouped/stacked)
generate_line_chart Line chart with optional multiple series, smoothing
generate_area_chart Area chart with optional stacking
generate_donut_chart Donut/ring chart
generate_scatter_chart Scatter plot with optional bubble size, labels, and trendline

Common parameters (all tools)

Parameter Type Description
data object[] Array of data objects
xField string Field name for X axis
yField string Field name for Y axis
title string Chart title
subtitle string? Optional subtitle
colorField string? Field for color grouping
outputName string? Filename stem (defaults to slugified-title-{timestamp})
format "png" | "svg" | "both" Output format (default: "both")

Tool-specific parameters

generate_bar_chart

  • horizontal: boolean — render as horizontal bars (default: false)

generate_line_chart

  • xType: "temporal" | "ordinal" | "quantitative" — X axis field type (default: "ordinal")
  • smooth: boolean — apply monotone curve smoothing (default: false)

generate_area_chart

  • xType: same as line chart
  • stacked: boolean — stack series instead of overlapping (default: false)

generate_donut_chart

  • innerRadiusRatio: number 0.1–0.9 — hole size as fraction of outer radius (default: 0.55)

generate_scatter_chart

  • sizeField: string? — field for bubble size (creates a bubble chart)
  • labelField: string? — field for point labels
  • showTrendline: boolean — overlay a linear regression line (default: false)

Theme file reference

// charts-theme.json
{
  // Brand colors — used as the categorical color range for all charts
  "palette": ["#1B4F8A", "#E8A020", "#4CAF8A", "#C94040", "#7B5EA7"],

  "background": "#FFFFFF",
  "fontFamily": "sans-serif",

  "fontSize": {
    "title":      20,   // Chart title
    "subtitle":   14,   // Chart subtitle
    "axis":       12,   // Axis labels and titles
    "legend":     12,   // Legend labels
    "annotation": 11    // In-chart labels
  },

  "fontWeight": {
    "title":    "bold",
    "subtitle": "normal"
  },

  "textColor":  "#1A1A1A",   // All text
  "axisColor":  "#CCCCCC",   // Axis lines and ticks
  "gridColor":  "#F0F0F0",   // Grid lines

  "padding": { "top": 48, "right": 40, "bottom": 56, "left": 64 },

  "outputSize": {
    "width":  1920,   // Output PNG width in pixels
    "height": 1080,   // Output PNG height in pixels
    "scale":  1       // Use 2 for @2x / HiDPI
  },

  "outputDir": "./charts",   // Relative to project root (process.cwd())

  "logoPath": null            // Reserved for future logo overlay support
}

Example prompts for Claude

Generate a bar chart of monthly revenue.
Data: Jan $42k, Feb $38k, Mar $51k, Apr $49k, May $63k

Make a line chart comparing website traffic vs conversions over the last 6 months.
Use "month" for X, "visitors" and "conversions" as separate series via colorField.

Create a donut chart showing market share:
Company A 38%, Company B 27%, Company C 19%, Others 16%

Generate a scatter plot of marketing spend vs revenue, with company name labels,
and show a trendline.

Troubleshooting

Could not load the "sharp" module on Windows

Sharp ships prebuilt binaries per-platform. If you see this error, force the Windows x64 binary:

npm install --os=win32 --cpu=x64 sharp

Then rebuild: npm run build.

Could not load the "sharp" module on macOS (Apple Silicon)

npm install --os=darwin --cpu=arm64 sharp

Development

npm run dev      # Run via ts-node (no build step)
npm run build    # Compile TypeScript → dist/
npm start        # Run compiled output

Tech stack

  • Vega-Lite — declarative chart spec compiler
  • Vega — rendering engine (view.toSVG() — no canvas/browser needed)
  • sharp — SVG → PNG via libvips (prebuilt binaries, no native compilation)
  • @modelcontextprotocol/sdk — MCP server + tool registration
  • Zod — tool input validation

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选