Vegalite图表生成服务

一个基于Vegalite和vl-convert的MCP服务器,用于通过LLM生成和渲染Vegalite图表。

  • by unravel-team
  • Makefile
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 unravel-team/mcp-vegalite-server

使用说明

tech.unravel/mcp-legalite服务器

用于使用Vegalite的MCP服务器,使用 vl-convert.

我们创建了两个简单的工具:

  • 保存数据
  • 可视化数据

使用这些,主机可以通过以下方式创建漂亮的纯素素图形:

  • 计算所需数据并保存,
  • 然后使用LLM生成vegalite规范
  • 然后使用数据渲染规范,并访问 vl-convert

用法

建造罐子

$ make clean && make build

运行MCP服务器

先决条件:需求 vl转换CLI 待安装。

您可以在Claude Desktop或Inspector中尝试一些示例命令:

以下是一些示例数据:

[
    { "year": 2011, "value": 14.6, "growth_type": "Market Cap Growth" },
    { "year": 2011, "value": 11.4, "growth_type": "Revenue Growth" },
    { "year": 2011, "value": 26.6, "growth_type": "Net Income Growth" },
    { "year": 2012, "value": 40.1, "growth_type": "Market Cap Growth" },
    { "year": 2012, "value": 42.7, "growth_type": "Revenue Growth" },
    { "year": 2012, "value": 36.9, "growth_type": "Net Income Growth" },
    { "year": 2013, "value": 16.9, "growth_type": "Market Cap Growth" },
    { "year": 2013, "value": 14.6, "growth_type": "Revenue Growth" },
    { "year": 2013, "value": 15.3, "growth_type": "Net Income Growth" },
    { "year": 2014, "value": 9.6, "growth_type": "Market Cap Growth" },
    { "year": 2014, "value": 7.9, "growth_type": "Revenue Growth" },
    { "year": 2014, "value": 10.9, "growth_type": "Net Income Growth" },
    { "year": 2015, "value": 5.8, "growth_type": "Market Cap Growth" },
    { "year": 2015, "value": 6.7, "growth_type": "Revenue Growth" },
    { "year": 2015, "value": 6.2, "growth_type": "Net Income Growth" },
    { "year": 2016, "value": -12.4, "growth_type": "Market Cap Growth" },
    { "year": 2016, "value": -3.9, "growth_type": "Revenue Growth" },
    { "year": 2016, "value": -32.2, "growth_type": "Net Income Growth" },
    { "year": 2017, "value": 25.3, "growth_type": "Market Cap Growth" },
    { "year": 2017, "value": 5.9, "growth_type": "Revenue Growth" },
    { "year": 2017, "value": 43.9, "growth_type": "Net Income Growth" }
]

使用vega-lite为我可视化这些数据。

在运行vegalite MCP服务器之前

记得:

  1. 替换到的完整路径 mcp-vegalite-server 系统上具有正确路径的JAR
  2. 指定到的完整路径 vl-convert 在您的系统上

在克劳德桌面

    "vegalite": {
      "command": "java",
      "args": [
        "-Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory",
        "-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog",
        "-Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector",
        "-Dlog4j2.configurationFile=log4j2-mcp.xml",
        "-Dbabashka.json.provider=metosin/jsonista",
        "-Dlogging.level=INFO",
        "-Dmcp.vegalite.vl_convert_executable=/Users/vedang/.cargo/bin/vl-convert",
        "-cp",
        "/Users/vedang/mcp-vegalite-server/target/tech.unravel/mcp-vegalite-server-1.0.0.jar",
        "tech.unravel.mcp_vegalite_server"
      ]
    }

在MCP检查器中

记得使用完整路径 mcp-vegalite-server JAR在您的系统上。

npx @modelcontextprotocol/inspector java -Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Dlog4j2.configurationFile=log4j2-mcp.xml -Dbabashka.json.provider=metosin/jsonista -Dlogging.level=INFO -Dmcp.vegalite.vl_convert_executable=/Users/vedang/.cargo/bin/vl-convert -cp /Users/vedang/mcp-vegalite-server/target/tech.unravel/mcp-vegalite-server-1.0.0.jar tech.unravel.mcp_vegalite_server

许可证

版权所有©2025 Unravel.tech Engineering

根据MIT许可证分发