Trino MCP server

Enables SQL query execution against Trino databases with tools for data exploration, schema retrieval, and analysis without writing complex queries manually.
Back to servers
Setup instructions
Provider
Tuan Nguyen
Release date
Apr 10, 2025
Language
Go
Stats
43 stars

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.

Installation

Quick Install

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

Using Homebrew (macOS and Linux)

# Add the tap repository
brew tap tuannvm/mcp

# Install mcp-trino
brew install mcp-trino

To update:

brew update && brew upgrade mcp-trino

Manual Installation

  1. Download the appropriate binary for your platform from the GitHub Releases page
  2. Place the binary in a directory included in your PATH (e.g., /usr/local/bin on Linux/macOS)
  3. Make it executable (chmod +x mcp-trino on Linux/macOS)

From Source

git clone https://github.com/tuannvm/mcp-trino.git
cd mcp-trino
make build
# Binary will be in ./bin/

Installation Troubleshooting

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
    

MCP Integration

Using Docker Image

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": {}
    }
  }
}

Cursor Integration

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

Claude Desktop Integration

The install script will automatically configure Claude Desktop. Alternatively, manually edit your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.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>"
      }
    }
  }
}

Claude Code Integration

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>

Windsurf Integration

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>"
      }
    }
  }
}

ChatWise Integration

For ChatWise, follow these steps:

  1. Open ChatWise and go to Settings > Tools
  2. Click the "+" icon to add a new tool
  3. Select "Command Line MCP"
  4. Configure with these details:
    • ID: mcp-trino (or any name you prefer)
    • Command: mcp-trino
    • Args: (leave empty)
    • Env: Add your Trino connection variables

Available MCP Tools

execute_query

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_catalogs

List all available catalogs in the Trino server.

Example:

{}

list_schemas

List all schemas in a specific catalog.

Example:

{
  "catalog": "tpch"
}

list_tables

List all tables in a specific schema.

Example:

{
  "catalog": "tpch",
  "schema": "tiny"
}

get_table_schema

Get the schema of a specific table.

Example:

{
  "catalog": "tpch",
  "schema": "tiny",
  "table": "customer"
}

Authentication and Transport

Transport Methods

The server supports two transport methods:

  • STDIO Transport (Default): Ideal for desktop applications
  • HTTP Transport with StreamableHTTP: Supports web-based clients and enables JWT authentication

OAuth 2.0 Authentication

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

HTTPS Support

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

Remote MCP Server Deployment

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

Configuration

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)

How to install this MCP server

For Claude Code

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.

For Cursor

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.

Adding an MCP server to Cursor globally

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>"
            }
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.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

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later