mcp-server-starrocks

by hagsmand
Verified

Integrations

  • The MCP server is built with Python, required as a prerequisite (3.8+), and the server is launched using Python commands

  • Used for database connectivity with the StarRocks database, enabling execution of SELECT queries, table management, and database operations

StarRocks MCP 服务器

用于与 StarRocks 数据库交互的模型控制协议 (MCP) 服务器。该服务器为 AI 模型提供了一个标准化接口,以便通过一组定义的工具查询和操作 StarRocks 数据库。

概述

StarRocks MCP 服务器允许 AI 模型:

  • 在 StarRocks 数据库上执行 SELECT 查询
  • 列出可用的表
  • 描述表模式
  • 创建新表(非只读模式时)
  • 执行写入操作,如 INSERT、UPDATE、DELETE(非只读模式时)

安装

先决条件

  • Python 3.8+
  • StarRocks 数据库实例
  • SQLAlchemy
  • MCP Python 库

从源安装

git clone https://github.com/yourusername/mcp-server-starrocks.git cd mcp-server-starrocks pip install -e .

从 Smithery 安装

npm 安装@smithery/sdk @modelcontextprotocol/sdk

使用 MCP 检查器

npx @modelcontextprotocol/inspector uv --directory ~/mcp-server-starrocks 运行 mcp-server-starrocks

用法

启动服务器

python -m mcp_server_starrocks.server --host <starrocks-host> --port <starrocks-port> --user <username> --database <database-name> [--password <password>] [--readonly]

命令行参数:

  • --host :StarRocks 服务器主机(必需)
  • --port :StarRocks 服务器端口(默认值:9030)
  • --user :StarRocks 用户名(必填)
  • --database :StarRocks 数据库名称(必需)
  • --password :StarRocks 密码(如果需要)
  • --readonly :以只读模式运行服务器(可选)

可用工具

该服务器提供以下工具:

只读工具:

  • read-query :在 StarRocks 数据库上执行 SELECT 查询
  • list-tables :列出 StarRocks 数据库中的所有表
  • describe-table :描述特定表的模式

写入工具(非只读模式时可用):

  • write-query :执行 INSERT、UPDATE 或 DELETE 查询
  • create-table :在 StarRocks 数据库中创建新表

示例

列出表

{ "name": "list-tables", "arguments": {} }

执行 SELECT 查询

{ "name": "read-query", "arguments": { "query": "SELECT FROM my_table LIMIT 10" } }

描述表

{ "name": "describe-table", "arguments": { "table_name": "my_table" } }

创建表(非只读模式时)

{ "name": "create-table", "arguments": { "query": "CREATE TABLE new_table (id INT, name VARCHAR(100))" } }

执照

MIT 许可证

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

-
security - not tested
A
license - permissive license
-
quality - not tested

该 MCP 服务器提供与 Starrocks 的连接,让您以最小的努力探索该查询引擎。

  1. Overview
    1. Installation
      1. Prerequisites
      2. Install from source
      3. Install from Smithery
      4. Using MCP Inspector
    2. Usage
      1. Starting the server
      2. Available Tools
    3. Examples
      1. Listing tables
      2. Executing a SELECT query
      3. Describing a table
      4. Creating a table (when not in read-only mode)
    4. License
      1. Contributing
        ID: qjidoviad2