Provides comprehensive integration with Metabase instances including creating models, SQL queries, metrics, and dashboards through the Metabase API, with AI-powered features for natural language SQL generation and intelligent dashboard creation.
Enables direct PostgreSQL database connections for schema discovery, table relationship detection, SQL query execution, and safe DDL operations with AI object prefix controls for security.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Metabase AI Assistantcreate a dashboard showing monthly sales trends by region"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
š Metabase AI Assistant
The Most Powerful MCP Server for Metabase
134 Tools ⢠MCP SDK v1.26.0 ⢠AI-Powered SQL ⢠Structured Output ⢠Enterprise Security
Turn your AI assistant into a Metabase power user.
Generate SQL from natural language, create dashboards, manage users, and automate BI workflows.
š¦ Install Now ⢠š Documentation ⢠šÆ Features ⢠ā Star Us
Related MCP server: MCP PostgreSQL Server
ā Why This Project?
"I analyzed every Metabase MCP server on the market. This one has 4x more tools and features than any competitor."
Feature | This Project | Other MCP Servers |
Total Tools | 134 ā | 6-30 |
AI SQL Generation | ā | ā |
AI SQL Optimization | ā | ā |
Dashboard Templates | ā | ā |
User Management | ā | ā |
Workspace Export/Import | ā | ā |
Read-Only Security Mode | ā | ā |
Response Caching | ā | ā |
Activity Logging | ā | ā |
Metadata Analytics | ā | ā |
Parametric Questions | ā | ā |
Environment Comparison | ā | ā |
Structured Output (JSON) | ā | ā |
Tool Annotations | ā | ā |
š Quick Start
One-Line Install
npx metabase-ai-assistantAdd to Claude Desktop / Cursor
{
"mcpServers": {
"metabase": {
"command": "npx",
"args": ["-y", "metabase-ai-assistant"],
"env": {
"METABASE_URL": "https://your-metabase.com",
"METABASE_API_KEY": "mb_your_api_key"
}
}
}
}That's it! Your AI assistant now has full Metabase superpowers. š¦ø
šÆ What Can You Do?
š¬ Natural Language ā SQL
You: "Show me total revenue by product category for the last 30 days"
AI: Uses ai_sql_generate ā Runs query ā Returns formatted resultsš Instant Dashboard Creation
You: "Create an executive dashboard for our e-commerce sales"
AI: Uses mb_dashboard_template_executive ā Creates fully configured dashboardš Deep Database Exploration
You: "What tables are related to 'orders' and show their relationships"
AI: Uses db_relationships_detect ā Returns complete ER diagram infoš”ļø Enterprise-Grade Security
You: "DROP TABLE users"
AI: š Blocked - Read-only mode activeš§ Complete Tool List (134)
š All tools include MCP annotations and
title. 16 priority tools supportoutputSchema+structuredContentfor typed JSON responses.
Tool | Description |
| List all databases |
| Get schemas in a database |
| Get tables with fields |
| Execute SQL queries |
| Create tables (AI-prefixed) |
| Create views |
| Create materialized views |
| Create indexes |
| VACUUM and ANALYZE |
| EXPLAIN query plans |
| Table statistics |
| Index usage analysis |
| Fast schema exploration |
| Deep schema analysis |
| Detect foreign keys |
...and more |
Tool | Description |
| Natural language ā SQL |
| Query optimization suggestions |
| Explain SQL in plain English |
| Suggest table relationships |
| Auto-generate descriptions |
Tool | Description |
| Create new questions |
| List all questions |
| Parametric questions |
| Get card details |
| Update cards |
| Delete cards |
| Archive cards |
| Get card data as JSON |
| Copy cards |
| Clone cards |
...and more |
Tool | Description |
| Create dashboards |
| List all dashboards |
| Get dashboard details |
| Update dashboards |
| Delete dashboards |
| Add cards to dashboard |
| Add filters |
| Optimize layout |
| Executive templates |
...and more |
Tool | Description |
| List users |
| Get user details |
| Create users |
| Update users |
| Disable users |
| List groups |
| Create groups |
...and more |
Tool | Description |
| Instance health check |
| Query analytics |
| Content usage stats |
| User activity |
| Table dependencies |
| Breaking change analysis |
| Index suggestions |
| Backup to JSON |
| Import dry-run |
| Dev vs Prod diff |
| Safe cleanup |
...and more |
š”ļø Security Features
Feature | Description |
š Read-Only Mode | Blocks INSERT, UPDATE, DELETE, DROP (default: enabled) |
š·ļø AI Prefix | All AI-created objects use |
ā Explicit Approval | Destructive operations require confirmation |
š Activity Logging | Full audit trail of all operations |
š Env Validation | Zod-validated environment variables |
š¾ Auto-Backup | Prompts for backup before destructive ops |
# Enable/disable read-only mode
METABASE_READ_ONLY_MODE=true # Default: blocks write ops
METABASE_READ_ONLY_MODE=false # Allow write operationsāļø Configuration
Create a .env file:
# Required
METABASE_URL=https://your-metabase.com
METABASE_API_KEY=mb_your_api_key
# Or use username/password
# METABASE_USERNAME=admin@example.com
# METABASE_PASSWORD=your_password
# Security (defaults to true)
METABASE_READ_ONLY_MODE=true
# AI Features (optional)
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
# Performance (optional)
CACHE_TTL_MS=600000 # 10 minutesš¦ Installation Options
npm (Recommended)
npm install -g metabase-ai-assistantDocker
docker run -e METABASE_URL=... -e METABASE_API_KEY=... ghcr.io/enessari/metabase-ai-assistantFrom Source
git clone https://github.com/enessari/metabase-ai-assistant.git
cd metabase-ai-assistant
npm install
npm run mcpšļø Architecture
metabase-ai-assistant/
āāā src/
ā āāā mcp/
ā ā āāā server.js # MCP Server entry point
ā ā āāā tool-registry.js # 134 tool definitions + annotations + outputSchema
ā ā āāā tool-router.js # Dynamic routing with read-only gate
ā ā āāā handlers/ # 15 modular handler files
ā āāā utils/
ā ā āāā structured-response.js # Structured output (MCP 2025-06-18)
ā ā āāā cache.js # TTL-based caching
ā ā āāā config.js # Zod validation
ā ā āāā response-optimizer.js # Compact response formatting
ā āāā metabase/
ā āāā client.js # Metabase API clientš¤ Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
# Fork, clone, install
git clone https://github.com/YOUR_USERNAME/metabase-ai-assistant.git
npm install
# Create feature branch
git checkout -b feature/amazing-feature
# Test and submit PR
npm test
git push origin feature/amazing-featureš Resources
š License
Apache License 2.0 - see LICENSE
ā Star this repo if it helps you!
Built with ā¤ļø by
Keywords: Metabase MCP Server, Model Context Protocol, AI SQL Generation, Business Intelligence, Claude AI, Cursor AI, Natural Language SQL, Dashboard Automation, PostgreSQL, Data Analytics, LLM Tools