难民署图表生成MCP服务器
smithery.ai中的MCP(模型上下文协议)服务器提供了使用FastAPI图表生成服务生成UNHCR图表的工具。它允许人工智能代理使用难民署的数据可视化创建各种类型的图表(条形图、折线图、饼图等)。
此服务器与 难民署图表生成API.
特性
- 使用难民署的数据生成各种类型的图表(条形图、折线图、饼图、散点图)
- 为难民数据创建人口趋势图
- 使用多个数据集生成比较图
- 自定义图表标题、标签和样式
- 以base64编码的图像返回图表,便于集成
连接到MCP服务器
要访问服务器,请打开web浏览器并访问以下URL: https://smithery.ai/server/@rvibek/mcp_unhcrpyplot
根据需要配置MCP主机/客户端。
](https://smithery.ai/server/@rvibek/mcp_unhcrpyplot)
API端点
服务器使用以下API终结点生成图表:
https://unhcrpyplot.rvibek.com.np/plot
API接受具有以下结构的JSON有效载荷:
{
"chart_type": "string",
"title": "string",
"subtitle": "string",
"x_label": "string",
"y_label": "string",
"data": {
"labels": ["string"],
"values": [number]
}
}MCP工具
服务器公开了以下工具:
generate_unhcr_graph
使用FastAPI图表生成服务生成难民署图表。
参数:
chart_type(必填):要生成的图表类型(条形图、折线图、饼图、散点图等)title(必填):图表的主标题subtitle(必填):描述图表内容的副标题x_label(必填):x轴标签y_label(必填):y轴标签labels(必填):数据点标签列表(如年份、国家)values(必填):标签对应的数值列表
退货:
- 包含base64格式的图表图像和元数据的字典
generate_comparison_chart
生成包含多个数据集的比较图。
参数:
chart_type(必填):图表类型(条形图、折线图等)title(必填):图表的主标题subtitle(必填):描述图表内容的副标题x_label(必填):x轴标签y_label(必填):y轴标签datasets(必填):数据集列表,每个数据集包含“标签”、“标签”和“值”
退货:
- 包含base64格式的图表图像和元数据的字典
generate_population_trend_chart
为难民署的数据生成人口趋势图。
参数:
years(必填):x轴年份列表population_counts(必填):每年人口统计清单country_name(可选):正在可视化的国家或地区的名称(默认值:“国家”)chart_type(可选):图表类型(直线、条形等)(默认:“直线”)
退货:
- 包含base64格式的图表图像和元数据的字典
示例用法
下面是一个如何使用 generate_unhcr_graph 工具:
# Generate a bar chart showing refugee population trends
result = generate_unhcr_graph(
chart_type="bar",
title="Nepali Refugees and Asylum Seekers in Canada (2020-2021)",
subtitle="UNHCR Population Data",
x_label="Year",
y_label="Number of People",
labels=["2020", "2021"],
values=[205, 114]
)响应格式
成功生成图表返回:
{
"status": "success",
"chart_type": "bar",
"title": "Chart Title",
"image_base64": "base64_encoded_image_string",
"image_format": "png",
"message": "Successfully generated bar chart: Chart Title"
}许可证
麻省理工学院
致谢
该项目使用 难民署图表生成API 创建难民署数据的可视化。
