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.
The MCP server can be configured in several ways, with Streamable HTTP mode being recommended for integration.
{
"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"
}
}
}
}
{
"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
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
)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.
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.
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.
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.
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.
starrocks:///databases
- Lists all accessible databasesstarrocks:///{db}/{table}/schema
- Gets table schema definitionstarrocks:///{db}/tables
- Lists all tables in a databaseproc:///{+path}
- Accesses StarRocks internal system informationCommon proc paths include:
/frontends
- FE node information/backends
- BE node information/dbs
- Database information/transactions
- Transaction information/jobs
- Asynchronous job information/catalog
- Configured catalog informationThe server implements intelligent caching for table and database overviews:
(database_name, table_name)
refresh: true
parameterSTARROCKS_OVERVIEW_LIMIT
environment variable controls maximum overview text lengthTo 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.
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.
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"
}
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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