Skip to main content

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

PyPI version License: MIT Python 3.10+

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"

๐Ÿ’ก uv is a fast Python package manager. The uvx command 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)

Deploy on Railway

  1. Click the button above or go to railway.app
  2. Connect your GitHub repo
  3. Set environment variables:
    • TRINO_HOST, TRINO_PORT, TRINO_USER, TRINO_CATALOG
  4. Deploy! You'll get a URL like https://trino-mcp-navi.up.railway.app

Deploy to Render

  1. Go to render.com
  2. Create new Web Service โ†’ Connect GitHub repo
  3. Use the render.yaml blueprint
  4. Set environment variables
  5. 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_HOST is correct
  • Verify TRINO_PORT (usually 443 for HTTPS, 8080 for HTTP)
  • Ensure network/VPN access to Trino server

"Authentication failed"

  • Verify TRINO_USER and TRINO_PASSWORD
  • Some Trino setups use SSO - check with your admin

MCP Not Loading in Cursor

  1. Check you have uv installed: uv --version
  2. Verify the JSON syntax in mcp.json is valid
  3. Check Cursor logs: Help โ†’ Toggle Developer Tools โ†’ Console
  4. 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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“ License

MIT License - see the LICENSE file for details.


๐Ÿ†˜ Support

If you encounter issues:

  1. Check the troubleshooting section above
  2. Verify your Trino credentials work outside of Cursor
  3. Test with a simple query: SELECT 1
  4. Open an issue on GitHub

Made with โค๏ธ for data analysts and engineers

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trino_mcp_navi-0.2.0.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trino_mcp_navi-0.2.0-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file trino_mcp_navi-0.2.0.tar.gz.

File metadata

  • Download URL: trino_mcp_navi-0.2.0.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for trino_mcp_navi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c54f1c6747fbf44164cce64c7a55b046a79267f326fa0cd7f5fa986d3b5b7fc8
MD5 23a0b6274f4bda3a0c926e3853095016
BLAKE2b-256 f20b1627b49986bb1b238e3bd9368066de64f0d2f50a816cd7d8e859720709a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for trino_mcp_navi-0.2.0.tar.gz:

Publisher: publish.yml on manish-coder-1007/trino-mcp-navi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trino_mcp_navi-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: trino_mcp_navi-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for trino_mcp_navi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 934e9d8c55aa8d0e97195e33e8552de46dea53eb4f5a79455c1323829fdd2238
MD5 da5a7ff2d51ebe5b58035b3dd7ea43d6
BLAKE2b-256 e4291da28a94f3cd68a355cc78b9cbdd65edc31e8c831020ddf8c66ba6fcc56d

See more details on using hashes here.

Provenance

The following attestation bundles were made for trino_mcp_navi-0.2.0-py3-none-any.whl:

Publisher: publish.yml on manish-coder-1007/trino-mcp-navi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page