MCP Trino Server
MCP server providing seamless integration with Trino and Iceberg for advanced data exploration, querying, and table maintenance.
README
MCP Trino Server
The MCP Trino Server is a Model Context Protocol (MCP) server that provides seamless integration with Trino and Iceberg, enabling advanced data exploration, querying, and table maintenance capabilities through a standard interface.
Use Cases
- Interactive data exploration and analysis in Trino
- Automated Iceberg table maintenance and optimization
- Building AI-powered tools that interact with Trino databases
- Executing and managing SQL queries with proper result formatting
Prerequisites
- A running Trino server (or Docker Compose for local development)
- Python 3.11 or higher
- Docker (optional, for containerized deployment)
Installation
Installing via Smithery
To install MCP Trino Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @alaturqua/mcp-trino-python --client claude
Running Trino Locally
The easiest way to get started is to use the included Docker Compose configuration to run Trino locally:
docker-compose up -d
This will start a Trino server on localhost:8080. You can now proceed with configuring the MCP server.
Usage with VS Code
For quick installation, you can add the following configuration to your VS Code settings. You can do this by pressing Ctrl + Shift + P and typing Preferences: Open User Settings (JSON).
Optionally, you can add it to a file called .vscode/mcp.json in your workspace. This will allow you to share the configuration with others.
Note that the
mcpkey is not needed in the.vscode/mcp.jsonfile.
{
"mcp": {
"servers": {
"trino": {
"command": "docker",
"args": ["run", "--rm", "ghcr.io/alaturqua/mcp-trino-python:latest"],
"env": {
"TRINO_HOST": "${input:trino_host}",
"TRINO_PORT": "${input:trino_port}",
"TRINO_USER": "${input:trino_user}",
"TRINO_PASSWORD": "${input:trino_password}",
"TRINO_HTTP_SCHEME": "${input:trino_http_scheme}",
"TRINO_CATALOG": "${input:trino_catalog}",
"TRINO_SCHEMA": "${input:trino_schema}"
}
}
}
}
}
Usage with Claude Desktop
Add the following configuration to your Claude Desktop settings:
{
"mcpServers": {
"trino": {
"command": "python",
"args": ["./src/server.py"],
"env": {
"TRINO_HOST": "your-trino-host",
"TRINO_PORT": "8080",
"TRINO_USER": "trino"
}
}
}
}
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
| TRINO_HOST | Trino server hostname | localhost |
| TRINO_PORT | Trino server port | 8080 |
| TRINO_USER | Trino username | trino |
| TRINO_CATALOG | Default catalog | None |
| TRINO_SCHEMA | Default schema | None |
| TRINO_HTTP_SCHEME | HTTP scheme (http/https) | http |
| TRINO_PASSWORD | Trino password | None |
Tools
Query and Exploration Tools
-
show_catalogs
- List all available catalogs
- No parameters required
-
show_schemas
- List all schemas in a catalog
- Parameters:
catalog: Catalog name (string, required)
-
show_tables
- List all tables in a schema
- Parameters:
catalog: Catalog name (string, required)schema: Schema name (string, required)
-
describe_table
- Show detailed table structure and column information
- Parameters:
table: Table name (string, required)catalog: Catalog name (string, optional)schema: Schema name (string, optional)
-
execute_query
- Execute a SQL query and return formatted results
- Parameters:
query: SQL query to execute (string, required)
-
show_catalog_tree
- Show a hierarchical tree view of catalogs, schemas, and tables
- Returns a formatted tree structure with visual indicators
- No parameters required
-
show_create_table
- Show the CREATE TABLE statement for a table
- Parameters:
table: Table name (string, required)catalog: Catalog name (string, optional)schema: Schema name (string, optional)
-
show_create_view
- Show the CREATE VIEW statement for a view
- Parameters:
view: View name (string, required)catalog: Catalog name (string, optional)schema: Schema name (string, optional)
-
show_stats
- Show statistics for a table
- Parameters:
table: Table name (string, required)catalog: Catalog name (string, optional)schema: Schema name (string, optional)
Iceberg Table Maintenance
-
optimize
- Optimize an Iceberg table by compacting small files
- Parameters:
table: Table name (string, required)catalog: Catalog name (string, optional)schema: Schema name (string, optional)
-
optimize_manifests
- Optimize manifest files for an Iceberg table
- Parameters:
table: Table name (string, required)catalog: Catalog name (string, optional)schema: Schema name (string, optional)
-
expire_snapshots
- Remove old snapshots from an Iceberg table
- Parameters:
table: Table name (string, required)retention_threshold: Age threshold (e.g., "7d") (string, optional)catalog: Catalog name (string, optional)schema: Schema name (string, optional)
Iceberg Metadata Inspection
-
show_table_properties
- Show Iceberg table properties
- Parameters:
table: Table name (string, required)catalog: Catalog name (string, optional)schema: Schema name (string, optional)
-
show_table_history
- Show Iceberg table history/changelog
- Contains snapshot timing, lineage, and ancestry information
- Parameters:
table: Table name (string, required)catalog: Catalog name (string, optional)schema: Schema name (string, optional)
-
show_metadata_log_entries
- Show Iceberg table metadata log entries
- Contains metadata file locations and sequence information
- Parameters:
table: Table name (string, required)catalog: Catalog name (string, optional)schema: Schema name (string, optional)
-
show_snapshots
- Show Iceberg table snapshots
- Contains snapshot details including operations and manifest files
- Parameters:
table: Table name (string, required)catalog: Catalog name (string, optional)schema: Schema name (string, optional)
-
show_manifests
- Show Iceberg table manifests for current or all snapshots
- Contains manifest file details and data file statistics
- Parameters:
table: Table name (string, required)catalog: Catalog name (string, optional)schema: Schema name (string, optional)all_snapshots: Include all snapshots (boolean, optional)
-
show_partitions
- Show Iceberg table partitions
- Contains partition statistics and file counts
- Parameters:
table: Table name (string, required)catalog: Catalog name (string, optional)schema: Schema name (string, optional)
-
show_files
- Show Iceberg table data files in current snapshot
- Contains detailed file metadata and column statistics
- Parameters:
table: Table name (string, required)catalog: Catalog name (string, optional)schema: Schema name (string, optional)
-
show_entries
- Show Iceberg table manifest entries for current or all snapshots
- Contains entry status and detailed file metrics
- Parameters:
table: Table name (string, required)catalog: Catalog name (string, optional)schema: Schema name (string, optional)all_snapshots: Include all snapshots (boolean, optional)
-
show_refs
- Show Iceberg table references (branches and tags)
- Contains reference configuration and snapshot mapping
- Parameters:
table: Table name (string, required)catalog: Catalog name (string, optional)schema: Schema name (string, optional)
Query History
- show_query_history
- Get the history of executed queries
- Parameters:
limit: Maximum number of queries to return (number, optional)
License
This project is licensed under the Apache 2.0 License. Please refer to the LICENSE file for the full terms.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。