analyze_query
Analyze a query and get analyze result using query profile. Use set_session_db to set a per-session default database
Query a StarRocks cluster, get the query profile back for the slow ones, and see which tables are hottest and which score worst on health.
LABSCO SUMMARY
One tool reads visit counts out of the audit log and another ranks tables by health score — questions you would otherwise write and then maintain SQL for. The rest is shaped to keep large output away from the model: a query result can be redirected to a file, the table overview caps its sample at three rows, and both overview tools answer from cache unless refreshed. The dump-and-profile tool is the deliberate exception, and its own description warns the output is very large.
StarRocks' own server over a cluster: SQL execution, query profiling, audit-log-derived table rankings and a chart path, plus starrocks:// and proc:// resources for schemas and internal system state.
Python 3.11 or newer, uv, and a reachable StarRocks FE service — port 9030, the MySQL protocol port rather than the HTTP one. Connection details come either as STARROCKS_HOST, STARROCKS_PORT, STARROCKS_USER, STARROCKS_PASSWORD and STARROCKS_DB, or as one STARROCKS_URL that overrides them; on macOS the password can come from Keychain instead. Grant the account only what you intend, since the write tool runs DDL and DML. TLS is not verified unless you set a CA and turn verification on. Files that tools write land on the machine running the server, which is not the client machine for an HTTP deployment. Apache-2.0.
One command — uvx mcp-server-starrocks --mode streamable-http --port 8000
USE CASES
Run the analysis against the cluster's own query profile, and collect the full dump when the profile alone does not explain it — that output is large enough to need processing before it is read.
Set the session default so the database argument stops repeating, summarise the tables and their sizes, then open the one that matters with its columns, a few sample rows and a row count.
The cluster already knows which tables are being hit and which are in poor shape — one ranks by audit-log visit count over a window, the other by health score.
One call carries both the SQL and the Plotly expression, so the query result is charted without a separate export step.
Give the query an output file and a format; what comes back is a path, a byte count, a row count and a short preview rather than the rows themselves.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
analyze_queryAnalyze a query and get analyze result using query profile. Use set_session_db to set a per-session default database
collect_query_dump_and_profileRun a query to get it's query dump and profile, output very large, need special tools to do further processing
db_summaryQuickly get summary of a database with tables' schema and size information. Use set_session_db to set a per-session default database
query_and_plotly_chartusing sql query to extract data from database, then using python plotly_expr to generate a chart for UI to display. Use set_session_db to set a per-session default database
read_queryExecute a SELECT query or commands that return a ResultSet. Set output_file to write the full result to disk instead of returning it inline (useful for large results).. Use set_session_db to set a per-session default database
set_session_dbSet or clear the default database for THIS MCP session. Subsequent tool calls without an explicit db argument will use this database. Pass an empty string or null to clear and fall back to the server's global default. Returns the new effective default for this session.
table_overviewGet an overview of a specific table: columns, sample rows (up to 3), and total row count. Uses cache unless refresh=true. Use set_session_db to set a per-session default database
top_bad_tablesGet top bad tables by table health score
top_hot_tablesGet top hot tables by audit-log visit count
write_queryExecute a DDL/DML or other StarRocks command that do not have a ResultSet. Use set_session_db to set a per-session default database
BEFORE YOU INSTALL
10 tools when we connected. The documented db_overview no longer exists; call db_summary instead. collect_query_dump_and_profile and set_session_db are undocumented.
Both documented setups run the server on your machine.
CONTEXT COST
Rated by the size of the 10 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
uvx mcp-server-starrocks --mode streamable-http --port 8000{
"mcpServers": {
"mcp-server-starrocks": {
"command": "uv",
"args": [
"run",
"--with",
"mcp-server-starrocks",
"mcp-server-starrocks"
],
"env": {
"STARROCKS_URL": "root:password@localhost:9030/my_database"
}
}
}
}{
"mcpServers": {
"mcp-server-starrocks": {
"url": "http://localhost:8000/mcp"
}
}
}