mcp-trino mcp server for trino
v0.x ·· UTC part of txn2 ↗

project / mcp-trino

org / txn2

est. 2025

pkg.go.dev ↗

apache 2.0 · read-only by default

mcp-trino mcp · go federated sql for ai.

mcp-trino is an MCP server that gives AI assistants safe, structured access to Trino and any Trino-compatible engine. Run SELECT and SHOW queries, browse catalogs, describe tables, and inspect execution plans. Read-only by default, with row caps, query timeouts, and SLSA Level 3 provenance. Speaks to any Trino cluster: production, staging, or a local Docker container.

Run it standalone, or import it as a Go library and compose your own MCP server with custom auth, tenant isolation, and audit logging through middleware and interceptors. An optional semantic layer surfaces business descriptions, ownership, and sensitivity markers from DataHub or any metadata source. Apache 2.0, part of the txn2 mcp data platform alongside mcp-s3 and mcp-datahub.

§ 01 / install · run

Two ways to use it.

Run mcp-trino as a standalone server and wire it to Claude, Cursor, or any MCP client. Or import the Go packages and compose a custom MCP server with your own auth, tenancy, and audit logic. Same toolkit, two surfaces.

SRV-001 · go · server docs ↗

standalone server

One binary. Wire to any MCP client over stdio.

Install with brew, go install, Docker, or grab a release. Point it at any Trino cluster via environment variables. Read-only mode is the default; flip TRINO_ALLOW_WRITE=true when you mean it. Add multiple clusters through TRINO_ADDITIONAL_CONNECTIONS and let the AI pick.

~ / mcp-trino
$ brew install txn2/tap/mcp-trino

$ claude mcp add trino \
    -e TRINO_HOST=trino.example.com \
    -e TRINO_USER=$USER \
    -e TRINO_PASSWORD=$PASS \
    -e TRINO_CATALOG=hive \
    -- mcp-trino
  added: trino (read-only, 1000-row cap)

$ claude
# ask: show me top 10 customers by revenue

LIB-002 · go · library docs ↗

go library

Compose a custom MCP server. Bring your own auth.

client.New returns a configured Trino handle. tools.NewToolkit packages the SQL operations as MCP tools. Register them on your own MCPServer, then attach Use middleware, interceptors, and transformers for redaction or audit logging. No forking required.

~ / library
$ go get github.com/txn2/mcp-trino

// main.go
trino, _ := client.New(client.FromEnv())
defer trino.Close()

kit := tools.NewToolkit(trino,
    tools.DefaultConfig(),
)
kit.RegisterAll(srv)
kit.Use(authMiddleware)

§ 02 / what it does

Trino as tools. With context.

mcp-trino exposes Trino as a small, deliberate set of MCP tools. Each tool maps to one operation, with strict input validation, row caps, query timeouts, and clear error contracts. An optional semantic layer adds business context to the technical schema.

  1. 001
    query, browse, describe

    trino_query for read-only SQL (SELECT, SHOW, DESCRIBE), trino_browse for catalog hierarchy, trino_describe_table for columns and samples. The read-side surface that is always safe to expose.

    tools
  2. 002
    read-only by default

    trino_query rejects non-read SQL. trino_execute exists for write ops but is opt-in. Row caps via limit param (max 10000), query timeouts via timeout_seconds, configurable defaults per deployment.

    safety
  3. 003
    multi-cluster

    Configure several Trino clusters via TRINO_ADDITIONAL_CONNECTIONS. Query production, staging, and a local Docker Trino from the same MCP install. trino_list_connections lets the AI pick.

    runtime
  4. 004
    semantic context

    Surface business descriptions, ownership, data quality, and sensitivity markers from DataHub, static YAML, or a custom provider. Tables stop being opaque names; the AI sees what they mean and who owns them.

    context
  5. 005
    explain plans

    trino_explain returns LOGICAL, DISTRIBUTED, IO, or VALIDATE plans. The AI can spot full scans, join orders, and data volumes before running the query, which keeps users out of trouble.

    analyze
  6. 006
    middleware & interceptors

    Wrap tool execution with Use middleware. Block or rewrite requests with interceptors. Redact, audit, or transform results post-execution. Compose enterprise concerns without forking the toolkit.

    compose
  7. ···
    part of the txn2 mcp data platform

    Sister projects: mcp-s3 for object storage, mcp-datahub for metadata, mcp-data-platform as the catalog.

    + ecosystem

// open source

mcp-trino is one of several open source components by Craig Johnston, sponsored by Deasil Works, Inc. and Plexara. Released under the Apache 2.0 license. Built to give AI assistants a safe, composable bridge to federated SQL.