Skip to main content
Glama
MisterSandFR

Supabase MCP Server - Self-Hosted Edition

by MisterSandFR
README.md‱8.98 kB
# Supabase MCP Server - Self-Hosted Edition đŸ—„ïž **Serveur MCP Supabase Self-Hosted** - Gestion complĂšte de votre instance Supabase privĂ©e ## 🌟 FonctionnalitĂ©s - 🔐 **Gestion complĂšte** de votre instance Supabase privĂ©e - đŸ› ïž **54+ outils MCP** pour l'administration Supabase - 📊 **Monitoring** et mĂ©triques en temps rĂ©el - 🚀 **DĂ©ploiement automatique** sur Railway - 🔒 **SĂ©curitĂ© renforcĂ©e** avec prĂ©vention SQL injection - ⚡ **Performance optimisĂ©e** pour la production ## đŸ—ïž Architecture Ce repository contient **uniquement** le serveur MCP Supabase pur, sans interface web ni hub central. ``` Supabase MCP Server (Port 8000) ├── đŸ—„ïž Gestion de base de donnĂ©es ├── 🔐 Authentification et autorisation ├── 📁 Stockage et fichiers ├── 🔄 Temps rĂ©el et subscriptions ├── đŸ› ïž Migrations et schĂ©mas ├── 📊 Monitoring et logs └── 🚀 DĂ©ploiement automatique ``` ## 🚀 DĂ©marrage Rapide ### PrĂ©requis - Python 3.11+ - Instance Supabase (self-hosted ou cloud) - Variables d'environnement Supabase ### Option A — SDK Smithery (recommandĂ©) ```bash # Cloner le repository git clone https://github.com/MisterSandFR/Supabase-MCP-SelfHosted.git cd Supabase-MCP-SelfHosted # Installer les dĂ©pendances pip install -r requirements.txt # (Facultatif) Installer la CLI Smithery si besoin npm i -g @smithery/cli # Lancer le dev SDK (selon votre environnement) smithery dev # ou: smithery playground ``` - Le serveur SDK est dĂ©fini dans `pyproject.toml` via: - `[tool.smithery] server = "supabase_mcp_server.server:create_server"` - Lors du dĂ©ploiement dans l’interface Smithery, configurez le Test Profile puis lancez le Scan. ### Option B — HTTP self-hosted (compat) ```bash # Cloner le repository git clone https://github.com/MisterSandFR/Supabase-MCP-SelfHosted.git cd Supabase-MCP-SelfHosted # Installer les dĂ©pendances Python pip install -r requirements.txt # Configurer les variables d'environnement export SUPABASE_URL="https://your-project.supabase.co" export SUPABASE_ANON_KEY="your-anon-key" export SUPABASE_SERVICE_KEY="your-service-key" # Optionnel # DĂ©marrer le serveur HTTP externe python src/supabase_server.py ``` ### Avec Docker (Railway / self-hosted) ```bash # Build et dĂ©marrage (utilisez Dockerfile.railway si besoin) docker build -f Dockerfile.railway -t supabase-mcp-server . docker run -p 8000:8000 \ -e SUPABASE_URL="https://your-project.supabase.co" \ -e SUPABASE_ANON_KEY="your-anon-key" \ supabase-mcp-server ``` ## ⚙ Configuration ### Variables d'Environnement ```bash # Supabase Configuration SUPABASE_URL=https://your-project.supabase.co SUPABASE_ANON_KEY=eyJ... (votre clĂ© anonyme) SUPABASE_SERVICE_KEY=eyJ... (optionnel, pour opĂ©rations privilĂ©giĂ©es) # Server Configuration PORT=8000 PYTHONUNBUFFERED=1 ``` ## đŸ› ïž Outils MCP Disponibles ### Base de DonnĂ©es (15 outils) - `execute_sql` - ExĂ©cution de requĂȘtes SQL - `list_tables` - Liste des tables - `inspect_schema` - Inspection du schĂ©ma - `apply_migration` - Application de migrations - `backup_database` - Sauvegarde de base - `restore_database` - Restauration de base - `vacuum_analyze` - Optimisation de base - `get_database_stats` - Statistiques de base - `create_index` - CrĂ©ation d'index - `drop_index` - Suppression d'index - `list_extensions` - Liste des extensions - `manage_extensions` - Gestion des extensions - `execute_psql` - Commandes psql - `check_health` - VĂ©rification de santĂ© - `get_database_connections` - Connexions de base ### Authentification (8 outils) - `list_auth_users` - Liste des utilisateurs - `create_auth_user` - CrĂ©ation d'utilisateur - `update_auth_user` - Mise Ă  jour d'utilisateur - `delete_auth_user` - Suppression d'utilisateur - `get_auth_user` - RĂ©cupĂ©ration d'utilisateur - `verify_jwt_secret` - VĂ©rification JWT - `manage_roles` - Gestion des rĂŽles - `manage_rls_policies` - Gestion des politiques RLS ### Stockage (6 outils) - `list_storage_buckets` - Liste des buckets - `list_storage_objects` - Liste des objets - `manage_storage_policies` - Gestion des politiques - `upload_file` - Upload de fichier - `download_file` - TĂ©lĂ©chargement de fichier - `delete_file` - Suppression de fichier ### Temps RĂ©el (4 outils) - `list_realtime_publications` - Liste des publications - `manage_realtime` - Gestion du temps rĂ©el - `create_subscription` - CrĂ©ation de subscription - `delete_subscription` - Suppression de subscription ### Migrations (8 outils) - `create_migration` - CrĂ©ation de migration - `list_migrations` - Liste des migrations - `push_migrations` - Push des migrations - `validate_migration` - Validation de migration - `smart_migration` - Migration intelligente - `auto_migrate` - Migration automatique - `sync_schema` - Synchronisation de schĂ©ma - `import_schema` - Import de schĂ©ma ### Monitoring (5 outils) - `get_logs` - RĂ©cupĂ©ration des logs - `metrics_dashboard` - Tableau de bord mĂ©triques - `analyze_performance` - Analyse de performance - `analyze_rls_coverage` - Analyse couverture RLS - `audit_security` - Audit de sĂ©curitĂ© ### Utilitaires (8 outils) - `generate_typescript_types` - GĂ©nĂ©ration de types TS - `generate_crud_api` - GĂ©nĂ©ration d'API CRUD - `cache_management` - Gestion du cache - `environment_management` - Gestion d'environnement - `manage_secrets` - Gestion des secrets - `manage_functions` - Gestion des fonctions - `manage_triggers` - Gestion des triggers - `manage_webhooks` - Gestion des webhooks ## 🔧 API Endpoints ### Serveur MCP (HTTP self-hosted) - `GET /health` - Health check - `POST /mcp` - Endpoint JSON-RPC principal - `GET /.well-known/mcp-config` - Configuration MCP - `GET /mcp/tools.json` - DĂ©couverte des outils (JSON) ### Outils SpĂ©cialisĂ©s - `GET /api/tools` - Liste des outils disponibles - `POST /api/execute` - ExĂ©cution d'outils ## 🚀 DĂ©ploiement ### Smithery (SDK Python) — RecommandĂ© 1. VĂ©rifiez que `pyproject.toml` contient: - `[tool.smithery] server = "supabase_mcp_server.server:create_server"` 2. Dans Smithery → Deploy, sĂ©lectionnez SDK Python 3. Configurez le Test Profile puis lancez le Scan - Requis: `SUPABASE_URL`, `SUPABASE_ANON_KEY` ### Railway (Self-hosted) ```bash # DĂ©ployer sur Railway railway login railway init railway up ``` ### Docker ```bash # Build et dĂ©ploiement docker build -t supabase-mcp-server . docker run -p 8000:8000 supabase-mcp-server ``` ### IntĂ©gration avec Hub Central Ce serveur est conçu pour ĂȘtre intĂ©grĂ© avec le [MCP Hub Central](https://github.com/coupaul/mcp-hub-central) : ```json { "servers": { "supabase": { "name": "Supabase MCP Server", "host": "supabase.mcp.coupaul.fr", "port": 8000, "path": "/", "categories": ["database", "auth", "storage", "realtime", "security", "migration", "monitoring", "performance"] } } } ``` ## đŸ§Ș Test Profile (Smithery) Lors de la connexion cĂŽtĂ© Smithery, fournissez les clĂ©s suivantes dans le Test Profile: ```json { "SUPABASE_URL": "https://your-project.supabase.co", "SUPABASE_ANON_KEY": "eyJ..." } ``` En cas de cache, re-sauvegardez le profil et relancez le Scan. ## 🔒 SĂ©curitĂ© - **Validation des entrĂ©es** pour prĂ©venir les injections SQL - **Rate limiting** par IP et utilisateur - **Audit logs** de toutes les opĂ©rations - **Chiffrement HTTPS** obligatoire en production - **Gestion des secrets** sĂ©curisĂ©e - **Politiques RLS** pour la sĂ©curitĂ© des donnĂ©es ## 📊 Monitoring Le serveur fournit un monitoring complet : - **MĂ©triques de performance** en temps rĂ©el - **Logs structurĂ©s** avec niveaux configurables - **Health checks** automatiques - **Alertes** en cas de problĂšme - **Tableau de bord** mĂ©triques - **Analyse de performance** dĂ©taillĂ©e ## đŸ€ Contribution 1. Fork le repository 2. CrĂ©er une branche feature (`git checkout -b feature/amazing-feature`) 3. Commit vos changements (`git commit -m 'Add amazing feature'`) 4. Push vers la branche (`git push origin feature/amazing-feature`) 5. Ouvrir une Pull Request ## 📄 Licence Ce projet est sous licence MIT. Voir le fichier [LICENSE](LICENSE) pour plus de dĂ©tails. ## 🙏 Remerciements - [Supabase](https://supabase.com/) pour la plateforme - [Smithery](https://smithery.ai) pour l'Ă©cosystĂšme MCP - La communautĂ© Supabase pour les contributions ## 📞 Support - 📧 Email : contact@coupaul.fr - 💬 Discord : [Serveur MCP Community](https://discord.gg/mcp) - 🐛 Issues : [GitHub Issues](https://github.com/MisterSandFR/Supabase-MCP-SelfHosted/issues) --- **Fait avec ❀ par [coupaul](https://github.com/coupaul)**

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MisterSandFR/Supabase-MCP-SelfHosted'

If you have feedback or need assistance with the MCP directory API, please join our Discord server