Back to MCP directory
publicPublicdnsLocal runtime

mcp-vegalite-server

一个基于MCP协议的数据可视化服务,支持Vega-Lite语法图表生成

article

README

🚀 模型上下文协议(MCP)服务器

本项目是一个模型上下文协议(MCP)服务器的实现,为大型语言模型提供接口,使其能够运用Vega - Lite语法对数据进行可视化,极大地增强了数据展示的灵活性和直观性。

🚀 快速开始

使用Claude Desktop

你可以按照以下示例代码将服务器添加到你的claude_desktop_config.json中:

# 将服务器添加到你的claude_desktop_config.json
{
  "mcpServers": {
    "datavis": {
        "command": "uv",
        "args": [
            "--directory",
            "/absolute/path/to/mcp-datavis-server",
            "run",
            "mcp_server_datavis",
            "--output_type",
            "png" # 或 "text"
        ]
    }
  }
}

✨ 主要特性

该服务器提供了两个核心工具,为数据的保存和可视化提供了便利:

save_data

  • 功能:将一张包含聚合数据的数据表保存到服务器,方便后续进行可视化操作。
  • 输入参数
    • name (字符串):数据表格的名称,用于标识该数据表。
    • data (数组):表示数据表格的对象数组,包含具体的数据内容。
  • 返回结果:操作成功后返回成功消息。

visualize_data

  • 功能:使用Vega - Lite语法对已保存的数据进行可视化。
  • 输入参数
    • data_name (字符串):要可视化的数据表格的名称,指定需要进行可视化操作的数据表。
    • vegalite_specification (字符串):表示Vega - Lite规范的JSON字符串,定义了可视化的具体样式和规则。
  • 返回结果
    • --output_type设为text,则返回一条包含额外artifact键的成功消息,其中包含完整的带数据的Vega - Lite规范。
    • --output_type设为png,则返回一个使用MPC ImageContent容器的base64编码的PNG图像。
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client