mcp-server-starrocks

StarRocks MCP (Model Context Protocol) Server

GitHub Stars

115

User Rating

Not Rated

Favorites

0

Views

24

Forks

34

Issues

1

Installation
Difficulty
Intermediate
Estimated Time
10-20 minutes
Requirements
Python 3.7以上
StarRocks 最新版

Installation

Installation

Prerequisites

Required software and versions:
Python: 3.7 or higher
StarRocks: Latest version

Installation Steps

1. Clone Repository

bash
git clone https://github.com/StarRocks/mcp-server-starrocks
cd mcp-server-starrocks

2. Install Dependencies

bash
pip install -r requirements.txt

3. Start Server

bash
uv run --with mcp-server-starrocks mcp-server-starrocks

Troubleshooting

Common Issues

Issue: Server won't start Solution: Check Python version and reinstall dependencies. Issue: Database connection error Solution: Verify environment variable settings.

Configuration

Configuration

Basic Configuration

MCP Server Setup

Edit the following configuration file to specify connection details for the StarRocks MCP server:
json
{
  "mcpServers": {
    "mcp-server-starrocks": {
      "command": "uv",
      "args": ["run", "--with", "mcp-server-starrocks", "mcp-server-starrocks"],
      "env": {
        "STARROCKS_HOST": "localhost",
        "STARROCKS_PORT": "9030",
        "STARROCKS_USER": "root",
        "STARROCKS_PASSWORD": "",
        "STARROCKS_DB": "",
        "STARROCKS_OVERVIEW_LIMIT": "20000",
        "STARROCKS_MYSQL_AUTH_PLUGIN": "mysql_clear_password"
      }
    }
  }
}

Environment Variables

Set the following environment variables as needed:
bash
export STARROCKS_HOST="localhost"
export STARROCKS_PORT="9030"

Examples

Examples

Basic Usage

Here are basic usage examples for the MCP server:

Executing SQL Queries

python
import requests

response = requests.post('http://localhost:3000/mcp/call', json={
    'tool': 'read_query',
    'parameters': {'query': 'SELECT * FROM my_table'}
})
print(response.json())

Data Visualization

python
import requests
import json

response = requests.post('http://localhost:3000/mcp/call', json={
    'tool': 'query_and_plotly_chart',
    'parameters': {'query': 'SELECT * FROM my_table'}
})
chart_data = response.json()

Use chart_data to plot with Plotly

Use Cases

Using an AI assistant to retrieve real-time information from the database.
Executing SQL queries directly for data analysis and visualizing the results.
Exploring the database schema to aid in application development.
Monitoring internal metrics of the system to optimize performance.

Additional Resources