Trino MCP Server in Go

Trino MCP Server in Go

A high-performance Model Context Protocol (MCP) server for Trino implemented in Go.

tuannvm

Developer Tools
Visit Server

README

Trino MCP Server in Go

A high-performance Model Context Protocol (MCP) server for Trino implemented in Go. This project enables AI assistants to seamlessly interact with Trino's distributed SQL query engine through standardized MCP tools.

GitHub Workflow Status Go Version Trivy Scan SLSA 3 Go Report Card Go Reference Docker Image GitHub Release License: MIT

Overview

This project implements a Model Context Protocol (MCP) server for Trino in Go. It enables AI assistants to access Trino's distributed SQL query engine through standardized MCP tools.

Trino (formerly PrestoSQL) is a powerful distributed SQL query engine designed for fast analytics on large datasets.

Features

  • ✅ MCP server implementation in Go
  • ✅ Trino SQL query execution through MCP tools
  • ✅ Catalog, schema, and table discovery
  • ✅ Docker container support
  • ✅ Supports both STDIO and HTTP transports
  • ✅ Server-Sent Events (SSE) support for Cursor and other MCP clients
  • ✅ Compatible with Cursor, Claude Desktop, Windsurf, ChatWise, and any MCP-compatible clients.

Installation

Homebrew (macOS and Linux)

The easiest way to install mcp-trino is using Homebrew:

# Add the tap repository
brew tap tuannvm/mcp

# Install mcp-trino
brew install mcp-trino

To update to the latest version:

brew update && brew upgrade mcp-trino

Alternative Installation Methods

Manual Download

  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/

Downloads

You can download pre-built binaries for your platform:

Platform Architecture Download Link
macOS x86_64 (Intel) Download
macOS ARM64 (Apple Silicon) Download
Linux x86_64 Download
Linux ARM64 Download
Windows x86_64 Download

Or see all available downloads on the GitHub Releases page.

MCP Integration

This MCP server can be integrated with several AI applications:

Using Docker Image

To use the Docker image instead of a local binary:

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

Note: The host.docker.internal special DNS name allows the container to connect to services running on the host machine. If your Trino server is running elsewhere, replace with the appropriate host.

This Docker configuration can be used in any of the below applications.

Cursor

To use with Cursor, 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>"
      }
    }
  }
}

Replace the environment variables with your specific Trino configuration.

For HTTP+SSE transport mode (supported for Cursor integration):

{
  "mcpServers": {
    "mcp-trino-http": {
      "url": "http://localhost:9097/sse"
    }
  }
}

Then start the server in a separate terminal with:

MCP_TRANSPORT=http TRINO_HOST=<HOST> TRINO_PORT=<PORT> TRINO_USER=<USERNAME> TRINO_PASSWORD=<PASSWORD> mcp-trino

Claude Desktop

To use with Claude Desktop, edit your Claude configuration file:

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

After updating the configuration, restart Claude Desktop. You should see the MCP tools available in the tools menu.

Windsurf

To use with Windsurf, 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>"
      }
    }
  }
}

Restart Windsurf to apply the changes. The Trino MCP tools will be available to the Cascade AI.

ChatWise

To use with ChatWise, follow these steps:

  1. Open ChatWise and go to Settings
  2. Navigate to the Tools section
  3. Click the "+" icon to add a new tool
  4. Select "Command Line MCP"
  5. Configure with the following details:
    • ID: mcp-trino (or any name you prefer)
    • Command: mcp-trino
    • Args: (leave empty)
    • Env: Add the following environment variables:
      TRINO_HOST=<HOST>
      TRINO_PORT=<PORT>
      TRINO_USER=<USERNAME>
      TRINO_PASSWORD=<PASSWORD>
      

Alternatively, you can import the configuration from JSON:

  1. Copy this JSON to your clipboard:
    {
      "mcpServers": {
        "mcp-trino": {
          "command": "mcp-trino",
          "args": [],
          "env": {
            "TRINO_HOST": "<HOST>",
            "TRINO_PORT": "<PORT>",
            "TRINO_USER": "<USERNAME>",
            "TRINO_PASSWORD": "<PASSWORD>"
          }
        }
      }
    }
    
  2. In ChatWise Settings > Tools, click the "+" icon
  3. Select "Import JSON from Clipboard"
  4. Toggle the switch next to the tool to enable it

Once enabled, click the hammer icon below the input box in ChatWise to access Trino MCP tools.

Available MCP Tools

The server provides the following MCP tools:

execute_query

Execute a SQL query against Trino with full SQL support for complex analytical queries.

Sample Prompt:

"How many customers do we have per region? Can you show them in descending order?"

Example:

{
  "query": "SELECT region, COUNT(*) as customer_count FROM tpch.tiny.customer GROUP BY region ORDER BY customer_count DESC"
}

Response:

{
  "columns": ["region", "customer_count"],
  "data": [
    ["AFRICA", 5],
    ["AMERICA", 5],
    ["ASIA", 5],
    ["EUROPE", 5],
    ["MIDDLE EAST", 5]
  ]
}

list_catalogs

List all catalogs available in the Trino server, providing a comprehensive view of your data ecosystem.

Sample Prompt:

"What databases do we have access to in our Trino environment?"

Example:

{}

Response:

{
  "catalogs": ["tpch", "memory", "system", "jmx"]
}

list_schemas

List all schemas in a catalog, helping you navigate through the data hierarchy efficiently.

Sample Prompt:

"What schemas or datasets are available in the tpch catalog?"

Example:

{
  "catalog": "tpch"
}

Response:

{
  "schemas": ["information_schema", "sf1", "sf100", "sf1000", "tiny"]
}

list_tables

List all tables in a schema, giving you visibility into available datasets.

Sample Prompt:

"What tables are available in the tpch tiny schema? I need to know what data we can query."

Example:

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

Response:

{
  "tables": ["customer", "lineitem", "nation", "orders", "part", "partsupp", "region", "supplier"]
}

get_table_schema

Get the schema of a table, understanding the structure of your data for better query planning.

Sample Prompt:

"What columns are in the customer table? I need to know the data types and structure before writing my query."

Example:

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

Response:

{
  "columns": [
    {
      "name": "custkey",
      "type": "bigint",
      "nullable": false
    },
    {
      "name": "name",
      "type": "varchar",
      "nullable": false
    },
    {
      "name": "address",
      "type": "varchar",
      "nullable": false
    },
    {
      "name": "nationkey",
      "type": "bigint",
      "nullable": false
    },
    {
      "name": "phone",
      "type": "varchar",
      "nullable": false
    },
    {
      "name": "acctbal",
      "type": "double",
      "nullable": false
    },
    {
      "name": "mktsegment",
      "type": "varchar",
      "nullable": false
    },
    {
      "name": "comment",
      "type": "varchar",
      "nullable": false
    }
  ]
}

This information is invaluable for understanding the column names, data types, and nullability constraints before writing queries against the table.

End-to-End Example

Here's a complete interaction example showing how an AI assistant might use these tools to answer a business question:

User Query: "Can you help me analyze our biggest customers? I want to know the top 5 customers with the highest account balances."

AI Assistant's workflow:

  1. First, discover available catalogs

    > Using list_catalogs tool
    > Discovers tpch catalog
    
  2. Then, find available schemas

    > Using list_schemas tool with catalog "tpch"
    > Discovers "tiny" schema
    
  3. Explore available tables

    > Using list_tables tool with catalog "tpch" and schema "tiny"
    > Finds "customer" table
    
  4. Check the customer table schema

    > Using get_table_schema tool
    > Discovers "custkey", "name", "acctbal" and other columns
    
  5. Finally, execute the query

    > Using execute_query tool with:
    > "SELECT custkey, name, acctbal FROM tpch.tiny.customer ORDER BY acctbal DESC LIMIT 5"
    
  6. Returns the results to the user:

    The top 5 customers with highest account balances are:
    1. Customer #65 (Customer#000000065): $9,222.78
    2. Customer #13 (Customer#000000013): $8,270.47
    3. Customer #89 (Customer#000000089): $7,990.56
    4. Customer #11 (Customer#000000011): $7,912.91
    5. Customer #82 (Customer#000000082): $7,629.41
    

This seamless workflow demonstrates how the MCP tools enable AI assistants to explore and query data in a conversational manner.

Configuration

The server can be configured using the following 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
MCP_TRANSPORT Transport method (stdio/http) stdio
MCP_PORT HTTP port for http transport 9097
MCP_HOST Host for HTTP callbacks localhost

Note: When TRINO_SCHEME is set to "https", TRINO_SSL is automatically set to true regardless of the provided value.

Important: The default connection mode is HTTPS. If you're using an HTTP-only Trino server, you must set TRINO_SCHEME=http in your environment variables.

For Cursor Integration: When using with Cursor, set MCP_TRANSPORT=http and connect to the /sse endpoint. The server will automatically handle SSE (Server-Sent Events) connections.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

CI/CD and Releases

This project uses GitHub Actions for continuous integration and GoReleaser for automated releases.

Continuous Integration Checks

Our CI pipeline performs the following checks on all PRs and commits to the main branch:

Code Quality

  • Linting: Using golangci-lint to check for common code issues and style violations
  • Go Module Verification: Ensuring go.mod and go.sum are properly maintained
  • Formatting: Verifying code is properly formatted with gofmt

Security

  • Vulnerability Scanning: Using govulncheck to check for known vulnerabilities in dependencies
  • Dependency Scanning: Using Trivy to scan for vulnerabilities in dependencies (CRITICAL, HIGH, and MEDIUM)
  • SBOM Generation: Creating a Software Bill of Materials for dependency tracking
  • SLSA Provenance: Creating verifiable build provenance for supply chain security

Testing

  • Unit Tests: Running tests with race detection and code coverage reporting
  • Build Verification: Ensuring the codebase builds successfully

CI/CD Security

  • Least Privilege: Workflows run with minimum required permissions
  • Pinned Versions: All GitHub Actions use specific versions to prevent supply chain attacks
  • Dependency Updates: Automated dependency updates via Dependabot

Release Process

When changes are merged to the main branch:

  1. CI checks are run to validate code quality and security
  2. If successful, a new release is automatically created with:
    • Semantic versioning based on commit messages
    • Binary builds for multiple platforms
    • Docker image publishing to GitHub Container Registry
    • SBOM and provenance attestation

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python