Trino MCP Server
About
A Go implementation of a Model Context Protocol (MCP) server for Trino, enabling LLM models to query distributed SQL databases through standardized tools.
Details
- Author
- tuannvm
- GitHub stars
- 114
- Downloads
- 325
- Categories
- Database, Community, Other
Jump to
- Dual mode: works as MCP server and interactive CLI
- Supports STDIO and HTTP (StreamableHTTP) transports
- OAuth 2.1 authentication via oauth-mcp-proxy library
- Trino SQL query execution through MCP tools
- Catalog, schema, and table discovery
- Docker container support
Install via Homebrew or the one-liner script. Set environment variables (TRINO_HOST, TRINO_USER), then run mcp-trino. Use --interactive for REPL mode, or configure it as an MCP server with STDIO or HTTP transport.
Trino MCP Server in Go
A high-performance Model Context Protocol (MCP) server for Trino implemented in Go. This project enables AI assistants to seamlessly interact with Trino's distributed SQL query engine through standardized MCP tools.
Overview
This project implements a Model Context Protocol (MCP) server for Trino in Go. It enables AI assistants to access Trino's distributed SQL query engine through standardized MCP tools.
Trino (formerly PrestoSQL) is a powerful distributed SQL query engine designed for fast analytics on large datasets.
Architecture
graph TB
subgraph "AI Clients"
CC[Claude Code]
CD[Claude Desktop]
CR[Cursor]
WS[Windsurf]
CW[ChatWise]
end
subgraph "Authentication (Optional)"
OP[OAuth Provider<br/>Okta/Google/Azure AD]
JWT[JWT Tokens]
end
subgraph "MCP Server (mcp-trino)"
HTTP[HTTP Transport<br/>/mcp endpoint]
STDIO[STDIO Transport]
AUTH[OAuth Middleware]
TOOLS[MCP Tools<br/>• execute_query<br/>• list_catalogs<br/>• list_schemas<br/>• list_tables<br/>• get_table_schema<br/>• explain_query]
end
subgraph "Data Layer"
TRINO[Trino Cluster<br/>Distributed SQL Engine]
CATALOGS[Data Sources<br/>• PostgreSQL<br/>• MySQL<br/>• S3/Hive<br/>• BigQuery<br/>• MongoDB]
end
%% Connections
CC -.->|OAuth Flow| OP
OP -.->|JWT Token| JWT
CC -->|HTTP + JWT| HTTP
CD -->|STDIO| STDIO
CR -->|HTTP + JWT| HTTP
WS -->|STDIO| STDIO
CW -->|HTTP + JWT| HTTP
HTTP --> AUTH
AUTH -->|Validated| TOOLS
STDIO --> TOOLS
TOOLS -->|SQL Queries| TRINO
TRINO --> CATALOGS
%% Styling
classDef client fill:#e1f5fe
classDef auth fill:#f3e5f5
classDef server fill:#e8f5e8
classDef data fill:#fff3e0
class CC,CD,CR,WS,CW client
class OP,JWT auth
class HTTP,STDIO,AUTH,TOOLS server
class TRINO,CATALOGS data
Key Components:
- AI Clients: Various MCP-compatible applications
- Authentication: Optional OAuth 2.0 with OIDC providers
- MCP Server: Go-based server with dual transport support
- CLI Mode: Interactive SQL shell for direct Trino access (psql-like)
- Data Layer: Trino cluster connecting to multiple data sources
Features
- ✅ Dual Mode: Works as both MCP server AND interactive CLI
- CLI Mode: psql-like interactive SQL shell for direct Trino access
- MCP Mode: Full MCP server for AI assistant integration
- ✅ MCP server implementation in Go
- ✅ Trino SQL query execution through MCP tools
- ✅ Catalog, schema, and table discovery
- ✅ Docker container support
- ✅ Supports both STDIO and HTTP transports
- ✅ OAuth 2.1 authentication via oauth-mcp-proxy library
- 4 Providers: HMAC, Okta, Google, Azure AD
- Native mode: Client handles OAuth directly (zero server-side secrets)
- Proxy mode: Server proxies OAuth flow for simple clients
- Production-ready: Token caching, PKCE, defense-in-depth security
- Reusable: OAuth library available for any Go MCP server
- ✅ StreamableHTTP support with JWT authentication (upgraded from SSE)
- ✅ Backward compatibility with SSE endpoints
- ✅ Compatible with Cursor, Claude Desktop, Windsurf, ChatWise, and any MCP-compatible clients.
- ✅ User Identity Tracking:
- Query Attribution (automatic): Tags queries with OAuth user via X-Trino-Client-Tags/Info headers
- User Impersonation (opt-in): Execute queries as OAuth user via X-Trino-User header
Installation & Quick Start
Install:
```bash
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





