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.
Metabase AI Assistant 🤖
AI-powered assistant that connects to Metabase and PostgreSQL databases directly via Model Context Protocol (MCP) for Claude Desktop and Claude Code. Creates models, SQL queries, metrics, and dashboards using both Metabase API and direct database connections.
🚀 MCP Server for Claude Desktop & Claude Code - Metabase + Direct DB Access
⭐ If you find this project useful, please give it a star! ⭐
🚀 Features
🔌 MCP Integration (Claude Desktop & Claude Code)
- Model Context Protocol: Native integration with Claude Desktop and Claude Code
- Direct Database Access: Direct PostgreSQL database connections
- Metabase API Integration: Full integration with Metabase instances
- Schema Discovery: Automatic database schema discovery and analysis
- Relationship Detection: Table relationship detection and suggestions
🤖 AI-Powered Features
- Natural Language SQL: Generate SQL queries from natural language descriptions
- Smart Model Building: AI-assisted Metabase model creation
- Intelligent Dashboards: Automatic dashboard layout and widget suggestions
- Query Optimization: SQL query performance optimization
- Data Insights: Data analysis and pattern detection
🛠️ Developer Tools
- DDL Operations: Safe table/view/index creation (prefix-protected)
- Batch Operations: Bulk data processing operations
- Connection Management: Hybrid connection management (API + Direct)
- Security Controls: AI object prefix control and approval workflows
- Performance Monitoring: Operation timing and timeout controls
📋 Requirements
🖥️ System
- Node.js 18+
- Claude Desktop (for MCP support) OR Claude Code
- PostgreSQL Database (for direct connections)
🔗 Services
- Metabase instance (v0.48+)
- Anthropic API (included in Claude Desktop/Code)
🔧 Installation
⚙️ Configuration
Edit the .env
file:
⚠️ Security Warning: Never commit the .env
file to version control. This file is already included in .gitignore
.
🔌 Claude Desktop & Claude Code Integration (MCP)
This project integrates with Claude Desktop and Claude Code via Model Context Protocol (MCP):
For Claude Desktop:
- Edit Claude Desktop Config:
~/Library/Application Support/Claude/claude_desktop_config.json
:
- Restart Claude Desktop and MCP tools will be available.
For Claude Code:
Claude Code can use this MCP server directly via global installation:
Step 1: Global Installation
Step 2: Environment Setup
Ensure your .env
file is properly configured with your Metabase credentials:
Step 3: Test MCP Server
Step 4: Verify Integration
In Claude Code, ask: "What MCP tools do you have available?"
You should see 27 Metabase AI Assistant tools available:
📊 Database Tools:
db_list
- List all Metabase databasesdb_schemas
- Get schema informationdb_tables
- List tables with detailssql_execute
- Run SQL queries
🎯 Metabase Tools:
mb_question_create
- Create questions/chartsmb_dashboard_create
- Create dashboardsmb_dashboard_template_executive
- Auto-generate executive dashboardsmb_question_create_parametric
- Create parametric questions
🔍 AI-Powered Tools:
ai_sql_generate
- Generate SQL from natural languageai_sql_optimize
- Optimize SQL performanceai_sql_explain
- Explain SQL queries
📚 Documentation Tools:
web_explore_metabase_docs
- Crawl Metabase documentationweb_search_metabase_docs
- Search documentation
The server provides comprehensive Metabase and PostgreSQL integration with 27 tools for:
- Database schema exploration and analysis
- Natural language SQL query generation and optimization
- Executive dashboard templates and parametric questions
- Direct DDL operations with security controls
- Metabase documentation crawling and search
- Table relationship detection and mapping
🎯 Usage
Interactive CLI
Programmatic Usage
📚 Örnek Senaryolar
1. E-Ticaret Dashboard'u
2. Müşteri Analizi
3. Finansal Raporlama
🛠️ CLI Komutları
Interaktif CLI'da kullanılabilir komutlar:
- 📊 Create Model: AI ile model oluştur
- ❓ Create Question: SQL sorgusu oluştur
- 📈 Create Metric: Metrik tanımla
- 📋 Create Dashboard: Dashboard hazırla
- 🔍 Explore Schema: Veritabanı şemasını incele
- 🚀 Execute SQL: SQL sorgusu çalıştır
- 🔧 Optimize Query: Sorgu optimize et
- 💡 AI Query Builder: Doğal dilde sorgu oluştur
📂 Proje Yapısı
🔍 API Referansı
MetabaseClient
MetabaseAIAssistant
🧪 Test
🔒 Security
Data Security
- Environment Variables: All sensitive data (API keys, passwords) stored in
.env
file - Git Ignore:
.env
file excluded from version control - SQL Injection Protection: Parameterized queries and input validation
- Rate Limiting: API request rate limiting applied
- Audit Logging: All database operations logged for security monitoring
- No Hardcoded Credentials: Security-first approach prevents credential exposure
Database Security
- AI Object Prefix: All AI-created objects marked with
claude_ai_
prefix for safety - Schema Isolation: Operations limited to specified schemas only
- Read-Only Mode: Default read-only permissions with explicit approval for modifications
- DDL Approval System: Database changes require explicit confirmation
- Prefix Validation: Only AI-prefixed objects can be modified or deleted
MCP Security
- Secure Transport: MCP communication over secure channels
- Environment Isolation: Credentials passed via environment variables
- Tool Validation: All tool inputs validated before execution
- Error Handling: Sensitive information filtered from error messages
Production Deployment
- Use environment-specific configuration files
- Prefer SSL/TLS connections for all database communications
- Grant minimum required permissions to database users
- Protect API endpoints with authentication and authorization
- Regularly rotate API keys and database passwords
- Monitor and log all tool usage for security auditing
🐛 Troubleshooting
Connection Errors
- Verify Metabase URL is accessible
- Ensure API key and credentials are valid
- Check network connectivity and firewall settings
- Confirm environment variables are properly set
MCP Integration Issues
- Ensure
npm link
was run successfully - Verify MCP server binary is in PATH:
which metabase-ai-mcp
- Check environment variables are exported:
echo $METABASE_URL
- Test MCP server directly:
node src/mcp/server.js
- Restart Claude Code after global installation
Query Errors
- Validate SQL syntax and formatting
- Verify table and column names exist
- Check database permissions and schema access
- Ensure proper schema selection for operations
Security Warnings
- Never commit
.env
files to version control - Avoid hardcoding credentials in source code
- Use prefix validation for AI-created objects
- Monitor database operations for security compliance
🚀 Production Deployment
Option 1: PM2 Process Manager (Recommended)
Option 2: Docker Container
Option 3: Cloud Deployment
- Railway: One-click deploy with
railway.json
- Heroku: Deploy with Heroku CLI (see
deploy/heroku-deploy.md
) - DigitalOcean: App Platform with Docker
- AWS: ECS Fargate or EC2 with systemd service
Option 4: Systemd Service (Linux)
Production Scripts
📈 Roadmap
- Natural Language Processing geliştirmeleri
- Görsel sorgu builder
- Otomatik dashboard öneri sistemi
- Multi-database desteği
- Real-time data streaming
- Advanced ML modelleri
🤝 Katkıda Bulunma
Bu projeyi beğendiyseniz ve geliştirmesine katkıda bulunmak istiyorsanız:
⭐ Projeyi Destekleyin
- GitHub'da Star Verin: Projeyi faydalı bulduysanız ⭐ star verin
- Follow Edin: Güncellemelerden haberdar olmak için @onmartech hesabını takip edin
- Share Edin: Sosyal medyada paylaşın ve arkadaşlarınıza önerin
🔧 Geliştirmeye Katılın
- Fork yapın
- Feature branch oluşturun (
git checkout -b feature/yeni-ozellik
) - Değişikliklerinizi commit yapın (
git commit -m 'feat: Yeni özellik eklendi'
) - Push yapın (
git push origin feature/yeni-ozellik
) - Pull Request açın
💡 Katkı Fikirleri
- Yeni AI modeli entegrasyonları
- Dashboard template'leri
- Metabase connector'ları
- Dokümantasyon iyileştirmeleri
- Bug fixes ve performans optimizasyonları
📋 Katkı Kuralları
- Kod değişikliklerinde test yazın
- Commit mesajlarında Conventional Commits kullanın
- ESLint ve Prettier ayarlarına uyun
- Değişikliklerinizi dokümante edin
📄 Lisans
MIT License - Detaylar için LICENSE dosyasına bakın. Copyright (c) 2024 ONMARTECH LLC
👥 Destek ve İletişim
🐛 Bug Reports & Feature Requests
- GitHub Issues: Issues sayfası
- Bug Template: Issue açarken template'leri kullanın
- Feature Requests: Hangi özelliği istediğinizi detaylandırın
💬 Topluluk
- GitHub Discussions: Soru-cevap ve fikirler için
- Documentation: Wiki sayfalarına katkı yapın
- Examples: Örnek kullanım case'leri paylaşın
🚀 Ticari Destek
ONMARTECH LLC tarafından profesyonel destek ve customization hizmetleri mevcuttur.
🏆 Katkıda Bulunanlar
Bu projeyi mümkün kılan herkese teşekkürler:
- ONMARTECH LLC - Proje geliştirme ve bakım
- Metabase Team - Harika platform
- Open Source Community - Sürekli ilham ve geri bildirim
🌟 Hall of Fame
Önemli katkılarda bulunan geliştiriciler burada listelenecektir.
Bu projeyi faydalı bulduysanız ⭐ star vermeyi ve 🔄 share etmeyi unutmayın!
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables AI-powered interaction with Metabase instances and PostgreSQL databases through natural language. Creates models, SQL queries, metrics, and dashboards using both Metabase API and direct database connections.
- 🚀 Features
- 📋 Requirements
- 🔧 Installation
- ⚙️ Configuration
- 🔌 Claude Desktop & Claude Code Integration (MCP)
- 🎯 Usage
- 📚 Örnek Senaryolar
- 🛠️ CLI Komutları
- 📂 Proje Yapısı
- 🔍 API Referansı
- 🧪 Test
- 🔒 Security
- 🐛 Troubleshooting
- 🚀 Production Deployment
- 📈 Roadmap
- 🤝 Katkıda Bulunma
- 📄 Lisans
- 👥 Destek ve İletişim
- 🏆 Katkıda Bulunanlar
Related MCP Servers
- -securityFlicense-qualityEnables AI assistants to interact with Metabase databases and dashboards, allowing users to list and execute queries, access data visualizations, and interact with database resources through natural language.Last updated -64
- -securityFlicense-qualityEnables AI assistants to interact with Metabase, providing access to dashboards, questions, databases, and tools for executing queries and viewing data through natural language.Last updated -
- AsecurityAlicenseAqualityEnables AI models to interact with PostgreSQL databases through a standardized interface, supporting operations like queries, table manipulation, and schema inspection.Last updated -63805MIT License
- -securityAlicense-qualityEnables AI agents to interact with PostgreSQL databases through the Model Context Protocol, providing database schema exploration, table structure inspection, and SQL query execution capabilities.Last updated -13MIT License