development
location
documentation
public
MCP
Trino
Go
What is A high-performance Model Context Protocol (MCP) server for Trino implemented in Go.?
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.
Documentation
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]
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
Data Layer: Trino cluster connecting to multiple data sources
Features
✅ 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.0 authentication with OIDC provider support (Okta, Google, Azure AD)
✅ 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.
Installation# Quick Install (One-liner)
For macOS and Linux, install with a single command:
Note: The host.docker.internal special DNS name allows the container to connect to services running on the host machine. If your Trino server is running elsewhere, replace with the appropriate host.
This Docker configuration can be used in any of the below applications.
Cursor
To use with Cursor, create or edit ~/.cursor/mcp.json:
To use with Claude Desktop, the easiest way is to use the install script which will automatically configure it for you. Alternatively, you can manually edit your Claude configuration file:
The server will automatically start with HTTPS when certificate files are provided.
Remote MCP Server Deployment
Since the server supports JWT authentication and HTTP transport, you can deploy it as a remote MCP server accessible to multiple clients over the network.
The server can be configured using the following environment variables:
Variable
Description
Default
TRINO_HOST
Trino server hostname
localhost
TRINO_PORT
Trino server port
8080
TRINO_USER
Trino user
trino
TRINO_PASSWORD
Trino password
(empty)
TRINO_CATALOG
Default catalog
memory
TRINO_SCHEMA
Default schema
default
TRINO_SCHEME
Connection scheme (http/https)
https
TRINO_SSL
Enable SSL
true
TRINO_SSL_INSECURE
Allow insecure SSL
true
TRINO_ALLOW_WRITE_QUERIES
Allow non-read-only SQL queries
false
TRINO_QUERY_TIMEOUT
Query timeout in seconds
30
MCP_TRANSPORT
Transport method (stdio/http)
stdio
MCP_PORT
HTTP port for http transport
8080
MCP_HOST
Host for HTTP callbacks
localhost
TRINO_OAUTH_ENABLED
Enable OAuth authentication
false
OAUTH_PROVIDER
OAuth provider (hmac/okta/google/azure)
hmac
JWT_SECRET
JWT secret for HMAC mode
(empty)
OIDC_ISSUER
OIDC provider issuer URL
(empty)
OIDC_AUDIENCE
OIDC audience identifier
(empty)
OIDC_CLIENT_ID
OIDC client ID
(empty)
HTTPS_CERT_FILE
Path to HTTPS certificate file
(empty)
HTTPS_KEY_FILE
Path to HTTPS private key file
(empty)
Note: When TRINO_SCHEME is set to "https", TRINO_SSL is automatically set to true regardless of the provided value.
Important: The default connection mode is HTTPS. If you're using an HTTP-only Trino server, you must set TRINO_SCHEME=http in your environment variables.
Security Note: By default, only read-only queries (SELECT, SHOW, DESCRIBE, EXPLAIN) are allowed to prevent SQL injection. If you need to execute write operations or other non-read queries, set TRINO_ALLOW_WRITE_QUERIES=true, but be aware this bypasses this security protection.
For Web Client Integration: When using with web clients, set MCP_TRANSPORT=http and connect to the /mcp endpoint for StreamableHTTP support. The /sse endpoint is maintained for backward compatibility.
OAuth Authentication: When TRINO_OAUTH_ENABLED=true, the server supports multiple OAuth providers including OIDC-compliant providers (Okta, Google, Azure AD) for production use and HMAC mode for development/testing.
HTTPS Support: For production deployments, configure HTTPS by setting HTTPS_CERT_FILE and HTTPS_KEY_FILE environment variables. This is strongly recommended when using JWT authentication.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
CI/CD and Releases
This project uses GitHub Actions for continuous integration and GoReleaser for automated releases.
Continuous Integration Checks
Our CI pipeline performs the following checks on all PRs and commits to the main branch:
Code Quality
Linting: Using golangci-lint to check for common code issues and style violations
Go Module Verification: Ensuring go.mod and go.sum are properly maintained
Formatting: Verifying code is properly formatted with gofmt
Security
Vulnerability Scanning: Using govulncheck to check for known vulnerabilities in dependencies
Dependency Scanning: Using Trivy to scan for vulnerabilities in dependencies (CRITICAL, HIGH, and MEDIUM)
SBOM Generation: Creating a Software Bill of Materials for dependency tracking
SLSA Provenance: Creating verifiable build provenance for supply chain security
Testing
Unit Tests: Running tests with race detection and code coverage reporting
Build Verification: Ensuring the codebase builds successfully
CI/CD Security
Least Privilege: Workflows run with minimum required permissions
Pinned Versions: All GitHub Actions use specific versions to prevent supply chain attacks
Dependency Updates: Automated dependency updates via Dependabot
Release Process
When changes are merged to the main branch:
CI checks are run to validate code quality and security
If successful, a new release is automatically created with:
Semantic versioning based on commit messages
Binary builds for multiple platforms
Docker image publishing to GitHub Container Registry