LLM Data Visualization Integration Workflow
A page for connecting LLM workflows to structured data visualization outputs, shown as source code with no unsupported runtime claim.
This page links a public repository, Mavline/mcp-server-vegalite, for LLM-connected data visualization. It is a Python Model Context Protocol server that turns saved tabular data plus a Vega-Lite specification into a chart.
What the source code shows
The server keeps the data handoff explicit by exposing two tools. save_data stores a named table; visualize_data renders a Vega-Lite specification against that saved table:
# src/mcp_server_vegalite/server.py (sanitized excerpt)
types.Tool(
name="save_data",
description=SAVE_DATA_TOOL_DESCRIPTION,
inputSchema={ ... }, # name + rows of JSON-like records
),
types.Tool(
name="visualize_data",
description=VISUALIZE_DATA_TOOL_DESCRIPTION,
inputSchema={
"data_name": "The name of the data table to visualize",
# plus the Vega-Lite specification
},
)
The repository also ships a visualizations/ directory with generated chart PNGs from earlier runs (for example order-status and work-centre distributions), which show that the save-then-visualize path produces real output.
How this maps to client work
The same contract supports AI-assisted reporting and LLM integration work: structured data is saved under a name, a chart specification is generated and rendered, and the output can be reviewed before it enters a business workflow. This page shows source code, not a hosted production analytics product; a guided walkthrough can be arranged on request.
Problem
Teams want AI-assisted analytics interfaces that can turn questions and structured data into reliable visual outputs without hiding the data contract.
Context
The public repository Mavline/mcp-server-vegalite is an LLM-connected data visualization workflow using Vega-Lite. The README documents a Model Context Protocol server that exposes two tools: one saves a named table of records, the other renders a Vega-Lite specification against that saved data and returns a chart spec or PNG. This page links that public repository directly, not as a separate MCP commercial service and not as a measured production result.
Inputs
- A named table of JSON-like records saved by the save_data tool
- A Vega-Lite specification supplied to the visualize_data tool
Technical approach
The repository implements an MCP server in Python that makes the data handoff explicit. The save_data tool stores a named dataset; the visualize_data tool takes a Vega-Lite specification, attaches the saved data, renders it with vl-convert, and returns either the chart specification or a PNG. A stdio transport serves local MCP clients, and an SSE/FastAPI path exists for integration experiments. The reusable pattern is the contract between prompt, saved structured data, generated chart specification, and reviewable output.
Stack
- Python 3.10+
- Model Context Protocol Python SDK
- FastAPI and uvicorn (SSE path)
- Vega-Lite via vl-convert-python
What was built
An MCP server with two tools, save_data and visualize_data, that turn saved tabular data plus a Vega-Lite specification into reviewable chart output (spec or PNG). The public repository also ships a visualizations/ directory containing generated chart outputs from earlier runs, which show what the save-then-visualize path produces.
Deployment
No hosted demo. The repository ships source and a local run path (uv sync, uv run mcp_server_vegalite).
What can be reused
- Explicit save-data then visualize-data contract
- Vega-Lite specification rendered to spec or PNG via vl-convert
- Reviewable generated chart artifacts before they enter a workflow
Boundaries
- Source code only; there is no deployed dashboard
- MCP is treated as an integration layer, not a client-facing service category
- No private data or unsupported runtime trace is exposed