mcp-trino
Trino MCP 서버 (Go)
Go로 구현된 Trino용 고성능 MCP(Model Context Protocol) 서버입니다. 이 프로젝트를 통해 AI 어시스턴트가 표준화된 MCP 도구를 사용하여 Trino의 분산 SQL 쿼리 엔진과 원활하게 상호 작용할 수 있습니다.
개요
이 프로젝트는 Go로 작성된 Trino용 MCP(Model Context Protocol) 서버를 구현합니다. 이를 통해 AI 어시스턴트가 표준화된 MCP 도구를 사용하여 Trino의 분산 SQL 쿼리 엔진에 접근할 수 있습니다.
Trino(이전 명칭 PrestoSQL)는 대규모 데이터 세트에 대한 빠른 분석을 위해 설계된 강력한 분산 SQL 쿼리 엔진입니다.
Related MCP server: mcp-pprof-anaylzer
아키텍처
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주요 구성 요소:
AI 클라이언트: 다양한 MCP 호환 애플리케이션
인증: OIDC 제공자를 사용하는 선택적 OAuth 2.0
MCP 서버: 이중 전송 지원을 갖춘 Go 기반 서버
CLI 모드: Trino에 직접 접근하기 위한 대화형 SQL 셸 (psql과 유사)
데이터 계층: 여러 데이터 소스에 연결되는 Trino 클러스터
기능
✅ 이중 모드: MCP 서버 및 대화형 CLI로 모두 작동
CLI 모드: Trino에 직접 접근하기 위한 psql 스타일의 대화형 SQL 셸
MCP 모드: AI 어시스턴트 통합을 위한 완전한 MCP 서버
✅ Go로 구현된 MCP 서버
✅ MCP 도구를 통한 Trino SQL 쿼리 실행
✅ 카탈로그, 스키마 및 테이블 검색
✅ Docker 컨테이너 지원
✅ STDIO 및 HTTP 전송 모두 지원
✅ oauth-mcp-proxy 라이브러리를 통한 OAuth 2.1 인증
4가지 제공자: HMAC, Okta, Google, Azure AD
네이티브 모드: 클라이언트가 직접 OAuth 처리 (서버 측 비밀값 없음)
프록시 모드: 서버가 단순 클라이언트를 위해 OAuth 흐름을 프록시 처리
운영 준비 완료: 토큰 캐싱, PKCE, 심층 방어 보안
재사용 가능: 모든 Go MCP 서버에서 사용 가능한 OAuth 라이브러리
✅ JWT 인증을 지원하는 StreamableHTTP (SSE에서 업그레이드)
✅ SSE 엔드포인트와의 하위 호환성
✅ Cursor, Claude Desktop, Windsurf, ChatWise 및 모든 MCP 호환 클라이언트와 호환.
✅ 사용자 식별 추적:
쿼리 속성 지정 (자동):
X-Trino-Client-Tags/Info헤더를 통해 OAuth 사용자로 쿼리 태그 지정사용자 가장 (선택 사항):
X-Trino-User헤더를 통해 OAuth 사용자로 쿼리 실행
설치 및 빠른 시작
설치:
# 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실행 (로컬 개발):
export TRINO_HOST=localhost TRINO_USER=trino
mcp-trinoOAuth를 사용한 운영 배포는 배포 가이드 및 OAuth 아키텍처를 참조하세요.
CLI 모드
mcp-trino는 psql 또는 Trino CLI와 유사한 대화형 CLI로 사용할 수 있습니다:
# Interactive REPL mode
mcp-trino --interactive
# Execute a query directly
mcp-trino query "SELECT * FROM my_table LIMIT 10"
# List catalogs, schemas, tables
mcp-trino catalogs
mcp-trino schemas my_catalog
mcp-trino tables my_catalog my_schema
# Describe a table
mcp-trino describe my_catalog.my_schema.my_table
# Explain a query
mcp-trino explain "SELECT COUNT(*) FROM my_table"
# Output formats
mcp-trino --format json query "SELECT 1"
mcp-trino --format csv query "SELECT 1"
mcp-trino --format table query "SELECT 1" # default내장 도움말
모든 명령어는 LLM 친화적인 구조화된 도움말 출력을 제공합니다:
# Main help with all commands, flags, examples, and environment variables
mcp-trino --help
# Per-subcommand help
mcp-trino query --help
mcp-trino describe --help도움말 출력은 NAME, SYNOPSIS, DESCRIPTION, COMMANDS, FLAGS, EXAMPLES, ENVIRONMENT, CONFIGURATION 섹션으로 구성된 Unix 매뉴얼 페이지 관례를 따릅니다.
종료 코드
코드 | 의미 |
0 | 성공 |
1 | 런타임 오류 (연결 실패, 쿼리 오류 등) |
2 | 사용법 오류 (알 수 없는 명령어, 잘못된 플래그, 누락된 인수) |
명명된 프로필
mcp-trino는 Trino 환경 간의 쉬운 전환을 위해 명명된 연결 프로필을 지원합니다.
구성 파일 — YAML(~/.config/trino/config.yaml) 및 JSON(~/.config/trino/config.json)을 모두 지원합니다:
# ~/.config/trino/config.yaml
current: prod
profiles:
prod:
host: trino.example.com
port: 443
user: prod_user
password: prod_password
catalog: hive
schema: analytics
ssl:
enabled: true
insecure: false
dev:
host: localhost
port: 8080
user: trino
catalog: memory
schema: default
staging:
host: staging-trino.example.com
port: 443
user: staging_user
output:
format: table또는 JSON으로 동일하게 설정:
{
"current": "prod",
"profiles": {
"prod": {
"host": "trino.example.com",
"port": 443,
"user": "prod_user",
"catalog": "hive",
"ssl": { "enabled": true }
},
"dev": {
"host": "localhost",
"port": 8080,
"user": "trino"
}
},
"output": { "format": "table" }
}두 파일이 모두 존재하면 config.json이 우선합니다. 새 구성은 기본적으로 JSON을 사용합니다.
프로필 관리 명령어:
# List all profiles
mcp-trino config profile list
# Set default profile
mcp-trino config profile use prod
# Show profile details
mcp-trino config profile show staging
# Use a specific profile (overrides config file)
mcp-trino --profile dev catalogs구성 우선순위 (높은 순에서 낮은 순):
CLI 플래그 (
--host,--port등)--profile플래그TRINO_PROFILE환경 변수구성 파일의
current필드default프로필 폴백환경 변수 (
TRINO_HOST등)
환경 변수 (가장 낮은 우선순위 - 프로필 및 플래그에 의해 재정의됨):
export TRINO_HOST=trino.example.com
export TRINO_PORT=443
export TRINO_USER=myuser
export TRINO_PASSWORD=mypass
export TRINO_CATALOG=hive
export TRINO_SCHEMA=analytics
export TRINO_SSL=true비밀 관리 (권장):
비밀값은 환경 변수에서만 로드됩니다. 실행 시 Unix 파이핑을 통해 비밀값을 주입하는 비밀 관리 CLI를 사용하세요. 애플리케이션은 볼트에 직접 접근하지 않습니다:
# 1Password CLI — resolves op:// references in an env file
op run --env-file=.env -- mcp-trino
# Or inline per-variable
TRINO_PASSWORD=$(op read 'op://Engineering/Trino/password') mcp-trino1Password, Vault, Kubernetes 패턴 및 보안 주의 사항(셸 기록, 프로세스 목록, 환경 변수 유출)은 docs/secrets.md를 참조하세요.
REPL 메타 명령어 (대화형 모드):
\help- 도움말 표시\quit,\exit,\q- REPL 종료\history- 명령어 기록 표시\catalogs- 모든 카탈로그 나열\schemas [catalog]- 스키마 나열\tables [catalog schema]- 테이블 나열\describe <table>- 테이블 설명\format <table|json|csv>- 출력 형식 변경
사용법
지원되는 클라이언트: Claude Desktop, Claude Code, Cursor, Windsurf, ChatWise
사용 가능한 도구: execute_query, list_catalogs, list_schemas, list_tables, get_table_schema, explain_query
클라이언트 통합 및 도구 문서는 통합 가이드 및 도구 참조를 참조하세요.
구성
주요 변수: TRINO_HOST, TRINO_USER, TRINO_SCHEME, MCP_TRANSPORT, OAUTH_PROVIDER
비밀 관리: 프로세스 환경을 통해 비밀값을 주입하세요. mcp-trino가 직접 읽습니다. 1Password, Vault, Kubernetes 레시피는 docs/secrets.md를 참조하세요.
# 1Password (biometric-gated, zero disk writes)
op run --env-file=.env -- mcp-trino
# Vault (via vault-agent or CLI)
TRINO_PASSWORD=$(vault kv get -field=password secret/mcp-trino) mcp-trino
# Kubernetes: use standard Secret → envFrom in the Helm chart valuesOAuth 구성:
# Native mode (most secure - zero server-side secrets)
export OAUTH_ENABLED=true OAUTH_MODE=native OAUTH_PROVIDER=okta
export OIDC_ISSUER=https://company.okta.com OIDC_AUDIENCE=https://mcp-server.com
# Proxy mode (centralized credential management)
export OAUTH_MODE=proxy OIDC_CLIENT_ID=app-id OIDC_CLIENT_SECRET=secret
export OAUTH_REDIRECT_URI=https://mcp-server.com/oauth/callback # Fixed mode (localhost-only)
export OAUTH_REDIRECT_URI=https://app1.com/cb,https://app2.com/cb # Allowlist mode
export JWT_SECRET=$(openssl rand -hex 32) # Required for multi-pod deployments성능 최적화:
# Focus AI on specific schemas only (10-20x performance improvement)
export TRINO_ALLOWED_SCHEMAS="hive.analytics,hive.marts,hive.reporting"사용자 식별 추적:
# Query Attribution is AUTOMATIC when OAuth is enabled
# Queries are tagged with X-Trino-Client-Tags and X-Trino-Client-Info headers
# For full impersonation (Trino enforces user permissions):
export TRINO_ENABLE_IMPERSONATION=true
export TRINO_IMPERSONATION_FIELD=email # Options: username, email, subject전체 구성은 배포 가이드, OAuth 가이드, 허용 목록 가이드, 사용자 식별 가이드를 참조하세요.
OAuth 구현
mcp-trino는 Go MCP 서버를 위한 독립형 OAuth 2.1 라이브러리인 oauth-mcp-proxy를 사용합니다.
왜 별도의 라이브러리인가요?
✅ 모든 Go MCP 서버에서 재사용 가능
✅ 독립적인 테스트 및 버전 관리
✅ 전용 문서 및 예제
✅ 커뮤니티에서 유지 관리하는 OAuth 구현
OAuth 세부 정보:
oauth-mcp-proxy 문서 - 전체 OAuth 가이드
제공자 설정 가이드 - Okta, Google, Azure AD
보안 모범 사례 - 운영 보안
기여
기여를 환영합니다! 자유롭게 Pull Request를 제출해 주세요.
라이선스
이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 LICENSE 파일을 참조하세요.
관련 프로젝트
oauth-mcp-proxy - mcp-trino에서 사용하는 OAuth 2.1 인증 라이브러리 (모든 Go MCP 서버에서 재사용 가능)
CI/CD 및 릴리스
이 프로젝트는 지속적 통합을 위해 GitHub Actions를, 자동화된 릴리스를 위해 GoReleaser를 사용합니다.
지속적 통합 검사
CI 파이프라인은 모든 PR 및 메인 브랜치 커밋에 대해 다음 검사를 수행합니다:
코드 품질
린팅: golangci-lint를 사용하여 일반적인 코드 문제 및 스타일 위반 검사
Go 모듈 검증: go.mod 및 go.sum이 적절하게 유지되는지 확인
포맷팅: gofmt을 사용하여 코드가 올바르게 포맷되었는지 확인
보안
취약점 스캔: govulncheck를 사용하여 종속성의 알려진 취약점 검사
종속성 스캔: Trivy를 사용하여 종속성의 취약점(CRITICAL, HIGH, MEDIUM) 스캔
SBOM 생성: 종속성 추적을 위한 소프트웨어 자재 명세서(SBOM) 생성
SLSA 출처: 공급망 보안을 위한 검증 가능한 빌드 출처 생성
테스트
단위 테스트: 경합 감지 및 코드 커버리지 보고와 함께 테스트 실행
빌드 검증: 코드베이스가 성공적으로 빌드되는지 확인
CI/CD 보안
최소 권한: 워크플로우는 최소한의 필수 권한으로 실행
고정 버전: 모든 GitHub Actions는 공급망 공격을 방지하기 위해 특정 버전을 사용
종속성 업데이트: Dependabot을 통한 자동화된 종속성 업데이트
릴리스 프로세스
메인 브랜치에 변경 사항이 병합되면:
CI 검사가 실행되어 코드 품질 및 보안 검증
성공 시 다음을 포함하여 새 릴리스가 자동으로 생성됨:
커밋 메시지에 기반한 시맨틱 버전 관리
다중 플랫폼용 바이너리 빌드
GitHub Container Registry에 Docker 이미지 게시
SBOM 및 출처 증명
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables listing and querying Trino tables using Python, providing access to data resources through the Model-Control-Protocol.18MIT
- AlicenseNot gradedqualityCmaintenanceThis is a Model Context Protocol (MCP) server implemented in Go, providing a tool to analyze Go pprof performance profiles.50MIT
- AlicenseBqualityCmaintenanceA Model Context Protocol server that provides seamless integration with Trino and Iceberg, enabling data exploration, querying, and table maintenance through a standard interface.2225Apache 2.0
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that supports STDIO, SSE and Streamable HTTP protocols for AI model interactions.131MIT
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/tuannvm/mcp-trino'
If you have feedback or need assistance with the MCP directory API, please join our Discord server