MCP HubMCP Hub
Dataring-engineering

mcp-server-trino

by: Dataring-engineering

MCP Server for Trino

13created 10/03/2025
Visit
Trino

📌Overview

Purpose: To provide a server that allows users to interact with Trino for listing and querying tables using the Model-Control-Protocol (MCP) through Python.

Overview: The Trino MCP Server is designed to act as a bridge between AI models, data, and tools via the MCP protocol. It facilitates operations on Trino's distributed SQL query engine, enabling clients to easily access and manipulate big data analytics through Python.

Key Features:

  • MCP Resources Listing: Enables users to list Trino tables as MCP resources, helping them to quickly identify the available data for querying.

  • Table Content Reading: Allows users to read contents directly from the tables through the MCP interface, simplifying data access.

  • Arbitrary SQL Query Execution: Provides a tool to execute any SQL queries against the Trino database, offering flexibility for advanced data manipulation.


Trino MCP Server

This repository provides an MCP (Model-Control-Protocol) server that allows you to list and query tables via Trino using Python.

Overview

  • MCP: A protocol for bridging AI models, data, and tools. This MCP server provides:
    • A list of Trino tables as MCP resources
    • The ability to read table contents through MCP
    • A tool for executing arbitrary SQL queries against Trino
  • Trino: A fast, distributed SQL query engine for big data analytics. This server uses Trino’s Python client (trino.dbapi) to connect to a Trino host, catalog, and schema.

Requirements

  • Python 3.9+ (or a compatible version)
  • trino (Python driver for Trino)
  • mcp (Model-Control-Protocol Python library)

Configuration

The server reads Trino connection details from environment variables:

VariableDescriptionDefault
TRINO_HOSTTrino server hostname or IPlocalhost
TRINO_PORTTrino server port8080
TRINO_USERTrino user namerequired
TRINO_PASSWORDTrino password (optional, depends on your authentication setup)(empty)
TRINO_CATALOGDefault catalog (e.g., hive, tpch, postgresql)required
TRINO_SCHEMADefault schema (e.g., default, public)required

Usage

{
  "mcpServers": {
    "trino": {
      "command": "uv",
      "args": [
        "--directory", 
        "<path_to_mcp_server_trino>",
        "run",
        "mcp_server_trino"
      ],
      "env": {
        "TRINO_HOST": "<host>",
        "TRINO_PORT": "<port>",
        "TRINO_USER": "<user>",
        "TRINO_PASSWORD": "<password>",
        "TRINO_CATALOG": "<catalog>",
        "TRINO_SCHEMA": "<schema>"
      }
    }
  }
}