StarRocks

Official

by StarRocks

179 603 downloads Not rated yet MIT
GitHub

About

Interact with [StarRocks](https://www.starrocks.io/)

Details

License
MIT

Explore

- Direct SQL Execution: Run SELECT queries (read_query) and DDL/DML commands (write_query).
- Database Exploration: List databases and tables, retrieve table schemas (starrocks:// resources).
- System Information: Access internal StarRocks metrics and states via the proc:// resource path.
- Detailed Overviews: Get comprehensive summaries of tables (table_overview) or entire databases (db_overview), including column definitions, row counts, and sample data.
- Data Visualization: Execute a query and generate a Plotly chart directly from the results (query_and_plotly_chart).
- Intelligent Caching: Table and database overviews are cached in memory to speed up repeated requests. Cache can be bypassed when needed.
- Flexible Configuration: Set connection details and behavior via environment variables.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name StarRocks
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Prerequisites

- Python 3.11 or newer.
- A reachable StarRocks cluster (FE service). By default the server connects to localhost:9030 over the MySQL protocol.
- uv — a fast Python package and project manager (a modern replacement for pip + virtualenv) from Astral. This project uses uv to resolve dependencies, create the virtual environment, and launch the server. The uv run commands throughout this README automatically create an isolated environment and install the required dependencies on first use, so no manual pip install step is needed.

read_query

**Description:** Execute a SELECT query or other commands that return a ResultSet (e.g., `SHOW`, `DESCRIBE`). Optionally write the full result to a local file instead of returning it inline — useful for results too large to fit in the model context.

write_query

**Description:** Execute a DDL (`CREATE`, `ALTER`, `DROP`), DML (`INSERT`, `UPDATE`, `DELETE`), or other StarRocks command that does not return a ResultSet.

analyze_query

**Description:** Analyze a query and get analyze result using query profile or explain analyze.

query_and_plotly_chart

**Description:** Executes a SQL query, loads the results into a Pandas DataFrame, and generates a Plotly chart using a provided Python expression. Designed for visualization in supporting UIs.

table_overview

**Description:** Get an overview of a specific table: columns (from `DESCRIBE`), total row count, and sample rows (`LIMIT 3`). Uses an in-memory cache unless `refresh` is true.

db_overview

**Description:** Get an overview (columns, row count, sample rows) for _all_ tables within a specified database. Uses the table-level cache for each table unless `refresh` is true.

- read_query

- Description: Execute a SELECT query or other commands that return a ResultSet (e.g., SHOW, DESCRIBE). Optionally write the full result to a local file instead of returning it inline — useful for results too large to fit in the model context.
- Input:

    {
"query": "SQL query string",
"db": "database name (optional, uses default database if not specified)",
"output_file": "optional path; if set, writes the full result to disk and returns only a summary + small preview. Relative paths resolve against STARROCKS_MCP_OUTPUT_DIR (default: ~/.mcp-server-starrocks/output/); absolute paths and ~ are used as-is",
"output_format": "optional: csv | tsv | json | jsonl. If omitted, inferred from output_file extension (.csv/.tsv/.json/.jsonl/.ndjson); defaults to csv"
}

- Output: Without output_file, text content containing the query results in CSV-like format with a header row and row count summary. With output_file, a short summary including the resolved absolute path, byte count, and row count, plus a small preview. Returns an error message on failure.

- write_query

- Description: Execute a DDL (CREATE, ALTER, DROP), DML (INSERT, UPDATE, DELETE), or other StarRocks command that does not return a ResultSet.
- Input:

    {
"query": "SQL command string",
"db": "database name (optional, uses default database if not specified)"
}

- Output: Text content confirming success (e.g., "Query OK, X rows affected") or reporting an error. Changes are committed automatically on success.

- analyze_query

- Description: Analyze a query and get analyze result using query profile or explain analyze.
- Input:

    {
"uuid": "Query ID, a string composed of 32 hexadecimal digits formatted as 8-4-4-4-12",
"sql": "Query SQL to analyze",
"db": "database name (optional, uses default database if not specified)"
}

- Output: Text content containing the query analysis results. Uses ANALYZE PROFILE FROM if uuid is provided, otherwise uses EXPLAIN ANALYZE if sql is provided.

- query_and_plotly_chart

- Description: Executes a SQL query, loads the results into a Pandas DataFrame, and generates a Plotly chart using a provided Python expression. Designed for visualization in supporting UIs.
- Input:

    {
"query": "SQL query to fetch data",
"plotly_expr": "Python expression string using 'px' (Plotly Express) and 'df' (DataFrame). Example: 'px.scatter(df, x=\"col1\", y=\"col2\")'",
"db": "database name (optional, uses default database if not specified)"
}

- Output: A list containing:
1. TextContent: A text representation of the DataFrame and a note that the chart is for UI display.
2. ImageContent: The generated Plotly chart encoded as a base64 PNG image (image/png). Returns text error message on failure or if the query yields no data.

- table_overview

- Description: Get an overview of a specific table: columns (from DESCRIBE), total row count, and sample rows (LIMIT 3). Uses an in-memory cache unless refresh is true.
- Input:

    {
"table": "Table name, optionally prefixed with database name (e.g., 'db_name.table_name' or 'table_name'). If database is omitted, uses STARROCKS_DB environment variable if set.",
"refresh": false // Optional, boolean. Set to true to bypass the cache. Defaults to false.
}

- Output: Text content containing the formatted overview (columns, row count, sample data) or an error message. Cached results include previous errors if applicable.

- db_overview
- Description: Get an overview (columns, row count, sample rows) for _all_ tables within a specified database. Uses the table-level cache for each table unless refresh is true.
- Input:

    {
"db": "database_name", // Optional if default database is set.
"refresh": false // Optional, boolean. Set to true to bypass the cache for all tables in the DB. Defaults to false.
}

- Output: Text content containing concatenated overviews for all tables found in the database, separated by headers. Returns an error message if the database cannot be accessed or contains no tables.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "starrocks": {
            "mcp-server-starrocks": {
                "command": "uv",
                "args": [
                    "run",
                    "--with",
                    "mcp-server-starrocks",
                    "mcp-server-starrocks",
                    "--help"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-server-starrocks": {
        "command": "uv",
        "args": [
            "run",
            "--with",
            "mcp-server-starrocks",
            "mcp-server-starrocks",
            "--help"
        ]
    }
}

The StarRocks MCP Server acts as a bridge between AI assistants and StarRocks databases. It allows for direct SQL execution, database exploration, data visualization via charts, and retrieving detailed schema/data overviews without requiring complex client-side setup.

<a href="https://glama.ai/mcp/servers/@StarRocks/mcp-server-starrocks">
StarRocks Server MCP server
</a>

Features

- Direct SQL Execution: Run SELECT queries (read_query) and DDL/DML commands (write_query).
- Database Exploration: List databases and tables, retrieve table schemas (starrocks:// resources).
- System Information: Access internal StarRocks metrics and states via the proc:// resource path.
- Detailed Overviews: Get comprehensive summaries of tables (table_overview) or entire databases (db_overview), including column definitions, row counts, and sample data.
- Data Visualization: Execute a query and generate a Plotly chart directly from the results (query_and_plotly_chart).
- Intelligent Caching: Table and database overviews are cached in memory to speed up repeated requests. Cache can be bypassed when needed.
- Flexible Configuration: Set connection details and behavior via environment variables.

Prerequisites

- Python 3.11 or newer.
- A reachable StarRocks cluster (FE service). By default the server connects to localhost:9030 over the MySQL protocol.
- uv — a fast Python package and project manager (a modern replacement for pip + virtualenv) from Astral. This project uses uv to resolve dependencies, create the virtual environment, and launch the server. The uv run commands throughout this README automatically create an isolated environment and install the required dependencies on first use, so no manual pip install step is needed.

Installing uv

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.

Videos about StarRocks

Relevant YouTube tutorials, setups, and demos