Skip to content
Back to search

mcp-trino

A high-performance Model Context Protocol (MCP) server for Trino implemented in Go.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/tuannvm--mcp-trino/badge.svg)](/listings/tuannvm--mcp-trino)

HTML

<a href="/listings/tuannvm--mcp-trino"><img src="/api/listings/tuannvm--mcp-trino/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

These steps run a script from the network that findsafeskills does not scan.

**Install:**

# Homebrew
brew install tuannvm/mcp/mcp-trino

# Or one-liner (macOS/Linux)
curl -fsSL https://raw.githubusercontent.com/tuannvm/mcp-trino/main/install.sh | bash

**Run (Local Development):**

export TRINO_HOST=localhost TRINO_USER=trino
mcp-trino

For production deployment with OAuth, see [Deployment Guide](docs/deployment.md) and [OAuth Architecture](docs/oauth.md).

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 22 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. {
  2. "$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
  3. "name": "mcp-trino",
  4. "version": "1.0.0",
  5. "description": "MCP server for Trino distributed SQL query engine",
  6. "owner": {
  7. "name": "Tommy Nguyen",
  8. "email": "tuannvm@users.noreply.github.com"
  9. },
  10. "plugins": [
  11. {
  12. "name": "mcp-trino",
  13. "description": "A high-performance MCP server for Trino distributed SQL query engine",
  14. "version": "4.2.0",
  15. "source": ".",
  16. "category": "development",
  17. "author": {
  18. "name": "Tommy Nguyen"
  19. }
  20. }
  21. ]
  22. }
README.md · README · 433 lines · 1 finding marked

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Trino MCP Server in Go
  2. 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.
  3. [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/tuannvm/mcp-trino/build.yml?branch=main&label=CI%2FCD&logo=github)](https://github.com/tuannvm/mcp-trino/actions/workflows/build.yml)
  4. [![Go Version](https://img.shields.io/github/go-mod/go-version/tuannvm/mcp-trino?logo=go)](https://github.com/tuannvm/mcp-trino/blob/main/go.mod)
  5. [![Trivy Scan](https://img.shields.io/github/actions/workflow/status/tuannvm/mcp-trino/build.yml?branch=main&label=Trivy%20Security%20Scan&logo=aquasec)](https://github.com/tuannvm/mcp-trino/actions/workflows/build.yml)
  6. [![SLSA 3](https://slsa.dev/images/gh-badge-level3.svg)](https://slsa.dev)
  7. [![Go Report Card](https://goreportcard.com/badge/github.com/tuannvm/mcp-trino)](https://goreportcard.com/report/github.com/tuannvm/mcp-trino)
  8. [![Go Reference](https://pkg.go.dev/badge/github.com/tuannvm/mcp-trino.svg)](https://pkg.go.dev/github.com/tuannvm/mcp-trino)
  9. [![Docker Image](https://img.shields.io/github/v/release/tuannvm/mcp-trino?sort=semver&label=GHCR&logo=docker)](https://github.com/tuannvm/mcp-trino/pkgs/container/mcp-trino)
  10. [![GitHub Release](https://img.shields.io/github/v/release/tuannvm/mcp-trino?sort=semver)](https://github.com/tuannvm/mcp-trino/releases/latest)
  11. [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
  12. [![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/tuannvm/mcp-trino)](https://archestra.ai/mcp-catalog/tuannvm__mcp-trino)
  13. ## Overview
  14. 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.
  15. Trino (formerly PrestoSQL) is a powerful distributed SQL query engine designed for fast analytics on large datasets.
  16. ## Architecture
  17. ```mermaid
  18. graph TB
  19. subgraph "AI Clients"
  20. CC[Claude Code]
  21. CD[Claude Desktop]
  22. CR[Cursor]
  23. WS[Windsurf]
  24. CW[ChatWise]
  25. end
  26. subgraph "Authentication (Optional)"
  27. OP[OAuth Provider<br/>Okta/Google/Azure AD]
  28. JWT[JWT Tokens]
  29. end
  30. subgraph "MCP Server (mcp-trino)"
  31. HTTP[HTTP Transport<br/>/mcp endpoint]
  32. STDIO[STDIO Transport]
  33. AUTH[OAuth Middleware]
  34. TOOLS[MCP Tools<br/>• execute_query<br/>• list_catalogs<br/>• list_schemas<br/>• list_tables<br/>• get_table_schema<br/>• explain_query]
  35. end
  36. subgraph "Data Layer"
  37. TRINO[Trino Cluster<br/>Distributed SQL Engine]
  38. CATALOGS[Data Sources<br/>• PostgreSQL<br/>• MySQL<br/>• S3/Hive<br/>• BigQuery<br/>• MongoDB]
  39. end
  40. %% Connections
  41. CC -.->|OAuth Flow| OP
  42. OP -.->|JWT Token| JWT
  43. CC -->|HTTP + JWT| HTTP
  44. CD -->|STDIO| STDIO
  45. CR -->|HTTP + JWT| HTTP
  46. WS -->|STDIO| STDIO
  47. CW -->|HTTP + JWT| HTTP
  48. HTTP --> AUTH
  49. AUTH -->|Validated| TOOLS
  50. STDIO --> TOOLS
  51. TOOLS -->|SQL Queries| TRINO
  52. TRINO --> CATALOGS
  53. %% Styling
  54. classDef client fill:#e1f5fe
  55. classDef auth fill:#f3e5f5
  56. classDef server fill:#e8f5e8
  57. classDef data fill:#fff3e0
  58. class CC,CD,CR,WS,CW client
  59. class OP,JWT auth
  60. class HTTP,STDIO,AUTH,TOOLS server
  61. class TRINO,CATALOGS data
  62. ```
  63. **Key Components:**
  64. - **AI Clients**: Various MCP-compatible applications
  65. - **Authentication**: Optional OAuth 2.0 with OIDC providers
  66. - **MCP Server**: Go-based server with dual transport support
  67. - **CLI Mode**: Interactive SQL shell for direct Trino access (psql-like)
  68. - **Data Layer**: Trino cluster connecting to multiple data sources
  69. ## Features
  70. - ✅ **Dual Mode**: Works as both MCP server AND interactive CLI
  71. - **CLI Mode**: psql-like interactive SQL shell for direct Trino access
  72. - **MCP Mode**: Full MCP server for AI assistant integration
  73. - ✅ MCP server implementation in Go
  74. - ✅ Trino SQL query execution through MCP tools
  75. - ✅ Catalog, schema, and table discovery
  76. - ✅ Docker container support
  77. - ✅ Supports both STDIO and HTTP transports
  78. - ✅ OAuth 2.1 authentication via [oauth-mcp-proxy](https://github.com/tuannvm/oauth-mcp-proxy) library
  79. - **4 Providers**: HMAC, Okta, Google, Azure AD
  80. - **Native mode**: Client handles OAuth directly (zero server-side secrets)
  81. - **Proxy mode**: Server proxies OAuth flow for simple clients
  82. - **Production-ready**: Token caching, PKCE, defense-in-depth security
  83. - **Reusable**: OAuth library available for any Go MCP server
  84. - ✅ StreamableHTTP support with JWT authentication (upgraded from SSE)
  85. - ✅ Backward compatibility with SSE endpoints
  86. - ✅ Compatible with Cursor, Claude Desktop, Windsurf, ChatWise, and any MCP-compatible clients.
  87. - ✅ User Identity Tracking:
  88. - **Query Attribution** (automatic): Tags queries with OAuth user via `X-Trino-Client-Tags/Info` headers
  89. - **User Impersonation** (opt-in): Execute queries as OAuth user via `X-Trino-User` header
  90. ## Installation & Quick Start
  91. **Install:**
  92. ```bash
  93. # Homebrew
  94. brew install tuannvm/mcp/mcp-trino
  95. # Or one-liner (macOS/Linux)
  96. curl -fsSL https://raw.githubusercontent.com/tuannvm/mcp-trino/main/install.sh | bash
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 121 on GitHub
  97. ```
  98. **Run (Local Development):**
  99. ```bash
  100. export TRINO_HOST=localhost TRINO_USER=trino
  101. mcp-trino
  102. ```
  103. For production deployment with OAuth, see [Deployment Guide](docs/deployment.md) and [OAuth Architecture](docs/oauth.md).
  104. ## CLI Mode
  105. mcp-trino can be used as an interactive CLI similar to `psql` or the Trino CLI:
  106. ```bash
  107. # Interactive REPL mode
  108. mcp-trino --interactive
  109. # Execute a query directly
  110. mcp-trino query "SELECT * FROM my_table LIMIT 10"
  111. # List catalogs, schemas, tables
  112. mcp-trino catalogs
  113. mcp-trino schemas my_catalog
  114. mcp-trino tables my_catalog my_schema
  115. # Describe a table
  116. mcp-trino describe my_catalog.my_schema.my_table
  117. # Explain a query
  118. mcp-trino explain "SELECT COUNT(*) FROM my_table"
  119. # Output formats
  120. mcp-trino --format json query "SELECT 1"
  121. mcp-trino --format csv query "SELECT 1"
  122. mcp-trino --format table query "SELECT 1" # default
  123. ```
  124. ### Built-in Help
  125. Every command has structured, LLM-friendly help output:
  126. ```bash
  127. # Main help with all commands, flags, examples, and environment variables
  128. mcp-trino --help
  129. # Per-subcommand help
  130. mcp-trino query --help
  131. mcp-trino describe --help
  132. ```
  133. Help output follows Unix man-page conventions with sections: NAME, SYNOPSIS, DESCRIPTION, COMMANDS, FLAGS, EXAMPLES, ENVIRONMENT, and CONFIGURATION.
  134. ### Exit Codes
  135. | Code | Meaning |
  136. |------|---------|
  137. | 0 | Success |
  138. | 1 | Runtime error (connection failed, query error, etc.) |
  139. | 2 | Usage error (unknown command, invalid flags, missing arguments) |
  140. ### Named Profiles
  141. mcp-trino supports named connection profiles for easy switching between Trino environments.
  142. **Configuration File** — supports both YAML (`~/.config/trino/config.yaml`) and JSON (`~/.config/trino/config.json`):
  143. ```yaml
  144. # ~/.config/trino/config.yaml
  145. current: prod
  146. profiles:
  147. prod:
  148. host: trino.example.com
  149. port: 443
  150. user: prod_user
  151. password: prod_password
  152. catalog: hive
  153. schema: analytics
  154. ssl:
  155. enabled: true
  156. insecure: false
  157. dev:
  158. host: localhost
  159. port: 8080
  160. user: trino
  161. catalog: memory
  162. schema: default
  163. staging:
  164. host: staging-trino.example.com
  165. port: 443
  166. user: staging_user
  167. output:
  168. format: table
  169. ```
  170. Or equivalently in JSON:
  171. ```json
  172. {
  173. "current": "prod",
  174. "profiles": {
  175. "prod": {
  176. "host": "trino.example.com",
  177. "port": 443,
  178. "user": "prod_user",
  179. "catalog": "hive",
  180. "ssl": { "enabled": true }
  181. },
  182. "dev": {
  183. "host": "localhost",
  184. "port": 8080,
  185. "user": "trino"
  186. }
  187. },
  188. "output": { "format": "table" }
  189. }
  190. ```
  191. When both files exist, `config.json` takes precedence. New configs default to JSON.
  192. **Profile Management Commands:**
  193. ```bash
  194. # List all profiles
  195. mcp-trino config profile list
  196. # Set default profile
  197. mcp-trino config profile use prod
  198. # Show profile details
  199. mcp-trino config profile show staging
  200. # Use a specific profile (overrides config file)
  201. mcp-trino --profile dev catalogs
  202. ```
  203. **Configuration Precedence** (highest to lowest):
  204. 1. CLI flags (`--host`, `--port`, etc.)
  205. 2. `--profile` flag
  206. 3. `TRINO_PROFILE` environment variable
  207. 4. `current` field in config file
  208. 5. `default` profile fallback
  209. 6. Environment variables (`TRINO_HOST`, etc.)
  210. **Environment Variables** (lowest priority - overridden by profiles and flags):
  211. ```bash
  212. export TRINO_HOST=trino.example.com
  213. export TRINO_PORT=443
  214. export TRINO_USER=myuser
  215. export TRINO_PASSWORD=mypass
  216. export TRINO_CATALOG=hive
  217. export TRINO_SCHEMA=analytics
  218. export TRINO_SSL=true
  219. ```
  220. **Secret Management** (recommended):
  221. Secrets are loaded purely from environment variables. Use a secrets CLI to inject them via Unix piping at launch time — the app never touches your vault:
  222. ```bash
  223. # 1Password CLI — resolves op:// references in an env file
  224. op run --env-file=.env -- mcp-trino
  225. # Or inline per-variable
  226. TRINO_PASSWORD=$(op read 'op://Engineering/Trino/password') mcp-trino
  227. ```
  228. See [docs/secrets.md](docs/secrets.md) for 1Password, Vault, and Kubernetes patterns, and for security nuances (shell-history, process-list, and env-var leakage).
  229. **REPL Meta-Commands** (in interactive mode):
  230. - `\help` - Show help
  231. - `\quit`, `\exit`, `\q` - Exit REPL
  232. - `\history` - Show command history
  233. - `\catalogs` - List all catalogs
  234. - `\schemas [catalog]` - List schemas
  235. - `\tables [catalog schema]` - List tables
  236. - `\describe <table>` - Describe table
  237. - `\format <table|json|csv>` - Change output format
  238. ## Usage
  239. **Supported Clients:** Claude Desktop, Claude Code, Cursor, Windsurf, ChatWise
  240. **Available Tools:** `execute_query`, `list_catalogs`, `list_schemas`, `list_tables`, `get_table_schema`, `explain_query`
  241. For client integration and tool documentation, see [Integration Guide](docs/integrations.md) and [Tools Reference](docs/tools.md).
  242. ## Configuration
  243. **Key Variables:** `TRINO_HOST`, `TRINO_USER`, `TRINO_SCHEME`, `MCP_TRANSPORT`, `OAUTH_PROVIDER`
  244. **Secret Management:** Inject secrets through the process environment — `mcp-trino` reads them directly. See [docs/secrets.md](docs/secrets.md) for 1Password, Vault, and Kubernetes recipes.
  245. ```bash
  246. # 1Password (biometric-gated, zero disk writes)
  247. op run --env-file=.env -- mcp-trino
  248. # Vault (via vault-agent or CLI)
  249. TRINO_PASSWORD=$(vault kv get -field=password secret/mcp-trino) mcp-trino
  250. # Kubernetes: use standard Secret → envFrom in the Helm chart values
  251. ```
  252. **OAuth Configuration:**
  253. ```bash
  254. # Native mode (most secure - zero server-side secrets)
  255. export OAUTH_ENABLED=true OAUTH_MODE=native OAUTH_PROVIDER=okta
  256. export OIDC_ISSUER=https://company.okta.com OIDC_AUDIENCE=https://mcp-server.com
  257. # Proxy mode (centralized credential management)
  258. export OAUTH_MODE=proxy OIDC_CLIENT_ID=app-id OIDC_CLIENT_SECRET=secret
  259. export OAUTH_REDIRECT_URI=https://mcp-server.com/oauth/callback # Fixed mode (localhost-only)
  260. export OAUTH_REDIRECT_URI=https://app1.com/cb,https://app2.com/cb # Allowlist mode
  261. export JWT_SECRET=$(openssl rand -hex 32) # Required for multi-pod deployments
  262. ```
  263. **Performance Optimization:**
  264. ```bash
  265. # Focus AI on specific schemas only (10-20x performance improvement)
  266. export TRINO_ALLOWED_SCHEMAS="hive.analytics,hive.marts,hive.reporting"
  267. ```
  268. **User Identity Tracking:**
  269. ```bash
  270. # Query Attribution is AUTOMATIC when OAuth is enabled
  271. # Queries are tagged with X-Trino-Client-Tags and X-Trino-Client-Info headers
  272. # For full impersonation (Trino enforces user permissions):
  273. export TRINO_ENABLE_IMPERSONATION=true
  274. export TRINO_IMPERSONATION_FIELD=email # Options: username, email, subject
  275. ```
  276. For complete configuration, see [Deployment Guide](docs/deployment.md), [OAuth Guide](docs/oauth.md), [Allowlists Guide](docs/allowlists.md), and [User Identity Guide](docs/impersonation.md).
  277. ## OAuth Implementation
  278. mcp-trino uses [oauth-mcp-proxy](https://github.com/tuannvm/oauth-mcp-proxy) - a standalone OAuth 2.1 library for Go MCP servers.
  279. **Why a separate library?**
  280. - ✅ Reusable across any Go MCP server
  281. - ✅ Independent testing and versioning
  282. - ✅ Dedicated documentation and examples
  283. - ✅ Community-maintained OAuth implementation
  284. **For OAuth details:**
  285. - [oauth-mcp-proxy Documentation](https://github.com/tuannvm/oauth-mcp-proxy#readme) - Complete OAuth guide
  286. - [Provider Setup Guides](https://github.com/tuannvm/oauth-mcp-proxy/tree/main/docs/providers) - Okta, Google, Azure AD
  287. - [Security Best Practices](https://github.com/tuannvm/oauth-mcp-proxy/blob/main/docs/SECURITY.md) - Production security
  288. ## Contributing
  289. Contributions are welcome! Please feel free to submit a Pull Request.
  290. ## License
  291. This project is licensed under the MIT License - see the LICENSE file for details.
  292. ## Related Projects
  293. - **[oauth-mcp-proxy](https://github.com/tuannvm/oauth-mcp-proxy)** - OAuth 2.1 authentication library used by mcp-trino (reusable for any Go MCP server)
  294. ## CI/CD and Releases
  295. This project uses GitHub Actions for continuous integration and GoReleaser for automated releases.
  296. ### Continuous Integration Checks
  297. Our CI pipeline performs the following checks on all PRs and commits to the main branch:
  298. #### Code Quality
  299. - **Linting**: Using golangci-lint to check for common code issues and style violations
  300. - **Go Module Verification**: Ensuring go.mod and go.sum are properly maintained
  301. - **Formatting**: Verifying code is properly formatted with gofmt
  302. #### Security
  303. - **Vulnerability Scanning**: Using govulncheck to check for known vulnerabilities in dependencies
  304. - **Dependency Scanning**: Using Trivy to scan for vulnerabilities in dependencies (CRITICAL, HIGH, and MEDIUM)
  305. - **SBOM Generation**: Creating a Software Bill of Materials for dependency tracking
  306. - **SLSA Provenance**: Creating verifiable build provenance for supply chain security
  307. #### Testing
  308. - **Unit Tests**: Running tests with race detection and code coverage reporting
  309. - **Build Verification**: Ensuring the codebase builds successfully
  310. #### CI/CD Security
  311. - **Least Privilege**: Workflows run with minimum required permissions
  312. - **Pinned Versions**: All GitHub Actions use specific versions to prevent supply chain attacks
  313. - **Dependency Updates**: Automated dependency updates via Dependabot
  314. ### Release Process
  315. When changes are merged to the main branch:
  316. 1. CI checks are run to validate code quality and security
  317. 2. If successful, a new release is automatically created with:
  318. - Semantic versioning based on commit messages
  319. - Binary builds for multiple platforms
  320. - Docker image publishing to GitHub Container Registry
  321. - SBOM and provenance attestation

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.