KosmoKrator

rendering

Vega-Lite MCP Integration for LangChain

Connect Vega-Lite to LangChain through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.

1 functions 0 read 1 write No credentials auth

Connect Vega-Lite to LangChain

Bridge LangChain agents to local KosmoKrator integration tools through MCP or headless CLI calls.

Use the MCP gateway when the agent should discover tools, or wrap kosmo integrations:call for fixed chains. The gateway is local, scoped to this integration, and starts with --write=deny so LangChain can inspect read-capable tools without receiving write access by default.

Vega-Lite MCP Config for LangChain

Keep the gateway scoped to the integration and operation class needed by the chain.

{
  "mcpServers": {
    "kosmokrator-vegalite": {
      "type": "stdio",
      "command": "kosmo",
      "args": [
        "mcp:serve",
        "--integration=vegalite",
        "--write=deny"
      ]
    }
  }
}

Run the Gateway Manually

kosmokrator mcp:serve --integration=vegalite --write=deny

Why Use KosmoKrator Here

Scoped tools

Expose only Vega-Lite instead of a broad multi-service tool list.

Local credentials

Reuse credentials already configured for the KosmoKrator CLI and Lua runtime.

Write policy

Start read-only, then opt into ask or allow for trusted workspaces.

Vega-Lite Tools Visible to LangChain

LangChain sees stable MCP tool names generated from the Vega-Lite integration catalog.

MCP toolSource functionTypeDescription
integration__vegalite__render_vegalite vegalite.render_vegalite Write Render a Vega-Lite visualization to a PNG image. Pass a complete Vega-Lite JSON specification and get back a markdown image embed. IMPORTANT: Always use inline data with "data": {"values": [...]}. Never use "data": {"url": "..."}. Example spec: { "$schema": "https://vega.github.io/schema/vega-lite/v5.json", "data": {"values": [ {"category": "A", "value": 28}, {"category": "B", "value": 55}, {"category": "C", "value": 43} ]}, "mark": "bar", "encoding": { "x": {"field": "category", "type": "nominal"}, "y": {"field": "value", "type": "quantitative"} } } Supported mark types: bar, line, point, area, rect, circle, square, arc, text, tick, rule, trail, boxplot. Always include "type" in encoding channels: "quantitative", "nominal", "ordinal", or "temporal".

Related Vega-Lite Pages