The Trino MCP Server is a high-performance bridge that connects AI assistants to Trino's distributed SQL query engine using the Model Context Protocol (MCP). It allows AI systems to seamlessly execute SQL queries, explore database structures, and analyze data through standardized tools.
For macOS and Linux users, install with this one-liner:
curl -fsSL https://raw.githubusercontent.com/tuannvm/mcp-trino/main/install.sh -o install.sh && chmod +x install.sh && ./install.sh
# Add the tap repository
brew tap tuannvm/mcp
# Install mcp-trino
brew install mcp-trino
To update:
brew update && brew upgrade mcp-trino
/usr/local/bin
on Linux/macOS)chmod +x mcp-trino
on Linux/macOS)git clone https://github.com/tuannvm/mcp-trino.git
cd mcp-trino
make build
# Binary will be in ./bin/
If you encounter issues:
Binary not found in PATH: Add ~/.local/bin
to your PATH:
export PATH="$HOME/.local/bin:$PATH"
Add this to your shell profile (.bashrc
, .zshrc
, etc.) to make it permanent.
Permission denied: Ensure the install directory is writable:
mkdir -p ~/.local/bin
chmod 755 ~/.local/bin
GitHub API rate limiting: If hitting GitHub API rate limits:
export GITHUB_TOKEN=your_github_token
curl -fsSL https://raw.githubusercontent.com/tuannvm/mcp-trino/main/install.sh | bash
Instead of a local binary, you can use the Docker image:
{
"mcpServers": {
"mcp-trino": {
"command": "docker",
"args": ["run", "--rm", "-i",
"-e", "TRINO_HOST=<HOST>",
"-e", "TRINO_PORT=<PORT>",
"-e", "TRINO_USER=<USERNAME>",
"-e", "TRINO_PASSWORD=<PASSWORD>",
"-e", "TRINO_SCHEME=http",
"ghcr.io/tuannvm/mcp-trino:latest"],
"env": {}
}
}
}
Create or edit ~/.cursor/mcp.json
:
{
"mcpServers": {
"mcp-trino": {
"command": "mcp-trino",
"args": [],
"env": {
"TRINO_HOST": "<HOST>",
"TRINO_PORT": "<PORT>",
"TRINO_USER": "<USERNAME>",
"TRINO_PASSWORD": "<PASSWORD>"
}
}
}
}
For HTTP transport mode:
{
"mcpServers": {
"mcp-trino-http": {
"url": "http://localhost:8080/mcp"
}
}
}
Then start the server in a separate terminal:
# Basic HTTP transport
MCP_TRANSPORT=http TRINO_HOST=<HOST> TRINO_PORT=<PORT> TRINO_USER=<USERNAME> TRINO_PASSWORD=<PASSWORD> mcp-trino
The install script will automatically configure Claude Desktop. Alternatively, manually edit your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"mcp-trino": {
"command": "mcp-trino",
"args": [],
"env": {
"TRINO_HOST": "<HOST>",
"TRINO_PORT": "<PORT>",
"TRINO_USER": "<USERNAME>",
"TRINO_PASSWORD": "<PASSWORD>"
}
}
}
}
The install script will automatically configure Claude Code. For manual setup:
claude mcp add mcp-trino mcp-trino
Then set your environment variables:
export TRINO_HOST=<HOST>
export TRINO_PORT=<PORT>
export TRINO_USER=<USERNAME>
export TRINO_PASSWORD=<PASSWORD>
Create or edit your mcp_config.json
:
{
"mcpServers": {
"mcp-trino": {
"command": "mcp-trino",
"args": [],
"env": {
"TRINO_HOST": "<HOST>",
"TRINO_PORT": "<PORT>",
"TRINO_USER": "<USERNAME>",
"TRINO_PASSWORD": "<PASSWORD>"
}
}
}
}
For ChatWise, follow these steps:
mcp-trino
(or any name you prefer)mcp-trino
Execute SQL queries against Trino with full SQL support.
Example:
{
"query": "SELECT region, COUNT(*) as customer_count FROM tpch.tiny.customer GROUP BY region ORDER BY customer_count DESC"
}
List all available catalogs in the Trino server.
Example:
{}
List all schemas in a specific catalog.
Example:
{
"catalog": "tpch"
}
List all tables in a specific schema.
Example:
{
"catalog": "tpch",
"schema": "tiny"
}
Get the schema of a specific table.
Example:
{
"catalog": "tpch",
"schema": "tiny",
"table": "customer"
}
The server supports two transport methods:
For secure deployments, the server supports OAuth 2.0 authentication:
OIDC Provider Mode (Recommended for Production)
# Configure with OAuth provider (Okta example)
export TRINO_OAUTH_ENABLED=true
export OAUTH_PROVIDER=okta
export OIDC_ISSUER=https://your-domain.okta.com
export OIDC_AUDIENCE=https://your-domain.okta.com
export MCP_TRANSPORT=http
mcp-trino
HMAC Mode (For Development/Testing)
# Simple JWT with shared secret
export TRINO_OAUTH_ENABLED=true
export OAUTH_PROVIDER=hmac
export JWT_SECRET=your-secret-key-here
export MCP_TRANSPORT=http
mcp-trino
For production deployments with authentication:
export HTTPS_CERT_FILE=/path/to/certificate.pem
export HTTPS_KEY_FILE=/path/to/private-key.pem
export TRINO_OAUTH_ENABLED=true
export MCP_TRANSPORT=http
mcp-trino
For production deployment:
# Deploy with HTTPS and JWT authentication
export MCP_TRANSPORT=http
export MCP_PORT=443
export TRINO_OAUTH_ENABLED=true
export HTTPS_CERT_FILE=/etc/ssl/certs/mcp-trino.pem
export HTTPS_KEY_FILE=/etc/ssl/private/mcp-trino.key
export TRINO_HOST=your-trino-cluster.com
export TRINO_PORT=443
export TRINO_USER=service-account
export TRINO_PASSWORD=service-password
# Start the server
mcp-trino
Configure the server using these environment variables:
Variable | Description | Default |
---|---|---|
TRINO_HOST | Trino server hostname | localhost |
TRINO_PORT | Trino server port | 8080 |
TRINO_USER | Trino user | trino |
TRINO_PASSWORD | Trino password | (empty) |
TRINO_CATALOG | Default catalog | memory |
TRINO_SCHEMA | Default schema | default |
TRINO_SCHEME | Connection scheme (http/https) | https |
TRINO_SSL | Enable SSL | true |
TRINO_SSL_INSECURE | Allow insecure SSL | true |
TRINO_ALLOW_WRITE_QUERIES | Allow non-read-only SQL queries | false |
TRINO_QUERY_TIMEOUT | Query timeout in seconds | 30 |
MCP_TRANSPORT | Transport method (stdio/http) | stdio |
MCP_PORT | HTTP port for http transport | 8080 |
MCP_HOST | Host for HTTP callbacks | localhost |
TRINO_OAUTH_ENABLED | Enable OAuth authentication | false |
OAUTH_PROVIDER | OAuth provider type | hmac |
JWT_SECRET | JWT secret for HMAC mode | (empty) |
OIDC_ISSUER | OIDC provider issuer URL | (empty) |
OIDC_AUDIENCE | OIDC audience identifier | (empty) |
HTTPS_CERT_FILE | Path to HTTPS certificate file | (empty) |
HTTPS_KEY_FILE | Path to HTTPS private key file | (empty) |
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "mcp-trino" '{"command":"mcp-trino","args":[],"env":{"TRINO_HOST":"<HOST>","TRINO_PORT":"<PORT>","TRINO_USER":"<USERNAME>","TRINO_PASSWORD":"<PASSWORD>"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"mcp-trino": {
"command": "mcp-trino",
"args": [],
"env": {
"TRINO_HOST": "<HOST>",
"TRINO_PORT": "<PORT>",
"TRINO_USER": "<USERNAME>",
"TRINO_PASSWORD": "<PASSWORD>"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"mcp-trino": {
"command": "mcp-trino",
"args": [],
"env": {
"TRINO_HOST": "<HOST>",
"TRINO_PORT": "<PORT>",
"TRINO_USER": "<USERNAME>",
"TRINO_PASSWORD": "<PASSWORD>"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect