A high-performance Model Context Protocol (MCP) server that lets AI assistants run SQL against Trino from Go.
https://github.com/tuannvm/mcp-trinoYour AI assistant can now query your Trino clusters directly. No more copying SQL back and forth, no more manual schema exploration – just ask questions in plain English and get answers from your data warehouse.
If you're running Trino for analytics, you know the drill: someone asks "What were our top customers last quarter?" and you end up writing SQL, running it, formatting results, then explaining what you found. Now your AI assistant handles the entire workflow.
Instead of this manual process:
-- You manually write:
SHOW CATALOGS;
SHOW SCHEMAS FROM hive;
SHOW TABLES FROM hive.sales;
DESCRIBE hive.sales.customers;
SELECT region, COUNT(*) FROM hive.sales.customers
GROUP BY region ORDER BY COUNT(*) DESC;
You just ask:
"How many customers do we have per region? Show them in descending order."
The AI discovers your schema, understands your data structure, writes the query, executes it, and explains the results – all in one conversation.
This isn't a prototype. It's a production-ready MCP server built in Go with:
Your assistant explores your data warehouse intelligently:
AI: "Let me check what data you have available..."
→ Discovers catalogs: production, staging, analytics
→ Finds schemas: sales, marketing, finance
→ Maps tables: customers, orders, campaigns
→ Understands columns: names, types, relationships
Ask business questions, get SQL answers:
"Show me our revenue trend by quarter"
-- AI generates and executes:
SELECT
YEAR(order_date) as year,
QUARTER(order_date) as quarter,
SUM(total_amount) as revenue
FROM sales.orders
GROUP BY YEAR(order_date), QUARTER(order_date)
ORDER BY year, quarter;
"Which product categories are underperforming?"
-- AI writes:
WITH category_performance AS (
SELECT
p.category,
SUM(oi.quantity * oi.unit_price) as revenue,
COUNT(DISTINCT o.order_id) as order_count
FROM sales.orders o
JOIN sales.order_items oi ON o.order_id = oi.order_id
JOIN catalog.products p ON oi.product_id = p.product_id
WHERE o.order_date >= DATE '2024-01-01'
GROUP BY p.category
)
SELECT category, revenue, order_count
FROM category_performance
WHERE revenue < (SELECT AVG(revenue) FROM category_performance)
ORDER BY revenue ASC;
Homebrew (Recommended):
brew tap tuannvm/mcp
brew install mcp-trino
Docker (For Containerized Deployments):
docker run -e TRINO_HOST=your-trino-host ghcr.io/tuannvm/mcp-trino:latest
Binary Download: Grab the appropriate binary for your platform from GitHub Releases.
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"trino": {
"command": "mcp-trino",
"env": {
"TRINO_HOST": "your-cluster.company.com",
"TRINO_PORT": "8443",
"TRINO_USER": "your-username"
}
}
}
}
Update your Claude config:
{
"mcpServers": {
"trino": {
"command": "mcp-trino",
"env": {
"TRINO_HOST": "your-cluster.company.com",
"TRINO_USER": "your-username",
"TRINO_PASSWORD": "your-password"
}
}
}
}
Works with Windsurf, ChatWise, and any MCP-compatible client.
Here's how a typical data analysis session looks:
You: "I need to analyze customer churn. What data do we have?"
AI Assistant:
analytics.customers with signup dates, and transaction data in sales.orders. I can analyze churn by looking at customers who haven't made purchases recently."You: "Perfect. Show me customers who haven't ordered in the last 90 days."
AI Assistant:
SELECT
c.customer_id,
c.email,
c.signup_date,
MAX(o.order_date) as last_order_date,
DATE_DIFF('day', MAX(o.order_date), CURRENT_DATE) as days_since_last_order
FROM analytics.customers c
LEFT JOIN sales.orders o ON c.customer_id = o.customer_id
GROUP BY c.customer_id, c.email, c.signup_date
HAVING MAX(o.order_date) < CURRENT_DATE - INTERVAL '90' DAY
OR MAX(o.order_date) IS NULL
ORDER BY days_since_last_order DESC NULLS LAST;
Returns 1,247 at-risk customers with their details.
You: "Now segment them by signup cohort."
AI Assistant: Automatically builds on the previous query, adding cohort analysis...
This server is built in Go because your data infrastructure deserves better than Node.js for high-performance SQL execution:
brew install tuannvm/mcp/mcp-trinoYour AI assistant is about to become your most productive data analyst. No SQL knowledge required on your end – just ask questions and get insights.
Links: