holoviz viz mcp
用于数据可视化的最先进的MCP服务器。 赋予任何AI助手创建交互式图表、运行统计测试、执行自动EDA和构建精美仪表板的能力——所有这些都使用HoloViz生态系统。
______________________________________________________________________
为什么存在
大多数AI可视化工具生成静态图像或手动滚动JavaScript。此服务器使用 面板的嵌入模式 使用完整的散景渲染管道(真正的平移/缩放/悬停、链接选择和面板小部件)生成自包含的交互式HTML。不是JavaScript近似值。
pn.pane.HoloViews(plot).save(buf, embed=True)一条线。独立HTML。所有散景JS/CSS内联。没有服务器。没有CDN。在任何浏览器中打开。
功能亮点
| 类别 | 你得到了什么 |
|---|---|
| 36工具 | 数据加载、转换、14种图表类型、注释、交叉过滤、流媒体、仪表板、导出等 |
| 智能分析 | 一键自动EDA、统计测试(t检验、方差分析、回归、卡方)、数据质量评分、自然语言查询 |
| 8个MCP应用程序 | 用于图表、仪表板、流媒体、交叉过滤器、EDA报告、统计数据、时间序列和数据质量的专用UI查看器 |
| 9个工作流提示 | EDA、交叉过滤、统计、时间序列、大数据、比较、讲故事、仪表板和数据质量的指导工作流程 |
| 大数据 | 基于Datashader的10K-5M+点可视化 |
| 时间序列 | 滚动统计、趋势分解、异常检测、多序列比较 |
| 双输出 | 每个viz都返回PNG预览(在线聊天)+交互式HTML(完全散景交互性) |
| 绘图版本控制 | 自由修改,随时撤销——每次更改都会创建一个新版本 |
| 会话持续 | 将整个分析会话保存/加载为JSON |
| 8个样本数据集 | 虹膜、企鹅、小费、股票、钻石、gapminder、天气、地震 |
| 专业模板 | 材料设计、Bootstrap和快速设计仪表板布局 |
______________________________________________________________________
快速开始
复制粘贴这4行以开始:
git clone https://github.com/ghostiee-11/holoviz-viz-mcp.git
cd holoviz-viz-mcp
pip install -e .
claude mcp add holoviz-viz -- holoviz-viz-mcp就是这样——重启你的AI客户端,开始要求可视化。
任何AI客户端的一个命令设置
bash setup.sh claude-desktop # Claude Desktop
bash setup.sh claude-code # Claude Code CLI
bash setup.sh cursor # Cursor
bash setup.sh vscode # VS Code Copilot
bash setup.sh all # All clients at once重新启动AI客户端并尝试:
*加载虹膜数据集并创建萼片长度与萼片宽度的散点图,按物种着色*
*“在钻石数据集上运行auto_eda”*
*“使用t检验测试不同物种之间萼片长度是否存在显著差异”*
看 DEMO_PROMPTS.md 12个即用型演示提示。
手动设置
Claude Desktop
添加 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"holoviz-viz": {
"command": "holoviz-viz-mcp"
}
}
}Claude Code (CLI)
claude mcp add holoviz-viz -- holoviz-viz-mcpCursor
添加 ~/.cursor/mcp.json:
{
"mcpServers": {
"holoviz-viz": {
"command": "holoviz-viz-mcp"
}
}
}VS Code Copilot Chat
添加 .vscode/settings.json:
{
"github.copilot.chat.mcpServers": {
"holoviz-viz": {
"command": "holoviz-viz-mcp"
}
}
}______________________________________________________________________
工具(36)
数据管理(5)
| 工具 | 说明 |
|---|---|
load_data | 从CSV/JSON文本、URL或文件加载。自动从扩展中检测Parquet/Excel/JSON |
load_sample_data | 8个内置数据集:虹膜、企鹅、小费、股票、钻石、gapminder、天气、地震 |
list_datasets | 列出所有加载的带有形状和列的数据集 |
analyze_data | 具有分布、相关性和数据类型的统计概况 |
suggest_visualizations | 根据列特征自动推荐打印类型 |
数据转换(2)
| 工具 | 说明 |
|---|---|
transform_data | 筛选、分组、排序、派生列、采样、删除空值、枢轴 |
merge_datasets | 在共享列(内/左/右/外)上连接两个数据集 |
可视化(5)
| 工具 | 描述 | 输出 |
|---|---|---|
create_plot | 14种图表类型:散点图、折线图、条形图、条形、面积图、台阶图、方框图、小提琴图、历史图、热图、hexbin图、kde图、等高线图、误差条 | PNG+HTML |
modify_plot | 更改标题、颜色、色图、大小、轴标签、图例位置 | PNG+HTML |
undo_plot | 恢复到任何以前的版本 | PNG+HTML |
list_plots | 列出所有带有ID和版本计数的图 | 文本 |
execute_code | 运行任意hvPlot/HoloViews/Panel代码 | PNG+HTML |
高级可视化(6)
| 工具 | 描述 | 输出 |
|---|---|---|
create_crossfilter | 跨视图链接浏览——一次选择,全部更新 | PNG+HTML |
create_streaming_plot | 带有播放/暂停/重置控件的实时更新图表 | PNG+HTML |
annotate_plot | 添加hline/vline/hspan/vspan/text/点/箭头注释 | PNG+HTML |
overlay_plots | 将多个图合成到共享轴上 | PNG+HTML |
create_datashader_plot | 10K-5M+点的大数据可视化 | PNG+HTML |
time_series_analysis | 滚动统计、分解、异常检测、多系列比较 | PNG+HTML |
互动(4)
| 工具 | 说明 |
|---|---|
handle_click | 流程图点击——返回百分位数、异常值状态、组上下文 |
set_theme | 设置全局主题:默认、黑暗、午夜 |
launch_panel | 在浏览器中将任何图表作为完整的面板应用程序打开 |
stop_panel | 停止正在运行的面板服务器 |
仪表板和导出(3)
| 工具 | 描述 | 输出 |
|---|---|---|
create_dashboard | 将列/行/选项卡/网格中的绘图与材质/引导/快速模板 | PNG+HTML组合 |
get_plot_html | 获取用于嵌入的原始交互式HTML | HTML |
export_plot | 导出为HTML、PNG或SVG | 编码 |
智能分析(4)
| 工具 | 描述 | 输出 |
|---|---|---|
auto_eda | 一个完整的EDA调用:分布、相关性、缺失数据、异常值、叙事见解 | PNG+HTML |
statistical_test | T检验、相关性、回归、卡方检验、正态性、方差分析——真实p值+诊断图 | PNG+HTML |
data_quality_report | 缺失值、异常值、类型验证、重复、质量分数(0-100) | PNG+HTML |
compare_datasets | 两个数据集的并排统计比较 | 文本 |
自然语言(1)
| 工具 | 说明 |
|---|---|
natural_language_query | 简明英语->结构化执行计划。“按收入>100万的地区显示销售额”->过滤器+分组+柱状图 |
公用事业(6)
| 工具 | 说明 |
|---|---|
describe_plot | 可访问性和上下文的AI可读图形描述 |
clone_plot | 复制绘图以进行独立修改 |
get_data_sample | 返回AI上下文的格式化数据行 |
save_session | 将数据集+规格图保存为JSON |
load_session | 恢复已保存的会话 |
generate_large_dataset | 生成合成数据(簇/螺旋/网格/均匀,最多500万点) |
______________________________________________________________________
MCP应用程序(8个交互式查看器)
| 资源URI | 查看器 | 主要功能 |
|---|---|---|
ui://holoviz/viz | 图表查看器 | 主题切换、保存、在浏览器中打开 |
ui://holoviz/dashboard | 仪表板查看器 | 带统计侧栏的多面板布局 |
ui://holoviz/stream | 流查看器 | 实时脉冲指示器,状态栏 |
ui://holoviz/crossfilter | Crossfilter查看器 | 链接画笔提示,打开全尺寸 |
ui://holoviz/eda | EDA报告 | 带标签的见解/图表、完成徽章 |
ui://holoviz/statistics | 统计查看器 | P值突出显示(绿色/红色),并排结果+图表 |
ui://holoviz/timeseries | 时间序列查看器 | 指标栏,分析类型徽章 |
ui://holoviz/quality | 质量报告 | 评分表(0-100,颜色编码),问题严重性卡 |
______________________________________________________________________
工作流程提示(9)
AI遵循的预先构建的分步指南:
| 提示 | 目的 |
|---|---|
eda_workflow | 完成勘探数据分析 |
crossfilter_workflow | 构建链接的刷牙仪表板 |
data_quality_workflow | 评估和清理数据质量 |
statistical_analysis_workflow | 严格的假设检验 |
storytelling_workflow | 带注释的数据叙事 |
time_series_workflow | 时间分析和趋势检测 |
big_data_workflow | 大型数据集的Datashader可视化 |
comparison_workflow | 比较组或数据集 |
dashboard_design_workflow | 抛光、可演示的仪表板 |
______________________________________________________________________
建筑
AI Assistant (Claude / Copilot / Cursor / any MCP client)
|
v MCP Protocol (JSON-RPC 2.0 over stdio)
+------------------------------------------------------------------+
| holoviz-viz-mcp Server (FastMCP 3.1) |
| |
| Data Layer (7 tools) Viz Layer (11 tools) |
| load_data, analyze_data create_plot (14 chart types) |
| suggest_visualizations crossfilter, streaming, datashader |
| transform_data, merge annotate, overlay, time_series |
| |
| Intelligence Layer (5 tools) Utility Layer (6 tools) |
| auto_eda describe_plot, clone_plot |
| statistical_test get_data_sample |
| data_quality_report save/load_session |
| natural_language_query generate_large_dataset |
| |
| Rendering Pipeline State Manager |
| hvPlot -> HoloViews Versioned plots with undo |
| -> Panel embed=True Dataset storage |
| Output: PNG + HTML Session persistence |
| |
| 8 MCP Apps | 9 Prompts | 3 Dashboard Templates |
+------------------------------------------------------------------+______________________________________________________________________
输出是如何工作的
每个可视化工具返回 三个项目 在单个MCP响应中:
- 文本内容 --绘图ID和描述
- 图片内容 --PNG预览(在聊天中内联渲染)
- 嵌入式资源 --交互式HTML位于
viz://plots/{id}(独立的Bokeh文件)
这种双输出模式意味着AI在提供完整交互式版本的同时显示快速预览。
______________________________________________________________________
例子
Auto EDA(一次调用,完整分析)
> "Run auto_eda on the diamonds dataset"
Returns: 6+ charts (distributions, correlations, categories, scatter),
narrative insights (skewness, outliers, strongest correlations),
all in a single tool call.真实p值的统计检验
> "Test if sepal_length differs between iris species"
Returns: t-statistic, p-value, Cohen's d effect size,
box plot comparing groups, significance assessment.交叉过滤器(连接刷)
# Behind the scenes:
from holoviews.selection import link_selections
linked = link_selections(hv.Layout([scatter, hist, box]))
# Brush in scatter -> histogram and box plot filter in real time时间序列分解
> "Decompose the weather temperature into trend, seasonal, and residual"
Returns: 4-panel decomposition plot + trend stats + seasonal amplitude.自然语言查询
> natural_language_query("iris", "compare sepal_length by species")
Returns structured plan:
Step 1: transform_data('iris', 'groupby', group_by='species', agg='mean')
Step 2: create_plot('iris_grouped', 'bar', x='species', y='sepal_length')______________________________________________________________________
演示
python demos/quick_demo.py # Full feature tour
python demos/showcase_stock_analysis.py # Stock prices + annotations + dashboard
python demos/showcase_ml_evaluator.py # Feature importance + confusion matrix + crossfilter______________________________________________________________________
测试
pytest tests/ -v
# 148 tests across 16 test files covering:
# state, data, viz, transforms, crossfilter, streaming, annotations,
# export, interaction, auto-EDA, statistics, data quality, NLQ,
# big data, time series, utilities, server integration______________________________________________________________________
项目结构
src/holoviz_viz_mcp/
server.py # FastMCP entry: 36 tools, 8 resources, 9 prompts
state.py # Dataset + plot state with versioning/undo
rendering.py # HoloViews -> PNG/HTML via Panel embed (+ Material/Bootstrap/Fast templates)
tools/
data.py # load, analyze, suggest, list, sample (8 datasets)
transform.py # filter, groupby, pivot, derive, merge
viz.py # create, modify, undo, list, execute_code
crossfilter.py # linked selections via hv.link_selections
streaming.py # live-updating charts with BokehJS streaming
annotations.py # hline, vline, spans, text, points, arrows, overlays
dashboard.py # layout composition with template support
export.py # HTML/PNG/SVG export
interact.py # handle_click, set_theme, launch/stop_panel
auto_eda.py # one-call complete exploratory analysis
statistics.py # t-test, correlation, regression, chi2, normality, ANOVA
data_quality.py # quality report + dataset comparison
nlq.py # natural language query interpretation
bigdata.py # datashader + synthetic data generation
timeseries.py # rolling stats, decomposition, anomaly detection
utils.py # describe, clone, sample, session management
apps/
viz.html # Chart viewer with toolbar
dashboard.html # Dashboard viewer with stats
stream.html # Streaming viewer with pulse indicator
crossfilter.html # Crossfilter viewer with brush hints
eda.html # EDA report with tabbed insights
statistics.html # Statistics viewer with p-value highlights
timeseries.html # Time series viewer with metrics
quality.html # Quality report with score gauge
tests/ # 148 tests across 16 files
demos/ # 3 showcase scripts______________________________________________________________________
技术说明
- 面板嵌入与原始BokehJS:大多数MCP即工具使用
bokeh.embed.json_item()用于静态散景。专家组embed=True将小部件状态、链接选择和布局逻辑捕获到独立的HTML中。这就是交叉过滤在没有服务器的情况下工作的原因。
- 为什么选择hvPlot:一致
.hvplot()API跨越熊猫、xarray、dask和地理标准。一个API,多个后端。
- 国家管理:绘图是版本化的。每
modify_plot创建新版本;undo_plot恢复。AI可以自由迭代,而不会丢失以前的工作。
- 统计严谨性:使用scipy.stats进行真实假设检验——实际p值、效应大小、置信区间。不是近似值。
- 代码执行:
execute_code是逃逸舱口——在沙盒命名空间中运行任意HoloViews/Panel代码,其中包含pd、np、hv、pn和所有加载的数据集。
- 仪表板模板:
create_dashboard支持template_style='material'(材料设计),'bootstrap'(Bootstrap),以及'fast'(快速设计)抛光,专业输出。
______________________________________________________________________
依赖项
核心: fastmcp, holoviews, hvplot, panel, bokeh, pandas, numpy, scipy
可选: openpyxl (Excel), pyarrow (拼花地板), scikit-learn (样本数据)
许可证
麻省理工学院
