<@U0A71G31CDV> do we have any MCP to connect with ...
# questions-and-troubleshooting
g
@Rocky do we have any MCP to connect with you?
r
Yes, StarRocks has an official Model Context Protocol (MCP) server that allows AI assistants (like Claude, Cursor, or custom agents) to connect directly to a StarRocks database. You can find the repository and documentation on GitHub at StarRocks/mcp-server-starrocks. Key Features * Direct SQL Execution: Run
SELECT
,
DDL
, and
DML
queries directly from an AI interface. * Database Exploration: List databases and tables, and retrieve schemas using the
starrocks://
resource. * Intelligent Overviews: Tools like
table_overview
and
db_overview
provide summaries, row counts, and sample data to give the AI better context. * System Insights: Access internal StarRocks metrics via the
proc://
resource. * Data Visualization: Supports generating charts and visualizations from query results. Quick Start If you have
uv
installed, you can run it immediately without manual installation:
Copy code
bash
uv run mcp-server-starrocks
Or install it via pip:
Copy code
bash
pip install mcp-server-starrocks
Configuration To connect it to your instance, you typically configure the following environment variables: *
STARROCKS_HOST
*
STARROCKS_PORT
(MySQL protocol port, usually 9030) *
STARROCKS_USER
*
STARROCKS_PASSWORD
This MCP server acts as a bridge, turning StarRocks into a "data-savvy" backend for AI agents. References • administration/management/proc_profile.md • loading/loading_introduction/loading_concepts.md • administration/management/BE_configuration.md • developers/code-style-guides/protobuf-guides.md • administration/management/FE_configuration.md • developers/type_checker_xml_configuration.md
g
@Rocky i want to connect to you and ask questions directly from my claude
r
To connect Claude Desktop to StarRocks, you can configure the StarRocks MCP Server. This allows you to query your database, browse schemas, and analyze data directly from the Claude chat interface. 1. Prerequisites * Claude Desktop installed on your Mac or Windows. * uv installed (the fastest way to run Python-based MCP servers). You can install it via
curl -LsSf <https://astral.sh/uv/install.sh> | sh
. 2. Configure Claude Desktop You need to add the StarRocks server to your Claude Desktop configuration file. * File Location: * macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
* Windows:
%APPDATA%\Claude\claude_desktop_config.json
* Configuration: Open the file and add the
starrocks
entry under
mcpServers
. Replace the placeholder credentials with your actual StarRocks connection details:
Copy code
json
{
  "mcpServers": {
    "starrocks": {
      "command": "uvx",
      "args": ["mcp-server-starrocks"],
      "env": {
        "STARROCKS_URL": "root:your_password@your_host:9030/your_database"
      }
    }
  }
}
3. Restart Claude Fully quit and restart Claude Desktop. You should see a hammer icon (tools) in the input area, indicating the StarRocks MCP server is connected. 4. What you can ask Once connected, you can ask Claude questions like: * "Show me the schema of the
orders
table." * "What are the top 5 customers by revenue this month?" (Claude will write and execute the SQL for you). * "Explain the performance of this query and suggest optimizations." * "Create a bar chart showing daily active users from the
logs
table." Connection Details (STARROCKS_URL) The URL follows the standard format:
user:password@host:port/database
* Port: Use the MySQL protocol port (default
9030
). * SSL: If your instance requires SSL, you can append
?ssl_ca=/path/to/cert
to the URL. For more advanced configurations (like using Arrow Flight SQL for faster data transfer), check the official GitHub repository. References • administration/management/proc_profile.md • loading/loading_introduction/loading_concepts.md • administration/management/BE_configuration.md • administration/management/FE_configuration.md • developers/type_checker_xml_configuration.md • developers/code-style-guides/protobuf-guides.md rocks).
g
@Rocky i want to connect to rocky so that it can understand my starRocks setup n queries and help me to improve performance
r
To connect me (Rocky) to your StarRocks setup so I can analyze your configuration and help with performance, you should use the StarRocks MCP Server. Since I am an AI assistant, I don't have a direct "login" to your private network. The MCP (Model Context Protocol) server acts as the bridge that allows me to "see" your database safely within your own environment (like Claude Desktop or Cursor). How to set this up for Performance Tuning: 1. Install the MCP Server: Run this in your terminal to ensure it's available:
Copy code
bash
    pip install mcp-server-starrocks
2. Enable High-Performance Connection: When configuring your
claude_desktop_config.json
, use the
STARROCKS_USE_FLIGHTSQL
environment variable. This uses the Arrow Flight SQL protocol, which is much faster for transferring the large amounts of metadata needed for deep performance analysis.
Copy code
json
    "env": {
      "STARROCKS_URL": "user:pass@host:9030/db",
      "STARROCKS_USE_FLIGHTSQL": "true"
    }
### How I can help you improve performance once connected: Once you've connected me via the MCP server, you can give me commands like: * "Analyze this slow query": I can run
EXPLAIN
or
EXPLAIN ANALYZE
on your SQL, look at the execution plan, and tell you if you're missing indexes (like Bloom Filters) or if your data distribution (Bucketing/Partitioning) is causing a bottleneck. * "Check my system configuration": I can query your global variables (using
show variables
) to see if
enable_pipeline_engine
is on or if your memory limits are set correctly for your hardware. * "Inspect table health": I can use the
table_overview
tool to check for data skew (where one BE has way more data than others) or if your tablet count is too high/low. * "Monitor BE Health": I can access the
proc://
resource to see real-time backend metrics like memory usage and CPU load to see if your cluster is undersized. ### If you cannot use the MCP server: If you can't install the MCP server due to security policies, you can still get performance help from me by pasting the following into our chat: 1. The output of
SHOW CREATE TABLE your_table_name;
2. The output of
EXPLAIN ANALYZE your_query;
(for StarRocks v3.1+) or just
EXPLAIN your_query;
. 3. Your cluster version (
SELECT druid_version();
). With that information, I can manually identify bottlenecks and suggest optimizations. ## References - [administration/management/proc_profile.md](https://docs.starrocks.io/docs/administration/management/proc_profile) - [loading/loading_introduction/loading_concepts.md](https://docs.starrocks.io/docs/loading/loading_introduction/loading_concepts) - [administration/management/BE_configuration.md](https://docs.starrocks.io/docs/administration/management/BE_configuration) - [administration/management/FE_configuration.md](https://docs.starrocks.io/docs/administration/management/FE_configuration) - [deployment/post_deployment_setup.md](https://docs.starrocks.io/docs/deployment/post_deployment_setup) - [unloading/arrow_flight.md](https://docs.starrocks.io/docs/unloading/arrow_flight) - [developers/type_checker_xml_configuration.md](https://docs.starrocks.io/docs/developers/type_checker_xml_configuration) - [developers/code-style-guides/protobuf-guides.md](https://docs.starrocks.io/docs/developers/code-style-guides/protobuf-guides) ## References - [deployment/post_deployment_setup.md](https://docs.starrocks.io/docs/deployment/post_deployment_setup) - [unloading/arrow_flight.md](https://docs.starrocks.io/docs/unloading/arrow_flight)