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 comprehensive MCP server for Metabase with 111 tools for AI-powered business intelligence.
An AI-powered Model Context Protocol (MCP) server that connects to Metabase and PostgreSQL databases. Generate SQL queries from natural language, create dashboards, manage users, and automate BI workflows with LLM integration.
Developed by Abdullah Enes SARI for ONMARTECH LLC
Table of Contents
Related MCP server: Metabase Server MCP
Features
MCP Server Integration
Native Model Context Protocol (MCP) server implementation
Compatible with AI assistants that support MCP
111 tools for comprehensive Metabase control
Direct PostgreSQL database connections
Hybrid connection management (API + Direct DB)
AI-Powered Capabilities
Natural language to SQL query generation
SQL query optimization with performance suggestions
Query explanation in plain English
Auto-describe database schemas
Relationship detection between tables
Database Operations (25 tools)
List databases, schemas, and tables
Execute SQL queries with timeout control
Create views, materialized views, and indexes
VACUUM, ANALYZE, and EXPLAIN operations
Table statistics and index usage analysis
Safe DDL with prefix protection
Question and Card Management (12 tools)
Create, update, delete, and archive questions
Parametric questions with dynamic filters
Get card data in JSON format
Copy and clone cards between collections
Dashboard Management (14 tools)
Create and manage dashboards
Add/remove cards with positioning
Dashboard filters and parameters
Executive dashboard templates
Layout optimization
User and Permission Management (10 tools)
User CRUD operations
Permission group management
Collection permissions
Role-based access control
š Metadata & Analytics (14 tools)
Phase 1: Core Analytics
Query Performance Analysis: Execution times, cache hit rates, slow query detection
Content Usage Insights: Popular/unused questions & dashboards, orphaned cards
User Activity Analytics: Active/inactive users, login patterns, license optimization
Database Usage Stats: Query patterns by database and table
Dashboard Complexity Analysis: Identify optimization opportunities
Metadata Overview: Quick health check of your Metabase instance
Phase 2: Advanced Analytics
Table Dependencies: Find all questions/dashboards depending on a table
Impact Analysis: Analyze breaking changes before table removal with severity assessment
Optimization Recommendations: Index suggestions, materialized view candidates, cache optimization
Error Pattern Analysis: Categorize recurring errors, identify problematic questions
Phase 3: Export/Import & Migration (š Safety-First)
Workspace Export: Backup collections, questions, and dashboards to JSON (READ-ONLY)
Import Preview: Dry-run impact analysis before importing (conflict detection, risk assessment)
Environment Comparison: Compare dev ā staging ā prod environments for drift detection (READ-ONLY)
Auto-Cleanup: Identify and remove unused content with safety checks (DRY-RUN by default, requires approval)
Powered by direct access to Metabase's application database
Additional Features
Metric and segment creation
Alert and pulse management
Bookmark management
Global search across Metabase
Activity logging and analytics
Metabase documentation search
Installation
Requirements
Node.js 18 or higher
Metabase instance (v0.48+)
PostgreSQL database (for direct connections)
Quick Start with npm (Recommended)
Install from Source
Configuration
Create a .env file with the following variables:
Security Note: Never commit the .env file to version control.
MCP Integration
MCP Registry
This server is published to the official MCP Registry:
Configuration for AI Assistants
Add the following to your MCP client configuration (Claude Desktop, Cursor, etc.):
Testing the MCP Server
Available Tools
Database Operations
Tool | Description |
| List all databases in Metabase |
| Get schema names for a database |
| Get tables with field counts |
| Test database response time |
| Execute SQL queries |
| Get connection details (admin) |
| Create tables (with prefix) |
| Create views |
| Create materialized views |
| Create indexes |
| Fast schema exploration |
| Deep schema analysis |
| Detect foreign keys |
| Trigger schema sync |
AI Features
Tool | Description |
| Generate SQL from natural language |
| Optimize query performance |
| Explain SQL in plain English |
| Suggest table relationships |
| Auto-generate descriptions |
Question/Card Operations
Tool | Description |
| Create new question |
| List questions |
| Create parametric question |
| Get card details |
| Update card |
| Delete card |
| Archive card |
| Get card data |
| Copy card |
| Clone card |
Dashboard Operations
Tool | Description |
| Create dashboard |
| List dashboards |
| Get dashboard details |
| Update dashboard |
| Delete dashboard |
| Add card to dashboard |
| Add dashboard filter |
| Optimize layout |
| Create executive dashboard |
| Copy dashboard |
User Management
Tool | Description |
| List all users |
| Get user details |
| Create user |
| Update user |
| Disable user |
| List permission groups |
| Create group |
| Delete group |
Search and Utilities
Tool | Description |
| Global search |
| Create bookmark |
| List bookmarks |
| Invalidate cache |
| Search documentation |
Usage Examples
Generate SQL from Natural Language
Create Executive Dashboard
Search Across Metabase
Phase 3: Safe Workspace Management
Export Workspace (READ-ONLY - Always Safe):
Preview Import Impact (DRY-RUN - Always Safe):
Compare Environments (READ-ONLY - Always Safe):
Auto-Cleanup with Safety (REQUIRES APPROVAL):
Security
Credential Protection
All credentials stored in environment variables
No hardcoded secrets in source code
.envfile excluded from version control
Database Safety
AI-created objects use
claude_ai_prefixDDL operations require explicit approval
Dry-run mode enabled by default
Phase 3 Safety Features
Export/Import Safety:
Export (READ-ONLY): No modifications to your instance, safe to run anytime
Import Preview (DRY-RUN): Always preview before importing
Conflict detection (name collisions, duplicate IDs)
Risk assessment (HIGH/MEDIUM/LOW)
Severity-based warnings with recommendations
Backup reminder before execution
Environment Comparison Safety:
READ-ONLY Operation: No changes made during comparison
Drift Detection: Identifies missing or different items between environments
Promotion Workflow: Supports dev ā staging ā production workflow
Auto-Cleanup Safety (Multi-Layer Protection):
Default Dry-Run Mode:
dry_run: trueby default (preview only)Explicit Approval Required: Must set
approved: trueto executeDual-Lock System: Both
dry_run: falseANDapproved: truerequiredBackup Recommendation: Always prompts for backup before execution
Configurable Thresholds:
Unused content: default 180 days (adjustable)
Orphaned cards: optional toggle
Empty collections: optional toggle
Broken questions: >50% error rate threshold
Safety Checks Report:
Verify backup created
Check for critical items
Validate cleanup scope
Warning if total items > threshold
Execution Blocking: Automatically blocks if approval not given
Best Practices:
Always run dry-run first to review items
Export workspace before any destructive operation
Review all warnings and recommendations
Test import in non-production environment first
Regular environment comparisons to detect drift early
Audit and Compliance
Activity logging for all operations
Error analysis and performance insights
Supports GDPR and SOC 2 requirements
See SECURITY.md for full security policy.
Deployment
PM2 (Recommended)
Docker
Systemd (Linux)
API Reference
MetabaseClient
MetabaseAIAssistant
Project Structure
Contributing
Contributions are welcome. Please follow these steps:
Fork the repository
Create a feature branch (
git checkout -b feature/new-feature)Commit changes (
git commit -m 'Add new feature')Push to branch (
git push origin feature/new-feature)Open a Pull Request
Guidelines
Write tests for new features
Follow existing code style
Update documentation as needed
Use conventional commit messages
Troubleshooting
Connection Issues
Verify Metabase URL is accessible
Check API key validity
Confirm network connectivity
MCP Issues
Ensure Node.js 18+ is installed
Verify environment variables are set
Test server directly:
node src/mcp/server.js
Query Errors
Validate SQL syntax
Check table and column names
Verify database permissions
Comparison with Alternatives
This implementation provides the most comprehensive Metabase MCP integration available:
Feature | This Project | Others |
Total Tools | 111 | 20-30 |
User Management | Yes | Limited |
Direct DDL | Yes | No |
AI SQL Generation | Yes | No |
Dashboard Templates | Yes | No |
Activity Logging | Yes | No |
Parametric Questions | Yes | No |
Workspace Export/Import | Yes | No |
Environment Comparison | Yes | No |
Keywords
Metabase, MCP, Model Context Protocol, AI, Business Intelligence, SQL, PostgreSQL, Dashboard, Analytics, LLM, Natural Language SQL, Query Builder, Data Visualization, BI Tools, Database Management, API Integration, Automation
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Copyright 2024-2026 ONMARTECH LLC
Author
Abdullah Enes SARI
Company: ONMARTECH LLC
GitHub: @enessari
Acknowledgments
Metabase Team for the excellent BI platform
MCP Protocol contributors
Open source community
Support
GitHub Issues: Report bugs
Documentation: Wiki
npm Package: metabase-ai-assistant
Commercial Support: contact@onmartech.com