
Mcp Trino
io.github.tuannvm由 GitHub 帳號 tuannvm 發布v2.2.1更新於 Oct 24, 2026
MCP server for Trino distributed SQL query engine access
概覽
讓 AI 助理在 Trino 分散式 SQL 引擎上執行 SQL 查詢,並瀏覽 catalog、schema 與資料表。
- 可以做什麼
- 此 MCP 伺服器將助理連接到 Trino 叢集,使其能執行 SQL 查詢並檢視資料結構。其工具包括 execute_query、list_catalogs、list_schemas、list_tables、get_table_schema 與 explain_query。它也可作為互動式 CLI 直接查詢,並支援選用的 OAuth 2.1 驗證與使用者身分追蹤。
- 適用情境
- 當助理需要查詢或探索 Trino 中的資料,或 Trino 所聯合的底層資料來源(如 PostgreSQL、MySQL、S3/Hive、BigQuery、MongoDB)時使用。適合需要助理執行 SQL 並檢視資料表結構的分析與資料探索情境。
- 執行需求
- 以本機程序在使用者機器上執行(僅限桌面端)。需要可連線的 Trino 伺服器與認證:TRINO_HOST 與 TRINO_USER 為必填,TRINO_PASSWORD 為密鑰,TRINO_PORT 為選填。需要連線至 Trino 叢集的網路。HTTP 部署可選用 OAuth 設定。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mcp Trino,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
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.
[GitHub Workflow Status] [Go Version] [Trivy Scan] [SLSA 3] [Go Report Card] [Go Reference] [Docker Image] [GitHub Release] [License: MIT]
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
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/Infoheaders - User Impersonation (opt-in): Execute queries as OAuth user via
X-Trino-Userheader
- Query Attribution (automatic): Tags queries with OAuth user via
Installation & Quick Start
Install:
Run (Local Development):
For production deployment with OAuth, see Deployment Guide and OAuth Architecture.
CLI Mode
mcp-trino can be used as an interactive CLI similar to psql or the Trino CLI:
Built-in Help
Every command has structured, LLM-friendly help output:
Help output follows Unix man-page conventions with sections: NAME, SYNOPSIS, DESCRIPTION, COMMANDS, FLAGS, EXAMPLES, ENVIRONMENT, and CONFIGURATION.
Exit Codes
Named Profiles
mcp-trino supports named connection profiles for easy switching between Trino environments.
Configuration File — supports both YAML (~/.config/trino/config.yaml) and JSON (~/.config/trino/config.json):
Or equivalently in JSON:
When both files exist, config.json takes precedence. New configs default to JSON.
Profile Management Commands:
Configuration Precedence (highest to lowest):
- CLI flags (
--host,--port, etc.) --profileflagTRINO_PROFILEenvironment variablecurrentfield in config filedefaultprofile fallback- Environment variables (
TRINO_HOST, etc.)
Environment Variables (lowest priority - overridden by profiles and flags):
Secret Management (recommended):
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:
See docs/secrets.md for 1Password, Vault, and Kubernetes patterns, and for security nuances (shell-history, process-list, and env-var leakage).
REPL Meta-Commands (in interactive mode):
\help- Show help\quit,\exit,\q- Exit REPL\history- Show command history\catalogs- List all catalogs\schemas [catalog]- List schemas\tables [catalog schema]- List tables\describe <table>- Describe table\format <table|json|csv>- Change output format
Usage
Supported Clients: Claude Desktop, Claude Code, Cursor, Windsurf, ChatWise
Available Tools: execute_query, list_catalogs, list_schemas, list_tables, get_table_schema, explain_query
For client integration and tool documentation, see Integration Guide and Tools Reference.
Configuration
Key Variables: TRINO_HOST, TRINO_USER, TRINO_SCHEME, MCP_TRANSPORT, OAUTH_PROVIDER
Secret Management: Inject secrets through the process environment — mcp-trino reads them directly. See docs/secrets.md for 1Password, Vault, and Kubernetes recipes.
OAuth Configuration:
Performance Optimization:
User Identity Tracking:
For complete configuration, see Deployment Guide, OAuth Guide, Allowlists Guide, and User Identity Guide.
OAuth Implementation
mcp-trino uses oauth-mcp-proxy - a standalone OAuth 2.1 library for Go MCP servers.
Why a separate library?
- ✅ Reusable across any Go MCP server
- ✅ Independent testing and versioning
- ✅ Dedicated documentation and examples
- ✅ Community-maintained OAuth implementation
For OAuth details:
- oauth-mcp-proxy Documentation - Complete OAuth guide
- Provider Setup Guides - Okta, Google, Azure AD
- Security Best Practices - Production security
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.
Related Projects
- oauth-mcp-proxy - OAuth 2.1 authentication library used by mcp-trino (reusable for any Go MCP server)
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
- SBOM and provenance attestation
來源:README.md,提交 3e0be00
工具
0版本歷史
1- v2.2.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分