Skip to main content
Glama
MCP Trino Server

MCP Trino Server

by alaturqua

MCP Trino 服务器

铁匠徽章 Python 3.11+ VS 代码 Docker 执照

MCP Trino 服务器是一个模型上下文协议 (MCP)服务器,可与 Trino 和 Iceberg 无缝集成,通过标准接口实现高级数据探索、查询和表维护功能。

用例

  • Trino 中的交互式数据探索和分析

  • 自动化 Iceberg 表维护和优化

  • 构建与 Trino 数据库交互的人工智能工具

  • 使用适当的结果格式执行和管理 SQL 查询

Related MCP server: Alibaba Cloud DMS MCP Server

先决条件

  1. 正在运行的 Trino 服务器(或用于本地开发的 Docker Compose)

  2. Python 3.11 或更高版本

  3. Docker(可选,用于容器化部署)

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 MCP Trino Server:

npx -y @smithery/cli install @alaturqua/mcp-trino-python --client claude

本地运行 Trino

最简单的入门方法是使用包含的 Docker Compose 配置在本地运行 Trino:

docker-compose up -d

这将在localhost:8080上启动 Trino 服务器。现在您可以继续配置 MCP 服务器。

与 VS Code 一起使用

为了快速安装,您可以将以下配置添加到 VS Code 设置中。您可以按Ctrl + Shift + P并输入Preferences: Open User Settings (JSON)来完成此操作。

或者,您可以将其添加到工作区中名为.vscode/mcp.json的文件中。这样您就可以与其他人共享该配置。

请注意.vscode/mcp.json文件中不需要mcp键。

{
  "mcp": {
    "servers": {
      "trino": {
        "command": "docker",
        "args": ["run", "--rm", "ghcr.io/alaturqua/mcp-trino-python:latest"],
        "env": {
          "TRINO_HOST": "${input:trino_host}",
          "TRINO_PORT": "${input:trino_port}",
          "TRINO_USER": "${input:trino_user}",
          "TRINO_PASSWORD": "${input:trino_password}",
          "TRINO_HTTP_SCHEME": "${input:trino_http_scheme}",
          "TRINO_CATALOG": "${input:trino_catalog}",
          "TRINO_SCHEMA": "${input:trino_schema}"
        }
      }
    }
  }
}

与 Claude Desktop 一起使用

将以下配置添加到您的 Claude Desktop 设置:

{
  "mcpServers": {
    "trino": {
      "command": "python",
      "args": ["./src/server.py"],
      "env": {
        "TRINO_HOST": "your-trino-host",
        "TRINO_PORT": "8080",
        "TRINO_USER": "trino"
      }
    }
  }
}

配置

环境变量

多变的

描述

默认

TRINO_HOST

Trino 服务器主机名

本地主机

TRINO_PORT

Trino 服务器端口

8080

TRINO_用户

Trino 用户名

特里诺

TRINO_目录

默认目录

没有任何

TRINO_SCHEMA

默认架构

没有任何

TRINO_HTTP_方案

HTTP 方案 (http/https)

http

TRINO_密码

Trino 密码

没有任何

工具

查询和探索工具

  • 显示目录

    • 列出所有可用目录

    • 无需参数

  • 显示模式

    • 列出目录中的所有架构

    • 参数:

      • catalog :目录名称(字符串,必需)

  • 显示表

    • 列出模式中的所有表

    • 参数:

      • catalog :目录名称(字符串,必需)

      • schema :架构名称(字符串,必需)

  • 描述表

    • 显示详细的表结构和列信息

    • 参数:

      • table :表名(字符串,必需)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

  • 执行查询

    • 执行 SQL 查询并返回格式化的结果

    • 参数:

      • query :要执行的 SQL 查询(字符串,必需)

  • 显示目录树

    • 显示目录、模式和表的层次树视图

    • 返回带有视觉指示器的格式化树结构

    • 无需参数

  • 显示_创建_表

    • 显示表的 CREATE TABLE 语句

    • 参数:

      • table :表名(字符串,必需)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

  • 显示_创建_视图

    • 显示视图的 CREATE VIEW 语句

    • 参数:

      • view :视图名称(字符串,必需)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

  • 显示统计信息

    • 显示表的统计数据

    • 参数:

      • table :表名(字符串,必需)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

冰山桌维护

  • 优化

    • 通过压缩小文件来优化冰山表

    • 参数:

      • table :表名(字符串,必需)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

  • 优化清单

    • 优化 Iceberg 表的清单文件

    • 参数:

      • table :表名(字符串,必需)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

  • 过期快照

    • 从 Iceberg 表中删除旧快照

    • 参数:

      • table :表名(字符串,必需)

      • retention_threshold :年龄阈值(例如“7d”)(字符串,可选)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

Iceberg 元数据检查

  • 显示表属性

    • 显示 Iceberg 表属性

    • 参数:

      • table :表名(字符串,必需)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

  • 显示表历史记录

    • 显示 Iceberg 表历史记录/更新日志

    • 包含快照时间、谱系和祖先信息

    • 参数:

      • table :表名(字符串,必需)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

  • 显示元数据日志条目

    • 显示 Iceberg 表元数据日志条目

    • 包含元数据文件位置和序列信息

    • 参数:

      • table :表名(字符串,必需)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

  • 显示快照

    • 显示 Iceberg 表快照

    • 包含快照详细信息,包括操作和清单文件

    • 参数:

      • table :表名(字符串,必需)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

  • 显示清单

    • 显示当前或所有快照的 Iceberg 表清单

    • 包含清单文件详细信息和数据文件统计信息

    • 参数:

      • table :表名(字符串,必需)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

      • all_snapshots :包含所有快照(布尔值,可选)

  • 显示分区

    • 显示 Iceberg 表分区

    • 包含分区统计信息和文件计数

    • 参数:

      • table :表名(字符串,必需)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

  • 显示文件

    • 显示当前快照中的 Iceberg 表数据文件

    • 包含详细的文件元数据和列统计信息

    • 参数:

      • table :表名(字符串,必需)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

  • 显示条目

    • 显示当前或所有快照的 Iceberg 表清单条目

    • 包含条目状态和详细文件指标

    • 参数:

      • table :表名(字符串,必需)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

      • all_snapshots :包含所有快照(布尔值,可选)

  • 显示参考

    • 显示 Iceberg 表引用(分支和标签)

    • 包含参考配置和快照映射

    • 参数:

      • table :表名(字符串,必需)

      • catalog :目录名称(字符串,可选)

      • schema :架构名称(字符串,可选)

查询历史记录

  • 显示查询历史记录

    • 获取已执行查询的历史记录

    • 参数:

      • limit :返回的最大查询数(数字,可选)

执照

本项目遵循 Apache 2.0 许可证。请参阅许可证文件以了解完整条款。

Available Tools

22 tools
describe_tableC

Describe a table

Inputs: catalog (required), schema_name (required), table (required). Returns: result

execute_queryC

Execute a SQL query and return results in a readable format

Inputs: query (required). Returns: result

expire_snapshotsB

Remove old snapshots from an Iceberg table

Inputs: catalog (required), schema_name (required), table (required), retention_threshold. Returns: result

optimizeB

Optimize an Iceberg table's data files

Inputs: catalog (required), schema_name (required), table (required). Returns: result

optimize_manifestsC

Optimize manifest files for an Iceberg table

Inputs: catalog (required), schema_name (required), table (required). Returns: result

show_catalogsB

List all available catalogs

Inputs: no named parameters. Returns: result

show_catalog_treeA

Show a hierarchical tree view of catalogs, schemas, and tables

Inputs: no named parameters. Returns: result

show_create_tableA

Show the CREATE TABLE statement for a specific table

Inputs: catalog (required), schema_name (required), table (required). Returns: result

show_create_viewB

Show the CREATE VIEW statement for a specific view

Inputs: catalog (required), schema_name (required), view (required). Returns: result

show_entriesC

Show Iceberg table manifest entries

Inputs: catalog (required), schema_name (required), table (required), all_snapshots. Returns: result

show_filesC

Show Iceberg table data files

Inputs: catalog (required), schema_name (required), table (required). Returns: result

show_manifestsC

Show Iceberg table manifests

Inputs: catalog (required), schema_name (required), table (required), all_snapshots. Returns: result

show_metadata_log_entriesC

Show metadata for the table

Inputs: catalog (required), schema_name (required), table (required). Returns: result

show_partitionsB

Show Iceberg table partitions

Inputs: catalog (required), schema_name (required), table (required). Returns: result

show_query_historyB

Get the history of executed queries

Inputs: limit. Returns: result

show_refsA

Show Iceberg table references (branches and tags)

Inputs: catalog (required), schema_name (required), table (required). Returns: result

show_schemasB

List all schemas in a catalog

Inputs: catalog (required). Returns: result

show_snapshotsC

Show Iceberg table snapshots

Inputs: catalog (required), schema_name (required), table (required). Returns: result

show_statsC

Show statistics for a table

Inputs: catalog (required), schema_name (required), table (required). Returns: result

show_table_historyC

Show Iceberg table history/changelog

Inputs: catalog (required), schema_name (required), table (required). Returns: result

show_table_propertiesC

Show Iceberg table properties

Inputs: catalog (required), schema_name (required), table (required). Returns: result

show_tablesB

List all tables in a schema

Inputs: catalog (required), schema_name (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 22 tools

    Disambiguation4/5

    Most tools have distinct purposes, especially the 'show_' variants which target different Iceberg metadata. However, some concepts like show_table_history, show_metadata_log_entries, and show_snapshots overlap conceptually, causing minor potential confusion.

    Naming Consistency4/5

    All tools follow a verb_noun pattern with underscores, which is consistent. The verbs vary (show, describe, execute, expire, optimize) but are clear and appropriate, though a fully uniform verb set would improve consistency.

    Tool Count4/5

    22 tools is on the higher side but remains reasonable given the dual focus on general Trino queries and detailed Iceberg management. The scope justifies the count, though it could be split into two servers for clarity.

    Completeness4/5

    The tool set covers core query operations and comprehensive Iceberg maintenance (snapshots, files, optimization, history). Missing DDL commands like create/drop table or schema are notable gaps but align with the server's apparent administrative/analytical focus.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that provides a SQL interface for querying and managing Apache Iceberg tables through Claude desktop, allowing natural language interaction with Iceberg data lakes.
      1
      8
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server providing seamless integration with Trino and Iceberg for advanced data exploration, querying, and table maintenance.
      Apache 2.0
    • A
      license
      B
      quality
      D
      maintenance
      Model Context Protocol server for read-only access to Iceberg tables through Cloudera Trino: schema discovery, SQL queries, metadata-based health checks, time travel, and performance analysis.
      17
      3
      Apache 2.0