mcp-vegalite-server

This MCP server provides an interface for visualizing data using Vega-Lite syntax. It allows users to save aggregated data for later visualization. Users can specify the name and content of the data table to save, and provide a Vega-Lite specification for visualization.

GitHub Stars

85

User Rating

Not Rated

Favorites

0

Views

29

Forks

24

Issues

3

Installation
Difficulty
Intermediate
Estimated Time
10-20 minutes
Requirements
Python 3.7以上

Installation

Installation

Prerequisites

Please specify required software and versions:
Python: 3.7 or higher

Installation Steps

1. Clone Repository

bash
git clone https://github.com/isaacwasserman/mcp-vegalite-server.git
cd mcp-vegalite-server

2. Install Dependencies

bash
pip install -r requirements.txt

3. Configure Claude Desktop

Edit claude_desktop_config.json to add the MCP server:
json
{
  "mcpServers": {
    "datavis": {
        "command": "uv",
        "args": [
            "--directory",
            "/absolute/path/to/mcp-vegalite-server",
            "run",
            "mcp_server_datavis",
            "--output_type",
            "png" // or "text"
        ]
    }
  }
}

4. Start Server

bash
uvicorn mcp_server_datavis:app --reload

Troubleshooting

Common Issues

Issue: Server won't start Solution: Check Python version and reinstall dependencies. Issue: Not recognized by Claude Desktop Solution: Verify configuration file path and syntax.

Configuration

Configuration

Basic Configuration

Claude Desktop Setup

Edit ~/.config/claude-desktop/claude_desktop_config.json (macOS/Linux) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
json
{
  "mcpServers": {
    "datavis": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/mcp-vegalite-server",
        "run",
        "mcp_server_datavis",
        "--output_type",
        "png"
      ]
    }
  }
}

Environment Variables

Set the following environment variables as needed:
bash
export API_KEY="your-api-key"
export DEBUG="true"

Advanced Configuration

Security Settings

Store API keys in environment variables or secure configuration files
Set appropriate file access permissions
Adjust logging levels

Performance Tuning

Configure timeout values
Limit concurrent executions
Set up caching

Configuration Examples

Basic Configuration

json
{
  "mcpServers": {
    "example-mcp": {
      "command": "uv",
      "args": ["--directory", "/absolute/path/to/mcp-vegalite-server", "run", "mcp_server_datavis"]
    }
  }
}

Examples

Examples

Basic Usage

Here are basic usage examples for the MCP server:

Using with Claude Desktop

1Verify MCP Server Startup
Open Claude Desktop and confirm that the configuration has been loaded correctly.
2Execute Basic Commands

   Available tools from this MCP server:
   - save_data: Tool to save data aggregations
   - visualize_data: Tool to visualize data
   

Programmatic Usage

python

Python example

import requests

Save data

response = requests.post('http://localhost:8000/mcp/save_data', json={ 'name': 'my_data', 'data': [{"x": 1, "y": 2}, {"x": 2, "y": 3}] }) print(response.json())

Visualize data

visualization_response = requests.post('http://localhost:8000/mcp/visualize_data', json={ 'data_name': 'my_data', 'vegalite_specification': '{"mark": "point", "encoding": {"x": {"field": "x", "type": "quantitative"}, "y": {"field": "y", "type": "quantitative"}}}' }) print(visualization_response.json())

Use Cases

Creating visualizations for data analysis projects
Automated visualization of data using LLMs
Managing data by saving aggregations for later visualization
Generating custom graphs using Vega-Lite

Additional Resources