Purpose
mcp-trino is a Model Context Protocol (MCP) server written in Go, designed for the Trino (formerly PrestoSQL) distributed SQL query engine. It enables various MCP-compatible AI clients to access Trino through standardized MCP tools, allowing for fast analytical queries on large datasets.
Main Capabilities
- Dual mode: It can be used both as an MCP server and as an interactive CLI. CLI mode provides a psql-like interactive SQL shell with direct access to Trino; MCP mode provides full MCP server functionality for AI assistant integration.
- Execute Trino SQL queries through MCP tools.
- Discovery capabilities for catalogs, schemas, and tables.
- Supports both STDIO and HTTP transports.
- Supports StreamableHTTP and JWT authentication (upgraded from SSE), while remaining backward compatible with SSE endpoints.
- Optional OAuth 2.1 authentication (based on the oauth-mcp-proxy library), supporting four providers: HMAC, Okta, Google, and Azure AD; supports Native mode (the client handles OAuth directly, with zero secrets on the server) and Proxy mode (the server proxies the OAuth flow).
- User identity tracking: automatic query attribution (marking OAuth users via X-Trino-Client-Tags/Info headers) and optional user impersonation (executing queries as the OAuth user via the X-Trino-User header).
- Docker container support.
- Supports named connection profiles for easy switching between multiple Trino environments; profiles support both YAML (~/.config/trino/config.yaml) and JSON (~/.config/trino/config.json), with JSON taking precedence when both are present.
- Provides structured, LLM-oriented help output for each command, following Unix man-page conventions (NAME, SYNOPSIS, DESCRIPTION, COMMANDS, FLAGS, EXAMPLES, ENVIRONMENT, CONFIGURATION).
Usage
Can be used as an interactive CLI (similar to psql or the Trino CLI). REPL meta-commands include: \help, \quit/\exit/\q, \history, \catalogs, \schemas [catalog], \tables [catalog schema], \describe <table>, \format <table|json|csv>. Configuration priority from highest to lowest: CLI flags (--host, --port, etc.) → TRINO_PROFILE environment variable → current field in the configuration file → default profile fallback → environment variables (TRINO_HOST, etc.). For secret management, it is recommended to inject via environment variables, using a secret CLI to inject via Unix pipes at startup; the application itself does not touch the vault; see the 1Password, Vault, and Kubernetes pattern documentation for details. Key environment variables include: TRINO_HOST, TRINO_USER, TRINO_SCHEME, MCP_TRANSPORT, OAUTH_PROVIDER.
Use Cases
Suitable for scenarios where AI assistants need to directly query a Trino data warehouse for data analysis and exploration. Compatible with Claude Desktop, Claude Code, Cursor, Windsurf, ChatWise, and any MCP-compatible client.
Available Tools
execute_query, list_catalogs, list_schemas, list_tables, get_table_schema, explain_query.
Limitations
The materials do not provide specific pricing, billing methods, or performance benchmark data. Complete descriptions of OAuth configuration, deployment details, allow lists, and user identity tracking require reference to the corresponding documentation. The project uses the MIT license.