# Self-Hosted Supabase MCP Server - Implementation Plan This plan outlines the steps to build the minimal self-hosted Supabase MCP server based on `migration_notes.md`. ## Progress Tracking - [x] Project Setup (package.json, tsconfig.json, dependencies, directories) - [x] Bun Migration (replaced Node.js/npm with Bun runtime) - [x] Define Core Types (`src/types/`) - [x] Implement `SelfhostedSupabaseClient` (`src/client/`) - [x] Basic connection (`@supabase/supabase-js`) - [x] RPC `execute_sql` function call logic - [x] RPC function existence check and creation logic (using service key) - [x] Direct DB connection fallback/transactional method (`pg`) - [x] Async initialization logic (`client.initialize()`) - [x] Implement Server Entry Point (`src/index.ts`) - [x] `commander` setup for args/env vars - [x] `createSelfhostedSupabaseClient` factory usage - [x] MCP SDK initialization (`stdio: true`) - [x] Tool registration - [x] Error handling - [x] Implement Tools (`src/tools/`) - [x] **Schema & Migrations** - [x] `list_tables` - [x] `list_extensions` - [x] `list_migrations` - [x] `apply_migration` - [x] **Database Operations & Stats** - [x] `execute_sql` - [x] `get_database_connections` - [x] `get_database_stats` - [x] **Project Configuration** - [x] `get_project_url` - [x] `verify_jwt_secret` - [-] `get_anon_key` (Removed - security risk) - [-] `get_service_key` (Removed - security risk) - [x] **Development & Extension Tools** - [x] `generate_typescript_types` - [x] `rebuild_hooks` - [x] `get_logs` (Added - tries analytics stack, falls back to CSV logs) - [x] **Auth User Management** - [x] `list_auth_users` - [x] `get_auth_user` - [x] `create_auth_user` - [x] `delete_auth_user` - [x] `update_auth_user` - [x] **Storage Insights** - [x] `list_storage_buckets` - [x] `list_storage_objects` - [x] **Realtime Inspection** - [x] `list_realtime_publications` - [x] **Extension-Specific Tools** - [x] `list_cron_jobs` (for pg_cron) - [x] `list_vector_indexes` (for pgvector) - [x] **Edge Function Management** - [x] `list_edge_functions` - [x] `get_edge_function_details` - [-] `deploy_edge_function` (Skipped - requires filesystem access outside MCP scope) - [x] **Additional Tools (from Official Supabase MCP)** - [x] `get_advisors` (security/performance advisory notices via Splinter) - [x] `get_storage_config` (storage bucket configuration) - [x] `update_storage_config` (update storage bucket settings) - [x] Add Basic README.md - [x] Test Infrastructure - [x] Bun test runner setup - [x] Utils tests - [x] Type definition tests