Skip to main content
Glama
aptro

Superset MCP Integration

by aptro

superset_chart_create

Create visualizations in Apache Superset by specifying chart type, data source, and parameters to generate charts like bar, line, or pie charts for data analysis.

Instructions

Create a new chart in Superset

Makes a request to the /api/v1/chart/ POST endpoint to create a new visualization.

Args: slice_name: Name/title of the chart datasource_id: ID of the dataset or SQL table datasource_type: Type of datasource ('table' for datasets, 'query' for SQL) viz_type: Visualization type (e.g., 'bar', 'line', 'pie', 'big_number', etc.) params: Visualization parameters including metrics, groupby, time_range, etc.

Returns: A dictionary with the created chart information including its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slice_nameYes
datasource_idYes
datasource_typeYes
viz_typeYes
paramsYes

Implementation Reference

  • main.py:659-694 (handler)
    The core handler function for the 'superset_chart_create' tool. It constructs a payload from the input parameters and makes a POST request to Superset's /api/v1/chart/ endpoint to create a new chart (slice). The function uses decorators for authentication (@requires_auth) and error handling (@handle_api_errors). The @mcp.tool() decorator registers this function as an MCP tool.
    @mcp.tool()
    @requires_auth
    @handle_api_errors
    async def superset_chart_create(
        ctx: Context,
        slice_name: str,
        datasource_id: int,
        datasource_type: str,
        viz_type: str,
        params: Dict[str, Any],
    ) -> Dict[str, Any]:
        """
        Create a new chart in Superset
    
        Makes a request to the /api/v1/chart/ POST endpoint to create a new visualization.
    
        Args:
            slice_name: Name/title of the chart
            datasource_id: ID of the dataset or SQL table
            datasource_type: Type of datasource ('table' for datasets, 'query' for SQL)
            viz_type: Visualization type (e.g., 'bar', 'line', 'pie', 'big_number', etc.)
            params: Visualization parameters including metrics, groupby, time_range, etc.
    
        Returns:
            A dictionary with the created chart information including its ID
        """
        payload = {
            "slice_name": slice_name,
            "datasource_id": datasource_id,
            "datasource_type": datasource_type,
            "viz_type": viz_type,
            "params": json.dumps(params),
        }
    
        return await make_api_request(ctx, "post", "/api/v1/chart/", data=payload)
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aptro/superset-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server