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
123 stars

The StarRocks MCP Server serves as a bridge between AI assistants and StarRocks databases, allowing you to execute SQL, explore databases, visualize data, and retrieve schema information without complex setup. It streamlines database interactions for AI applications with features like direct query execution and intelligent caching.

Installation and Configuration

Setup Options

You can run the StarRocks MCP server in different modes, with the Streamable HTTP mode being recommended.

Testing Connection

Before starting the server, test your connection:

STARROCKS_URL=root:@localhost:8000 uv run mcp-server-starrocks --test

Starting the Server

Start the server in Streamable HTTP mode:

uv run mcp-server-starrocks --mode streamable-http --port 8000

Configuration Options

You can configure the MCP server through various methods:

Streamable HTTP Mode (Recommended)

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

Individual Environment Variables

{
  "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"
      }
    }
  }
}

Connection URL Method

{
  "mcpServers": {
    "mcp-server-starrocks": {
      "command": "uv",
      "args": ["run", "--with", "mcp-server-starrocks", "mcp-server-starrocks"],
      "env": {
        "STARROCKS_URL": "root:password@localhost:9030/my_database"
      }
    }
  }
}

Command-line Arguments

View available command-line arguments:

uv run mcp-server-starrocks --help

Common usage examples:

# Start in streamable HTTP mode on custom host/port
uv run mcp-server-starrocks --mode streamable-http --host 0.0.0.0 --port 8080

# Start in stdio mode (default)
uv run mcp-server-starrocks --mode stdio

# Run test mode
uv run mcp-server-starrocks --test

Environment Variables

Connection Configuration

Option 1: Individual Environment Variables

  • STARROCKS_HOST: Hostname (defaults to localhost)
  • STARROCKS_PORT: MySQL protocol port (defaults to 9030)
  • STARROCKS_USER: Username (defaults to root)
  • STARROCKS_PASSWORD: Password (defaults to empty)
  • STARROCKS_DB: Default database (optional)

Option 2: Connection URL

  • STARROCKS_URL: A connection URL in the format [<schema>://]user:password@host:port/database

Examples:

Additional Configuration

  • STARROCKS_OVERVIEW_LIMIT: Character limit for overview tools (defaults to 20000)
  • STARROCKS_MYSQL_AUTH_PLUGIN: Authentication plugin (optional)
  • MCP_TRANSPORT_MODE: Communication mode (stdio, streamable-http, or sse - deprecated)

Using the MCP Server

Available Tools

Read Query

Execute SELECT queries or commands that return results:

{
  "query": "SELECT * FROM my_table LIMIT 10",
  "db": "my_database"  // Optional
}

Write Query

Execute DDL/DML commands:

{
  "query": "CREATE TABLE example (id INT, name VARCHAR(50))",
  "db": "my_database"  // Optional
}

Analyze Query

Analyze query performance:

{
  "uuid": "12345678-1234-1234-1234-123456789012",  // Query ID
  "sql": "SELECT * FROM large_table",  // Alternative to uuid
  "db": "my_database"  // Optional
}

Query and Plotly Chart

Generate visualizations from query results:

{
  "query": "SELECT date, sales FROM transactions",
  "plotly_expr": "px.line(df, x='date', y='sales', title='Sales Over Time')",
  "db": "my_database"  // Optional
}

Table Overview

Get comprehensive information about a table:

{
  "table": "my_database.my_table",  // Or just "my_table" if using default DB
  "refresh": false  // Optional, bypass cache if true
}

Database Overview

Get information about all tables in a database:

{
  "db": "my_database",  // Optional if default database is set
  "refresh": false  // Optional, bypass cache if true
}

Resource Access

Listing Databases

Access starrocks:///databases to list all available databases.

Table Schema

Access starrocks:///{db}/{table}/schema to get the schema of a specific table.

Listing Tables

Access starrocks:///{db}/tables to list all tables in a database.

System Information

Access proc:///{path} to retrieve internal StarRocks system information. Common paths include:

  • /frontends - Information about FE nodes
  • /backends - Information about BE nodes
  • /dbs - Information about databases
  • /transactions - Transaction information

Debugging

After starting the server, you can use the inspector tool to debug:

npx @modelcontextprotocol/inspector

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