StarRocks MCP server

Integrates with StarRocks databases to enable efficient data querying and manipulation through customizable connection settings and support for both read and write operations.
Back to servers
Setup instructions
Provider
StarRocks
Release date
Mar 05, 2025
Language
Python
Stats
92 stars

The StarRocks MCP Server serves as a bridge between AI assistants and StarRocks databases, enabling direct SQL execution, database exploration, data visualization, and comprehensive schema/data overviews without complex client-side setup.

Configuration

The MCP server can be configured in several ways, with Streamable HTTP mode being recommended for integration.

Using uv with Installed Package

{
  "mcpServers": {
    "mcp-server-starrocks": {
      "command": "uv",
      "args": ["run", "--with", "mcp-server-starrocks", "mcp-server-starrocks"],
      "env": {
        "STARROCKS_HOST": "default localhost",
        "STARROCKS_PORT": "default 9030",
        "STARROCKS_USER": "default root",
        "STARROCKS_PASSWORD": "default empty",
        "STARROCKS_DB": "default empty",
        "STARROCKS_OVERVIEW_LIMIT": "default 20000",
        "STARROCKS_MYSQL_AUTH_PLUGIN":"mysql_clear_password"
      }
    }
  }
}

Using Streamable HTTP (Recommended)

{
  "mcpServers": {
    "mcp-server-starrocks": {
      "url": "http://localhost:8000/mcp"
    }
  }
}

To start the server in Streamable HTTP mode:

export MCP_TRANSPORT_MODE=streamable-http
uv run mcp-server-starrocks

Environment Variables

  • STARROCKS_HOST: Hostname or IP of StarRocks FE service (default: localhost)
  • STARROCKS_PORT: MySQL protocol port (default: 9030)
  • STARROCKS_USER: Username (default: root)
  • STARROCKS_PASSWORD: Password (default: empty)
  • STARROCKS_DB: Default database (default: none)
  • STARROCKS_OVERVIEW_LIMIT: Character limit for overview tools (default: 20000)
  • STARROCKS_MYSQL_AUTH_PLUGIN: Authentication plugin (e.g., mysql_clear_password)
  • MCP_TRANSPORT_MODE: Communication mode (stdio, streamable-http, or deprecated sse)

Available Tools

read_query

Executes SELECT queries or commands that return a ResultSet.

Input:

{ "query": "SELECT * FROM my_table LIMIT 10" }

Output: Text containing query results in CSV-like format with header row and row count summary.

write_query

Executes DDL/DML commands that don't return a ResultSet.

Input:

{ "query": "CREATE TABLE example (id INT, name VARCHAR(100))" }

Output: Text confirming success or reporting an error.

query_and_plotly_chart

Executes a query and generates a Plotly chart from the results.

Input:

{
  "query": "SELECT date, revenue FROM sales WHERE year = 2023",
  "plotly_expr": "px.line(df, x='date', y='revenue', title='2023 Revenue')"
}

Output: A list containing a text representation of the data and a base64-encoded PNG image of the chart.

table_overview

Gets an overview of a specific table including columns, row count, and sample data.

Input:

{
  "table": "sales_data",
  "refresh": false
}

Output: Text containing formatted table overview.

db_overview

Gets an overview of all tables in a specified database.

Input:

{
  "db": "analytics",
  "refresh": false
}

Output: Text containing concatenated overviews for all tables in the database.

Resource Access

Direct Resources

  • starrocks:///databases - Lists all accessible databases

Resource Templates

  • starrocks:///{db}/{table}/schema - Gets table schema definition
  • starrocks:///{db}/tables - Lists all tables in a database
  • proc:///{+path} - Accesses StarRocks internal system information

Common proc paths include:

  • /frontends - FE node information
  • /backends - BE node information
  • /dbs - Database information
  • /transactions - Transaction information
  • /jobs - Asynchronous job information
  • /catalog - Configured catalog information

Caching Behavior

The server implements intelligent caching for table and database overviews:

  • Results are cached in memory by (database_name, table_name)
  • Cache can be bypassed with the refresh: true parameter
  • The STARROCKS_OVERVIEW_LIMIT environment variable controls maximum overview text length
  • Cached results include any error messages from the original fetch

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "mcp-server-starrocks" '{"command":"uv","args":["run","--with","mcp-server-starrocks","mcp-server-starrocks"],"env":{"STARROCKS_HOST":"default localhost","STARROCKS_PORT":"default 9030","STARROCKS_USER":"default root","STARROCKS_PASSWORD":"default empty","STARROCKS_DB":"default empty","STARROCKS_OVERVIEW_LIMIT":"default 20000","STARROCKS_MYSQL_AUTH_PLUGIN":"mysql_clear_password"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There 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.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "mcp-server-starrocks": {
            "command": "uv",
            "args": [
                "run",
                "--with",
                "mcp-server-starrocks",
                "mcp-server-starrocks"
            ],
            "env": {
                "STARROCKS_HOST": "default localhost",
                "STARROCKS_PORT": "default 9030",
                "STARROCKS_USER": "default root",
                "STARROCKS_PASSWORD": "default empty",
                "STARROCKS_DB": "default empty",
                "STARROCKS_OVERVIEW_LIMIT": "default 20000",
                "STARROCKS_MYSQL_AUTH_PLUGIN": "mysql_clear_password"
            }
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "mcp-server-starrocks": {
            "command": "uv",
            "args": [
                "run",
                "--with",
                "mcp-server-starrocks",
                "mcp-server-starrocks"
            ],
            "env": {
                "STARROCKS_HOST": "default localhost",
                "STARROCKS_PORT": "default 9030",
                "STARROCKS_USER": "default root",
                "STARROCKS_PASSWORD": "default empty",
                "STARROCKS_DB": "default empty",
                "STARROCKS_OVERVIEW_LIMIT": "default 20000",
                "STARROCKS_MYSQL_AUTH_PLUGIN": "mysql_clear_password"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later