- Explore MCP Servers
- mcp-trino-python
Mcp Trino Python
What is Mcp Trino Python
mcp-trino-python is an MCP server designed for executing SQL queries on Presto/Trino databases, featuring integration with Cursor and support for the native MCP protocol.
Use cases
Use cases include querying large datasets, integrating with data visualization tools, and enabling data scientists to perform SQL operations within their Python workflows.
How to use
To use mcp-trino-python, clone the repository, set up the environment with Python and the uv package manager, and run the server using npx. You can also configure it in Cursor’s settings using JSON.
Key features
Key features include the ability to connect to Presto/Trino databases, execute SQL queries, retrieve results, stream data with pandas DataFrame support, and run via npx without global installation.
Where to use
mcp-trino-python can be used in data analytics, business intelligence, and any application requiring SQL query execution on Presto/Trino databases.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcp Trino Python
mcp-trino-python is an MCP server designed for executing SQL queries on Presto/Trino databases, featuring integration with Cursor and support for the native MCP protocol.
Use cases
Use cases include querying large datasets, integrating with data visualization tools, and enabling data scientists to perform SQL operations within their Python workflows.
How to use
To use mcp-trino-python, clone the repository, set up the environment with Python and the uv package manager, and run the server using npx. You can also configure it in Cursor’s settings using JSON.
Key features
Key features include the ability to connect to Presto/Trino databases, execute SQL queries, retrieve results, stream data with pandas DataFrame support, and run via npx without global installation.
Where to use
mcp-trino-python can be used in data analytics, business intelligence, and any application requiring SQL query execution on Presto/Trino databases.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
MCP Trino Python
MCP server for Presto/Trino SQL queries with Cursor integration, featuring native MCP protocol support.
Features
- Connect to Presto/Trino databases
- Execute SQL queries and retrieve results
- Streaming data with pandas DataFrame support
- Run via npx without global installation
- Native MCP protocol for direct Cursor integration
Requirements
- Python 3.8+
- uv package manager
- Node.js 12+ (for npx usage)
Installation
- Clone the repository:
git clone <repository-url>
cd mcp-trino-python
- Set up the environment:
# Install uv if not already installed
pip install uv # on Linux: pip install uv
brew install uv # On MacOS: brew install uv
# Create a virtual environment and install dependencies
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv sync
(You can also directly run setup.sh
to set up the environment.)
Usage
Running with npx
You can run the server using npx without needing to install it globally:
# Run using npx (also supports all command-line parameters)
npx -y mcp-trino-python --username user --password pass
Adding to Cursor
Method 1: Using JSON Configuration
You can configure the MCP server by editing Cursor’s configuration JSON directly:
- Open Cursor settings (Cmd+, on Mac or Ctrl+, on Windows/Linux)
- Click on “Edit in JSON” at the top right
- Add the following to your configuration:
If you’ve published the package to npm, you can use this configuration:
Available Confurations:
Option | Description |
---|---|
--host |
Presto/Trino host server (default: localhost) |
--port |
Server port (default: 8080) |
--protocol |
Protocol (http/https) (default: https) - Only the selected protocol adapter will be created |
--username |
Username for authentication (Required) |
--password |
Password for authentication (Required) |
--catalog |
Trino catalog name (default: hive) |
--schema |
Default schema to use for queries (default: default) |
--source |
Source identifier shown in Trino/Presto UI (default: mcp-trino-python) - Use {username} to include username |
--resource-group |
Trino resource group or queue name for workload management |
--connect-timeout |
Connection timeout in seconds (default: 10) - Controls how long to wait when establishing connections |
--query-timeout |
Query timeout in seconds (default: 300) - Controls both client request timeout and server-side query timeout |
--verbose |
Show verbose output including credentials |
Available MCP Commands
The MCP server supports the following commands:
Command | Description |
---|---|
execute-query |
Execute SQL queries with optional limit |
list-tables |
List all tables in a schema |
describe-table |
Show table structure including columns |
health-check |
Check server health and connection status |
Example Command Usage
In Cursor IDE, you can use these commands as follows:
-
For executing queries:
Command: execute-query Parameters: {"query": "SELECT * FROM your_table LIMIT 10"}
-
For listing tables:
Command: list-tables Parameters: {"schema": "your_schema"}
-
For describing a table:
Command: describe-table Parameters: {"table": "your_table", "schema": "your_schema"}
Troubleshooting
If you encounter connection issues:
- Check network connectivity to the Presto/Trino server
- Run with
--verbose
flag to see detailed connection information - Ensure proper permissions for the specified schema
License
MIT
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.