A Model Context Protocol (MCP) server for Trino databases - gives AI assistants direct access to query and explore your data warehouse
Project description
๐ Trino MCP Server
A Model Context Protocol (MCP) server that gives AI assistants (like Claude in Cursor) direct access to query and explore Trino/Presto databases.
๐ก No installation required! Just configure and run with
uvx.
โจ Features
- ๐ Schema Discovery - Explore schemas, tables, and columns
- ๐ Smart Exploration - Get schema + sample data in one call
- โก Safe Query Testing - Automatic LIMIT for exploration queries
- ๐ Data Profiling - Null %, distinct counts, top values
- ๐พ Export Results - Save to CSV, Excel, JSON, or Parquet
- ๐ Encryption Check - Detect encrypted columns
- ๐ Query History - Find frequently used queries
๐ Quick Start (3 minutes)
Prerequisites
- Cursor IDE or Claude Desktop
- Trino database credentials
Step 1: Install uv (One-time, 30 seconds)
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
๐ก
uvis a fast Python package manager. Theuvxcommand lets you run Python tools without installing them permanently.
Step 2: Find your uvx path
which uvx
# Usually: ~/.local/bin/uvx (macOS/Linux) or %USERPROFILE%\.local\bin\uvx (Windows)
Step 3: Configure Cursor
Open your Cursor MCP settings:
macOS: ~/.cursor/mcp.json
Windows: %APPDATA%\Cursor\mcp.json
Add this config (replace the uvx path with YOUR path from Step 2):
{
"mcpServers": {
"trino": {
"command": "/Users/YOUR_USERNAME/.local/bin/uvx",
"args": ["trino-mcp-navi"],
"env": {
"TRINO_HOST": "your-trino-host.company.com",
"TRINO_PORT": "443",
"TRINO_USER": "your.email@company.com",
"TRINO_CATALOG": "awsdatacatalog",
"TRINO_DEFAULT_SCHEMA": "default"
}
}
}
}
โ ๏ธ Important: Use the full path to
uvx(not just"uvx"). Cursor doesn't inherit your shell's PATH.
Step 4: Restart Cursor
Restart Cursor completely (close and reopen) to load the MCP server.
Step 5: Test Connection
In Cursor's AI chat, type:
Test my Trino connection
The AI will use mcp_trino_test_connection and confirm the connection.
That's it! ๐ No pip install, no cloning repos.
๐ง Configuration Options
| Environment Variable | Required | Default | Description |
|---|---|---|---|
TRINO_HOST |
โ | - | Trino server hostname |
TRINO_PORT |
โ | 8080 |
Server port (usually 443 for HTTPS) |
TRINO_USER |
โ | - | Your username (usually email) |
TRINO_PASSWORD |
โ | - | Password (if using basic auth) |
TRINO_CATALOG |
โ | awsdatacatalog |
Default catalog |
TRINO_DEFAULT_SCHEMA |
โ | default |
Default schema |
TRINO_HTTP_SCHEME |
โ | https |
http or https |
TRINO_FALLBACK_HOST |
โ | - | Backup host if primary fails |
๐ Available Tools (18 Total)
๐ Discovery Tools
| Tool | Description |
|---|---|
test_connection |
Verify Trino connectivity |
get_all_schemas |
List all schemas in catalog |
get_tables_in_schema |
List tables in a schema |
describe_table |
Get column definitions |
explore_table |
Recommended: Schema + sample data in one call |
search_catalog |
Search for tables/columns by name |
๐ Data Quality & Analytics
| Tool | Description |
|---|---|
profile_column |
Null %, distinct values, top 5 values |
profile_table |
Row count, null analysis per column |
get_table_stats |
Partitions, distinct values, distribution |
get_frequent_queries |
Find how others query this table |
check_encryption |
Check for encrypted columns |
โก Query Execution
| Tool | Description |
|---|---|
test_query |
Quick test with auto-LIMIT (safe) |
run_trino_query |
Execute query, return results |
save_query_results |
Execute + export to CSV/Excel/JSON/Parquet |
execute_sql_file |
Run SQL from a file |
๐ Performance & Schema
| Tool | Description |
|---|---|
explain_query |
Get execution plan |
get_query_history |
Recent queries from session |
get_table_ddl |
SHOW CREATE TABLE |
compare_tables |
Compare schemas of two tables |
๐ฏ Example Usage
Explore a Table
Show me the schema and sample data from the users table in analytics schema
โ AI uses explore_table(table_name="users", schema_name="analytics")
Run a Query
Get the top 10 customers by revenue from last month
โ AI uses run_trino_query with appropriate SQL
Profile Data Quality
What's the null rate for email column in customers table?
โ AI uses profile_column(table_name="customers", column_name="email", schema_name="...")
Search for Tables
Find all tables with "order" in the name
โ AI uses search_catalog(search_term="order", object_type="table")
โ๏ธ Cloud Hosting (Zero Install for Users)
Deploy the server to the cloud so users don't need to install anything!
Deploy to Railway (Recommended)
- Click the button above or go to railway.app
- Connect your GitHub repo
- Set environment variables:
TRINO_HOST,TRINO_PORT,TRINO_USER,TRINO_CATALOG
- Deploy! You'll get a URL like
https://trino-mcp-navi.up.railway.app
Deploy to Render
- Go to render.com
- Create new Web Service โ Connect GitHub repo
- Use the
render.yamlblueprint - Set environment variables
- Deploy!
After Deployment - User Config
Users add this to their Cursor mcp.json - no installation needed!
{
"mcpServers": {
"trino": {
"url": "https://your-deployment-url.railway.app/sse"
}
}
}
That's it! The server handles everything remotely.
๐ Alternative: Run with Python
If you prefer not to use uvx:
# Install
pip install trino-mcp-navi
# Configure Cursor with python instead of uvx
{
"mcpServers": {
"trino": {
"command": "python",
"args": ["-m", "trino_mcp_navi"],
"env": { ... }
}
}
}
๐ง Troubleshooting
"Connection refused" Error
- Check
TRINO_HOSTis correct - Verify
TRINO_PORT(usually 443 for HTTPS, 8080 for HTTP) - Ensure network/VPN access to Trino server
"Authentication failed"
- Verify
TRINO_USERandTRINO_PASSWORD - Some Trino setups use SSO - check with your admin
MCP Not Loading in Cursor
- Check you have
uvinstalled:uv --version - Verify the JSON syntax in
mcp.jsonis valid - Check Cursor logs:
Help โ Toggle Developer Tools โ Console - Restart Cursor completely
"uvx: command not found"
Install uv first:
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
๐ Security Notes
- Never commit credentials to version control
- Use environment variables for sensitive data
- The server connects via HTTPS by default
- All queries go directly to your Trino - no external services
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
MIT License - see the LICENSE file for details.
๐ Support
If you encounter issues:
- Check the troubleshooting section above
- Verify your Trino credentials work outside of Cursor
- Test with a simple query:
SELECT 1 - Open an issue on GitHub
Made with โค๏ธ for data analysts and engineers
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters