Skip to main content
Glama
ai-mcp-chart-vis

ai-mcp-chart-vis

by yanbober

ai-mcp-chart-vis

开箱即用的 MCP 图表服务,支持 26+ 种图表类型。 自动启动私有渲染服务,无需手动操作任何进程。

兼容 Cursor、Claude Desktop、VS Code + Cline 等任意支持 MCP 的 AI 客户端。


快速安装

Cursor

打开 Cursor Settings → MCP,添加以下配置:

{
  "ai-mcp-chart-vis": {
    "command": "npx",
    "args": ["-y", "github:yanbober/ai-mcp-chart-vis"]
  }
}

Claude Desktop

编辑配置文件:

  • Windows:%APPDATA%\Claude\claude_desktop_config.json

  • macOS:~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "ai-mcp-chart-vis": {
      "command": "npx",
      "args": ["-y", "github:yanbober/ai-mcp-chart-vis"]
    }
  }
}

VS Code + Cline

在 VS Code 设置(Ctrl+,)中搜索 cline.mcp,编辑 settings.json:

{
  "cline.mcp.mcpServers": {
    "ai-mcp-chart-vis": {
      "command": "npx",
      "args": ["-y", "github:yanbober/ai-mcp-chart-vis"]
    }
  }
}

配置完成即可使用,无需 clone 代码、无需 npm install、无需配置环境变量。


Related MCP server: Generative-UI-MCP

图片存储位置

每次 AI 生成图表时,PNG 文件会保存在本地。

默认路径:

系统

路径

Windows

C:\Users\你的用户名\.ai-mcp-chart-vis\output\

macOS / Linux

~/.ai-mcp-chart-vis/output/

图片文件名格式:chart-<时间戳>.png,例如 chart-1772787477665.png


环境变量配置

所有配置均通过 MCP 配置中的 "env" 字段设置,无需创建任何配置文件。

变量

说明

默认值

VIS_PORT

渲染服务端口

8888

VIS_OUTPUT_DIR

图片保存目录

~/.ai-mcp-chart-vis/output

VIS_CLEANUP

会话结束后自动删除本次图片

false

VIS_REQUEST_SERVER

渲染 API 完整地址(一般无需设置)

由 VIS_PORT 自动推导

示例:自定义所有配置项

{
  "ai-mcp-chart-vis": {
    "command": "npx",
    "args": ["-y", "github:yanbober/ai-mcp-chart-vis"],
    "env": {
      "VIS_PORT":       "8889",
      "VIS_OUTPUT_DIR": "D:/我的图表",
      "VIS_CLEANUP":    "true"
    }
  }
}

端口冲突处理

渲染服务默认占用端口 8888。

端口被占用时,通过 VIS_PORT 换用其他端口:

{
  "ai-mcp-chart-vis": {
    "command": "npx",
    "args": ["-y", "github:yanbober/ai-mcp-chart-vis"],
    "env": { "VIS_PORT": "8889" }
  }
}

同时打开多个 Cursor 窗口? 无冲突——第二个窗口检测到端口已有服务运行,直接复用,不会重复启动。


工作原理

AI 客户端(Cursor / Claude Desktop)
    │  stdio — MCP 协议
    ▼
start-mcp.js                         ← 本包入口
    ├── 启动 vis-server.js            ← 私有渲染服务(:8888)
    │       └── @antv/gpt-vis-ssr    ← 将图表规格渲染为 PNG
    │               └── 图片保存到 VIS_OUTPUT_DIR
    └── 启动 @antv/mcp-server-chart(stdio 模式)
            └── 向 AI 暴露 26 个图表工具

会话结束时:
    ├── VIS_CLEANUP=true → 删除本次会话产生的所有图片
    └── 自动关闭渲染服务
  • 首次调用:约 5–15 秒冷启动(下载依赖 + 渲染器初始化)

  • 后续调用:即时响应(进程在会话期间保持运行)

  • 会话结束:两个进程自动清理,无残留


支持的图表类型(26 种)

类别

图表

趋势

折线图、面积图、双轴图

对比

柱状图、条形图、直方图

占比

饼图、矩形树图

分布

散点图、箱线图、小提琴图

流向

桑基图、漏斗图、网络关系图

地理

地区分布图、标记地图、路径地图(仅中国区域)

层级

组织架构图、思维导图

专项

雷达图、水位图、词云、鱼骨图、流程图、韦恩图、表格


系统要求

环境

要求

Node.js

>= 18.0.0

Windows

✅ 开箱即用

macOS

✅ 开箱即用

Linux

需安装 canvas 原生依赖:sudo apt-get install libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev


版本锁定

使用指定版本(推荐生产环境):

"args": ["-y", "github:yanbober/ai-mcp-chart-vis#v1.0.0"]

强制更新到最新版本:

npx --force github:yanbober/ai-mcp-chart-vis --version

本地开发

git clone https://github.com/yanbober/ai-mcp-chart-vis.git
cd ai-mcp-chart-vis
npm install

# 仅启动渲染服务
npm run vis:start

# 启动完整链路(渲染服务 + MCP stdio)
npm start

使用 sample

Cursor 中丢入一个 excel 等文件,chat 输入类似如下内容:

洞察一下这个用户反馈 xlsx,分端帮忙通过你认为最合适的图表呈现下,同时将洞察结果图文生成 md 格式报告,要简单明了,不要长篇大论。
注意:生成的 md 中图表等图片直接同 md 文件一起放到当前项目的 result 目录,md 文件中引用图片使用本地引用。

打开产物 md 文件预览图文并茂效果。

其他使用场景和配合其他工具整合自行探索~

致谢

本项目站在以下优秀开源项目的肩膀上构建,向原作者们致敬 🙏

项目

说明

@antv/gpt-vis-ssr

图表服务端渲染核心,将图表规格转换为 PNG 图片

@antv/mcp-server-chart

MCP 图表工具集,向 AI 暴露 26+ 种图表生成能力

如果你有更多定制需求,欢迎基于上述原项目二次开发,各显神通! 原项目均遵循 MIT 协议,欢迎 Star、Fork、PR 🚀


许可证

MIT

Available Tools

27 tools
generate_area_chartB
Read-only

Generate a area chart to show data trends under continuous independent variables and observe the overall data trend, such as, displacement = velocity (average or instantaneous) × time: s = v × t. If the x-axis is time (t) and the y-axis is velocity (v) at each moment, an area chart allows you to observe the trend of velocity over time and infer the distance traveled by the area's size.

Inputs: data (required), stack, style, theme, +5 more.

generate_bar_chartB
Read-only

Generate a horizontal bar chart to show data for numerical comparisons among different categories, such as, comparing categorical data and for horizontal comparisons.

Inputs: data (required), group, stack, style, +6 more.

generate_boxplot_chartB
Read-only

Generate a boxplot chart to show data for statistical summaries among different categories, such as, comparing the distribution of data points across categories.

Inputs: data (required), style, theme, title, +4 more.

generate_column_chartC
Read-only

Generate a column chart, which are best for comparing categorical data, such as, when values are close, column charts are preferable because our eyes are better at judging height than other visual elements like area or angles.

Inputs: data (required), group, stack, style, +6 more.

generate_district_mapA
Read-only

Generates regional distribution maps, which are usually used to show the administrative divisions and coverage of a dataset. It is not suitable for showing the distribution of specific locations, such as urban administrative divisions, GDP distribution maps of provinces and cities across the country, etc. This tool is limited to generating data maps within China.

Inputs: data (required), title (required), width, height.

generate_dual_axes_chartB
Read-only

Generate a dual axes chart which is a combination chart that integrates two different chart types, typically combining a bar chart with a line chart to display both the trend and comparison of data, such as, the trend of sales and profit over time.

Inputs: series (required), categories (required), style, theme, +4 more.

generate_fishbone_diagramA
Read-only

Generate a fishbone diagram chart to uses a fish skeleton, like structure to display the causes or effects of a core problem, with the problem as the fish head and the causes/effects as the fish bones. It suits problems that can be split into multiple related factors.

Inputs: data (required), style, theme, width, +1 more.

generate_flow_diagramB
Read-only

Generate a flow diagram chart to show the steps and decision points of a process or system, such as, scenarios requiring linear process presentation.

Inputs: data (required), style, theme, width, +1 more.

generate_funnel_chartA
Read-only

Generate a funnel chart to visualize the progressive reduction of data as it passes through stages, such as, the conversion rates of users from visiting a website to completing a purchase.

Inputs: data (required), style, theme, title, +2 more.

generate_histogram_chartB
Read-only

Generate a histogram chart to show the frequency of data points within a certain range. It can observe data distribution, such as, normal and skewed distributions, and identify data concentration areas and extreme points.

Inputs: data (required), style, theme, title, +5 more.

generate_line_chartB
Read-only

Generate a line chart to show trends over time, such as, the ratio of Apple computer sales to Apple's profits changed from 2000 to 2016.

Inputs: data (required), style, theme, title, +4 more.

generate_liquid_chartA
Read-only

Generate a liquid chart to visualize a single value as a percentage, such as, the current occupancy rate of a reservoir or the completion percentage of a project.

Inputs: percent (required), shape, style, theme, +3 more.

generate_mind_mapB
Read-only

Generate a mind map chart to organizes and presents information in a hierarchical structure with branches radiating from a central topic, such as, a diagram showing the relationship between a main topic and its subtopics.

Inputs: data (required), style, theme, width, +1 more.

generate_network_graphB
Read-only

Generate a network graph chart to show relationships (edges) between entities (nodes), such as, relationships between people in social networks.

Inputs: data (required), style, theme, width, +1 more.

generate_organization_chartB
Read-only

Generate an organization chart to visualize the hierarchical structure of an organization, such as, a diagram showing the relationship between a CEO and their direct reports.

Inputs: data (required), style, theme, width, +2 more.

generate_path_mapB
Read-only

Generate a route map to display the user's planned route, such as travel guide routes.

Inputs: data (required), title (required), width, height.

generate_pie_chartB
Read-only

Generate a pie chart to show the proportion of parts, such as, market share and budget allocation.

Inputs: data (required), style, theme, title, +3 more.

generate_pin_mapB
Read-only

Generate a point map to display the location and distribution of point data on the map, such as the location distribution of attractions, hospitals, supermarkets, etc.

Inputs: data (required), title (required), width, height, +1 more.

generate_radar_chartB
Read-only

Generate a radar chart to display multidimensional data (four dimensions or more), such as, evaluate Huawei and Apple phones in terms of five dimensions: ease of use, functionality, camera, benchmark scores, and battery life.

Inputs: data (required), style, theme, title, +2 more.

generate_sankey_chartB
Read-only

Generate a sankey chart to visualize the flow of data between different stages or categories, such as, the user journey from landing on a page to completing a purchase.

Inputs: data (required), style, theme, title, +3 more.

generate_scatter_chartB
Read-only

Generate a scatter chart to show the relationship between two variables, helps discover their relationship or trends, such as, the strength of correlation, data distribution patterns.

Inputs: data (required), style, theme, title, +4 more.

generate_spreadsheetA
Read-only

Generate a spreadsheet or pivot table for displaying tabular data. When 'rows' or 'values' fields are provided, it renders as a pivot table (cross-tabulation); otherwise, it renders as a regular table. Useful for displaying structured data, comparing values across categories, and creating data summaries.

Inputs: data (required), rows, theme, width, +3 more.

generate_treemap_chartB
Read-only

Generate a treemap chart to display hierarchical data and can intuitively show comparisons between items at the same level, such as, show disk space usage with treemap.

Inputs: data (required), style, theme, title, +2 more.

generate_venn_chartB
Read-only

Generate a Venn diagram to visualize the relationships between different sets, showing how they intersect and overlap, such as the commonalities and differences between various groups.

Inputs: data (required), style, theme, title, +2 more.

generate_violin_chartB
Read-only

Generate a violin chart to show data for statistical summaries among different categories, such as, comparing the distribution of data points across categories.

Inputs: data (required), style, theme, title, +4 more.

generate_waterfall_chartA
Read-only

Generate a waterfall chart to visualize the cumulative effect of sequentially introduced positive or negative values, such as showing how an initial value is affected by a series of intermediate positive or negative values leading to a final result. Waterfall charts are ideal for financial analysis, budget tracking, profit and loss statements, and understanding the composition of changes over time or categories.

Inputs: data (required), style, theme, title, +4 more.

generate_word_cloud_chartB
Read-only

Generate a word cloud chart to show word frequency or weight through text size variation, such as, analyzing common words in social media, reviews, or feedback.

Inputs: data (required), style, theme, title, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 27 tools

    Disambiguation4/5

    Each tool maps to a distinct chart type with clear descriptions, but several pairs (bar vs column, boxplot vs violin, area vs line, flow vs sankey) have overlapping purposes that could lead to misselection without careful reading. Still, overall the boundaries are largely clear.

    Naming Consistency5/5

    All tools follow the generate_<visualization> pattern, with consistent verb_noun structure; suffix variations (_chart, _map, _diagram, _graph, _spreadsheet) are meaningful and predictable.

    Tool Count2/5

    27 tools exceed the 25+ threshold for 'too many'; while each chart type is valid, the large surface may overwhelm agents choosing among near-synonymous options.

    Completeness4/5

    The set covers a wide range of standard chart and diagram types, but notable gaps like heatmap, bubble chart, and gauge chart exist; agents can partially work around these with existing tools, but not perfectly.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      A MCP server for data visualization. It exposes tools to render charts (line, bar, pie, scatter, heatmap, etc.) from data and returns plots as either image/text/mermaid diagram.
      2
      4
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables AI agents to render branded charts as inline images and persistent hosted URLs, supporting explicit chart types and automatic chart suggestion from data.
      2
      63 npm
      MIT