Install
$ agentstack add mcp-dikshantks-trino-mcp-server ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ● Network access Used
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Trino MCP Server
A production-ready Model Context Protocol (MCP) server that provides secure, read-only access to Trino databases. Perfect for data engineers and analysts who want to leverage AI tools (like Cursor) to query and explore Trino databases.
🚀 Quick Start
Get up and running in 5 minutes:
- Prerequisites: Docker Desktop, Cursor IDE, and access to a Trino server
- Build:
docker build -t trino-mcp-server:latest . - Configure: Add MCP server to Cursor configuration
- Test: Ask Cursor to "show me all catalogs in Trino"
See [Installation](#installation) for detailed platform-specific instructions.
📋 Features
Core Capabilities
- ✅ Read-Only Safety: All write operations (INSERT, UPDATE, DELETE, etc.) are blocked
- ✅ Query Execution: Execute SELECT, SHOW, DESCRIBE, EXPLAIN queries
- ✅ Database Exploration: List catalogs, schemas, tables, and columns
- ✅ Data Sampling: Preview table data with configurable limits
- ✅ Table Statistics: Get row counts and column statistics
- ✅ Optional Authentication: Support for password-based authentication
- ✅ Health Checks: Built-in connection testing tool
- ✅ PII Masking: Automatic detection and masking of sensitive data (emails, phones, addresses, etc.)
Available Tools
| Tool | Description | |------|-------------| | execute_query | Execute read-only SQL queries (SELECT, SHOW, DESCRIBE only) | | show_catalogs | List all available catalogs in Trino | | show_schemas | Show all schemas in a specific catalog | | show_tables | List all tables in a schema | | describe_table | Get the structure and column details of a table | | show_columns | Show detailed column information for a table | | get_table_stats | Get statistics about a table including row count | | sample_table | Get a sample of rows from a table (default 10, max 100) | | test_connection | Test connection to Trino and get server information |
🎯 Use Cases
For Data Engineers
- Database Exploration: Quickly discover available catalogs, schemas, and tables
- Schema Analysis: Understand table structures and relationships
- Data Quality Checks: Sample data and check statistics before running full queries
- Query Development: Test and refine SQL queries with AI assistance
For Data Analysts
- Ad-Hoc Analysis: Run analytical queries without writing complex SQL
- Data Discovery: Explore datasets and understand their structure
- Quick Insights: Get table statistics and sample data for rapid analysis
- Report Generation: Use AI to generate queries for common reporting needs
Installation
Prerequisites
Before you begin, ensure you have:
- Docker Desktop installed and running
- Download Docker Desktop
- Verify installation:
docker --version
- Cursor IDE installed
- Download Cursor
- Ensure MCP Toolkit is enabled in settings
- Trino Server access
- A running Trino server (local or remote)
- Connection details (host, port, user, catalog, schema)
- Network access to the Trino server
Step 1: Clone or Download
git clone https://github.com/dikshantks/trino-mcp-server.git
cd trino-mcp-server
Or download and extract the project files.
Step 2: Build Docker Image
docker build -t trino-mcp-server:latest .
Verify the image was created:
docker images | grep trino-mcp-server
Step 3: Configure Environment Variables
The server uses environment variables for configuration. You'll set these when configuring Cursor MCP.
Required Variables:
TRINO_HOST: Trino server hostname (default:host.docker.internal)TRINO_PORT: Trino server port (default:8088)TRINO_USER: Trino username (default:trino)TRINO_CATALOG: Default catalog name (default:tpch)TRINO_SCHEMA: Default schema name (default:tiny)
Optional Variables:
TRINO_PASSWORD: Password for authentication (if required)TRINO_USE_HTTPS: Use HTTPS instead of HTTP (true/false, default:false)LOG_LEVEL: Logging level (DEBUG,INFO,WARNING,ERROR, default:INFO)
💻 Platform-Specific Setup
Windows
1. Install Docker Desktop
- Download Docker Desktop for Windows
- Install and start Docker Desktop
- Enable WSL 2 backend (recommended) if prompted
2. Build the Image
Open PowerShell or Command Prompt:
cd path\to\trino-mcp-server
docker build -t trino-mcp-server:latest .
3. Configure Cursor MCP
- Open Cursor Settings (Ctrl+,)
- Navigate to MCP or search for "MCP"
- Open the MCP configuration file:
`` %APPDATA%\Cursor\mcp.json ``
- Add the Trino MCP server configuration (see [Cursor MCP Integration](#-cursor-mcp-integration))
Linux
1. Install Docker
Ubuntu/Debian:
sudo apt-get update
sudo apt-get install docker.io docker-compose
sudo systemctl start docker
sudo systemctl enable docker
2. Build the Image
cd trino-mcp-server
docker build -t trino-mcp-server:latest .
3. Configure Cursor MCP
- Open Cursor Settings
- Navigate to MCP
- Open the MCP configuration file:
- Add the Trino MCP server configuration
Linux-Specific Configuration
Common Linux Issues
- Permission denied: Add user to docker group (see above)
- host.docker.internal not working: Use
--network hostor--add-hostflag - Firewall blocking: Check firewall rules for Docker
macOS
1. Install Docker Desktop
- Download Docker Desktop for Mac
- Install and start Docker Desktop
- Verify installation:
docker --version
2. Build the Image
Open Terminal:
cd path/to/trino-mcp-server
docker build -t trino-mcp-server:latest .
3. Configure Cursor MCP
- Open Cursor Settings (Cmd+,)
- Navigate to MCP
- Open the MCP configuration file:
`` ~/cursor/mcp.json ``
- Add the Trino MCP server configuration
🔌 Cursor MCP Integration
Step-by-Step Configuration
- Open Cursor Settings
- Go to File → Preferences → Settings
- Navigate to MCP Settings
- Search for "MCP" in settings
- Or manually navigate to the MCP configuration file (see platform-specific paths above)
- Edit Configuration File
- Open the
mcp.jsonfile - Add the Trino MCP server configuration
```json $ /.cursor/mcp.json { "mcpServers": { "trino": { "command": "docker", "args": [ "run", "-i", "--rm", "--network", "host", "-e", "TRINOHOST=localhost", "-e", "TRINOPORT=8088", "-e", "TRINOUSER=trino", "-e", "TRINOCATALOG=iceberg", "-e", "TRINO_SCHEMA=tiny", "trino-mcp-test:latest" ] } } }
```
- Restart Cursor
- Fully quit and restart Cursor to load the new configuration
- Test Connection
- Open a chat in Cursor
- Ask: "Show me all catalogs in Trino"
- The AI should use the Trino MCP tools
Configuration Examples
Basic Configuration (Local Trino)
{
"mcpServers": {
"trino": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "TRINO_HOST=host.docker.internal",
"-e", "TRINO_PORT=8088",
"-e", "TRINO_USER=trino",
"-e", "TRINO_CATALOG=tpch",
"-e", "TRINO_SCHEMA=tiny",
"trino-mcp-server:latest"
]
}
}
}
With Authentication
{
"mcpServers": {
"trino": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "TRINO_HOST=host.docker.internal",
"-e", "TRINO_PORT=8088",
"-e", "TRINO_USER=admin",
"-e", "TRINO_PASSWORD=your_password_here",
"-e", "TRINO_CATALOG=my_catalog",
"-e", "TRINO_SCHEMA=my_schema",
"trino-mcp-server:latest"
]
}
}
}
Remote Trino via SSH Tunnel
First, establish SSH tunnel in a separate terminal:
ssh -L 8088:localhost:8088 user@trino-server-host
Then use this configuration:
{
"mcpServers": {
"trino": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"--network", "host",
"-e", "TRINO_HOST=localhost",
"-e", "TRINO_PORT=8088",
"-e", "TRINO_USER=trino",
"-e", "TRINO_CATALOG=tpch",
"-e", "TRINO_SCHEMA=tiny",
"trino-mcp-server:latest"
]
}
}
}
HTTPS Connection
{
"mcpServers": {
"trino": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "TRINO_HOST=trino.example.com",
"-e", "TRINO_PORT=8443",
"-e", "TRINO_USER=trino",
"-e", "TRINO_USE_HTTPS=true",
"-e", "TRINO_CATALOG=tpch",
"-e", "TRINO_SCHEMA=tiny",
"trino-mcp-server:latest"
]
}
}
}
Verifying the Connection
- Check MCP Server Status
- Look for MCP server status in Cursor's status bar
- Or check Cursor's MCP panel (if available)
- Test with a Simple Query
- Ask Cursor: "Test the Trino connection"
- Or: "Show me all catalogs in Trino"
- The AI should successfully use the MCP tools
- Check Logs (if issues occur)
- Docker logs:
docker psto find container, thendocker logs - Cursor logs: Check Cursor's developer console
⚙️ Configuration Reference
Environment Variables
| Variable | Required | Default | Description | |----------|----------|---------|-------------| | TRINO_HOST | Yes | host.docker.internal | Trino server hostname | | TRINO_PORT | Yes | 8088 | Trino server port | | TRINO_USER | Yes | trino | Trino username | | TRINO_CATALOG | Yes | tpch | Default catalog name | | TRINO_SCHEMA | Yes | tiny | Default schema name | | TRINO_PASSWORD | No | - | Password for authentication (if required) | | TRINO_USE_HTTPS | No | false | Use HTTPS instead of HTTP | | LOG_LEVEL | No | INFO | Logging level (DEBUG, INFO, WARNING, ERROR) | | PII_MASKING_ENABLED | No | false | Enable PII masking to redact sensitive data | | PII_MASK_STYLE | No | partial | Masking style: full or partial | | PII_MASKED_COLUMNS | No | - | Additional column names to always mask (comma-separated) | | PII_ALLOWED_COLUMNS | No | - | Column names to never mask (comma-separated, overrides auto-detection) |
PII Masking
The server includes a configurable PII masking feature to prevent sensitive data from being exposed to the LLM:
How it works:
- Column-Name Detection: Automatically detects columns with names like
email,phone,address,aadhaar,pan, etc. - Content Scanning: Scans cell values for patterns that look like PII (emails, phone numbers, credit cards, etc.)
- Smart Masking: Masks data while preserving format context (e.g.,
j***n@g***.comfor emails)
Configuration:
PII_MASKING_ENABLED=true- Enable masking (off by default)PII_MASK_STYLE=partial- Show partial characters for context, orfullfor complete redactionPII_MASKED_COLUMNS=custom_field,secret_data- Force masking on specific columnsPII_ALLOWED_COLUMNS=order_email,system_phone- Skip masking on specific columns
Detected PII Types:
- Email addresses
- Phone numbers (international and Indian formats)
- IP addresses
- Credit card numbers
- Indian Aadhaar numbers
- Indian PAN numbers
- Names, addresses, and other personal identifiers
Example output with masking:
| email | phone | name |
|-----------------|--------------|---------|
| j***n@g***.com | ***-***-4567 | J***n |
[PII Masking Active] Masked columns: email (email), phone (phone), name (personal)
Authentication
The server supports optional password-based authentication:
- No Authentication: If
TRINO_PASSWORDis not set, connections use no authentication - Basic Authentication: If
TRINO_PASSWORDis set, BasicAuth is used - HTTPS: Set
TRINO_USE_HTTPS=truefor secure connections
Network Configuration
Local Trino Server:
- Use
host.docker.internalasTRINO_HOST(Windows/macOS) - On Linux, use
--network hostor--add-hostflag
Remote Trino Server:
- Use SSH tunnel:
ssh -L 8088:localhost:8088 user@host - Set
TRINO_HOST=localhostand use--network host - Or use direct connection with proper firewall rules
📖 Usage Examples
Basic Database Exploration
User: Show me all catalogs in Trino
AI: [Uses show_catalogs tool]
User: What schemas are in the tpch catalog?
AI: [Uses show_schemas tool with catalog="tpch"]
User: List all tables in tpch.tiny
AI: [Uses show_tables tool]
Table Analysis
User: Describe the customer table structure
AI: [Uses describe_table tool]
User: Show me 5 sample rows from the orders table
AI: [Uses sample_table tool with limit=5]
User: Get statistics for the lineitem table
AI: [Uses get_table_stats tool]
Query Execution
User: Run this query: SELECT COUNT(*) FROM tpch.tiny.customer
AI: [Uses execute_query tool]
User: Show me the top 10 customers by order count
AI: [Uses execute_query with a JOIN query]
Data Engineering Workflows
User: Help me explore the sales database
AI: [Uses multiple tools: show_catalogs, show_schemas, show_tables]
User: What's the schema of the transactions table?
AI: [Uses describe_table tool]
User: Check if the transactions table has any data
AI: [Uses get_table_stats tool]
🔧 Troubleshooting
Connection Issues
Problem: Cannot connect to Trino server
Solutions:
- Verify Trino server is running:
``bash curl http://localhost:8088/v1/info ``
- Check environment variables are correct:
TRINO_HOSTmatches your Trino server addressTRINO_PORTmatches your Trino server portTRINO_USERis valid
- For Docker networking:
- Windows/macOS: Use
host.docker.internal - Linux: Use
--network hostor--add-host=host.docker.internal:host-gateway
- Check firewall rules and network connectivity
Problem: Connection works locally but not in Docker
Solutions:
- Use
host.docker.internalinstead oflocalhost - On Linux, add
--add-host=host.docker.internal:host-gateway - Or use
--network hostmode
Cursor MCP Integration Issues
Problem: MCP server not appearing in Cursor
Solutions:
- Verify JSON syntax in configuration file
- Check Docker image exists:
docker images | grep trino-mcp-server - Test Docker run manually:
``bash docker run -i --rm -e TRINO_HOST=host.docker.internal -e TRINO_PORT=8088 trino-mcp-server:latest ``
- Fully restart Cursor (not just reload window)
- Check Cursor logs for errors
Problem: Tools not working in Cursor
Solutions:
- Use the
test_connectiontool to verify connectivity - Check Docker container logs
- Verify environment variables are set correctly
- Ensure Trino server is accessible from Docker container
Query Execution Issues
Problem: Query execution fails
Solutions:
- Verify query is read-only (SELECT, SHOW, DESCRIBE only)
- Check table/schema/catalog names are correct
- Verify user has read permissions
- Check Trino server logs for detailed errors
Problem: "Only read-only queries are allowed" error
Solutions:
- The server blocks all write operations for safety
- Use only SELECT, SHOW, DESCRIBE, EXPLAIN, WITH queries
- Check query doesn't contain INSERT, UPDATE, DELETE, etc.
Authentication Issues
Problem: Authentication failed
Solutions:
- Verify
TRINO_USERis correct - Check
TRINO_PASSWORDis set correctly (if required) - Verify user has read permissions on the catalog
- Check Trino server authentication configurat
…
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: dikshantks
- Source: dikshantks/trino-mcp-server
- License: Apache-2.0
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.