This MCP server allows you to visualize data using Vega-Lite syntax, providing your LLM with tools to save data tables and generate visualizations through the Model Context Protocol interface.
To use the data visualization MCP server, follow these steps:
To integrate the server with Claude Desktop, you need to add it to your configuration file:
claude_desktop_config.json
filemcpServers
section:{
"mcpServers": {
"datavis": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/mcp-datavis-server",
"run",
"mcp_server_datavis",
"--output_type",
"png" # or "text"
]
}
}
}
/absolute/path/to/mcp-datavis-server
with the actual path to the server directory on your system--output_type
, you can choose:
png
: Returns visualizations as base64 encoded PNG imagestext
: Returns the complete Vega-Lite specification with dataThe MCP server provides two main tools for data visualization:
Use the save_data
tool to store data tables for visualization:
name
(string): A unique identifier for your data tabledata
(array): An array of objects representing your data tableFor example:
# Save a sample dataset
save_data(
name="sales_data",
data=[
{"month": "Jan", "sales": 120},
{"month": "Feb", "sales": 150},
{"month": "Mar", "sales": 200}
]
)
After saving your data, use the visualize_data
tool to create visualizations:
data_name
(string): The name of the previously saved data tablevegalite_specification
(string): A JSON string with the Vega-Lite specificationFor example:
# Create a bar chart visualization
visualize_data(
data_name="sales_data",
vegalite_specification='''
{
"mark": "bar",
"encoding": {
"x": {"field": "month", "type": "nominal"},
"y": {"field": "sales", "type": "quantitative"}
}
}
'''
)
The visualization output depends on your configuration:
--output_type
set to text
: You'll receive a success message containing the complete Vega-Lite specification with data--output_type
set to png
: You'll receive a base64 encoded PNG image of the visualizationThere are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.