Trino

MCP Server for Trino
  • python

10

GitHub Stars

python

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs

You run a Trino MCP Server that exposes Trino’s distributed SQL as MCP endpoints, letting AI tools and LLMs query and analyze data. It provides both a REST API option via a Docker-based container and a standalone Python API, enabling flexible deployments and integration with language models.

How to use

You can access Trino data through two MCP interfaces. First, you can query via the REST API exposed by the Docker container on port 9097. Second, you can run the standalone Python API server locally on port 8008 to execute SQL queries from LLMs or scripts. Use the REST API to send SQL queries to Trino and receive structured results, or run the standalone API to let your language models call /query directly.

How to install

Prerequisites: you need Docker and Python available on your machine.

Install and run using the Docker-based MCP server and its API:

# Start the server with docker-compose
docker-compose up -d

# Verify the API is working
curl -X POST "http://localhost:9097/api/query" \
     -H "Content-Type: application/json" \
     -d '{"query": "SELECT 1 AS test"}'

If you prefer a standalone Python API server (no container), run the server on port 8008:

# Run the standalone API server on port 8008
python llm_trino_api.py

Standalone API endpoints available once running:

GET http://localhost:8008/
POST http://localhost:8008/query

Additional sections

Security, configuration, and troubleshooting details are provided to help you operate the MCP server robustly.

Environment and tools for LLM integration are described to enable direct SQL generation, query execution, and result interpretation.

Troubleshooting

If you encounter API errors or connectivity problems, verify container status, restart services, and confirm Trino is reachable. For the Docker-based API, ensure you rebuilt the container with the latest code if you see 503 responses.

For the standalone API, if port conflicts arise, adjust the port in the startup command and re-run the server.

Notes on known issues and fixes

The Docker container API had a fixed initialization issue to ensure the app context and Trino client connect properly on startup. If you see initialization or health-check failures, rebuild the container to pull in the latest changes.

STDIO transport is the recommended testing transport for development. SSE transport is not recommended due to current stability issues.

Examples and tooling

You can use helper scripts to generate data, load it into Trino, and run complex MCP queries. These tools illustrate end-to-end MCP usage with the Trino backend.

Accessing the API

Two API options exist for querying Trino via MCP. Use the Docker Container API when running in containerized setups and the Standalone Python API for flexible local deployments.

Usage patterns and capabilities

LLMs can generate SQL queries, submit them to the MCP server, and receive structured results. The server enables schema discovery, complex analytical queries, and data interpretation through API endpoints.

Available tools

llm_trino_api

Standalone API server for LLM integration; lets you call the MCP server's /query endpoint from code or prompts.

llm_query_trino

Command-line tool to perform direct Trino queries from an LLM-friendly interface.

test_bullshit_query

Script demonstrating a complex MCP query against a generated bullshit dataset to verify end-to-end MCP operation.

load_bullshit_data

Script to generate and load a synthetic dataset into Trino for testing MCP capabilities.

test_mcp_stdio

STDIO transport-based test script to initialize the MCP protocol and run queries against Trino through MCP.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational