mcp-server-trino
by: Dataring-engineering
MCP Server for 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:
Variable | Description | Default |
---|---|---|
TRINO_HOST | Trino server hostname or IP | localhost |
TRINO_PORT | Trino server port | 8080 |
TRINO_USER | Trino user name | required |
TRINO_PASSWORD | Trino password (optional, depends on your authentication setup) | (empty) |
TRINO_CATALOG | Default catalog (e.g., hive , tpch , postgresql ) | required |
TRINO_SCHEMA | Default 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>"
}
}
}
}