|
@@ -471,6 +471,70 @@ app.supabase_url = 'https://YOUR_PROJECT.supabase.co'
|
|
|
- Edge Functions are deployed to Supabase infrastructure
|
|
- Edge Functions are deployed to Supabase infrastructure
|
|
|
- Automatically scaled and managed by Supabase
|
|
- Automatically scaled and managed by Supabase
|
|
|
|
|
|
|
|
|
|
+### Using Supabase MCP Tools (Recommended for Claude)
|
|
|
|
|
+
|
|
|
|
|
+**IMPORTANT**: When working with Supabase in Claude Code, ALWAYS use the Supabase MCP tools instead of CLI commands. These tools provide direct integration with Supabase without requiring manual authentication.
|
|
|
|
|
+
|
|
|
|
|
+#### Available MCP Tools
|
|
|
|
|
+
|
|
|
|
|
+**Edge Functions Management:**
|
|
|
|
|
+- `mcp__supabase__list_edge_functions` - List all deployed Edge Functions
|
|
|
|
|
+- `mcp__supabase__deploy_edge_function` - Deploy an Edge Function (with files array)
|
|
|
|
|
+- `mcp__supabase__get_edge_function` - Get Edge Function code
|
|
|
|
|
+
|
|
|
|
|
+**Database Operations:**
|
|
|
|
|
+- `mcp__supabase__list_tables` - List database tables
|
|
|
|
|
+- `mcp__supabase__list_extensions` - List database extensions
|
|
|
|
|
+- `mcp__supabase__list_migrations` - List all migrations
|
|
|
|
|
+- `mcp__supabase__apply_migration` - Apply a new migration (DDL operations)
|
|
|
|
|
+- `mcp__supabase__execute_sql` - Execute raw SQL queries
|
|
|
|
|
+
|
|
|
|
|
+**Project Information:**
|
|
|
|
|
+- `mcp__supabase__get_project_url` - Get the project API URL
|
|
|
|
|
+- `mcp__supabase__get_anon_key` - Get the anonymous API key
|
|
|
|
|
+- `mcp__supabase__generate_typescript_types` - Generate TypeScript types from database
|
|
|
|
|
+
|
|
|
|
|
+**Monitoring & Debugging:**
|
|
|
|
|
+- `mcp__supabase__get_logs` - Get logs for Edge Functions or other services
|
|
|
|
|
+- `mcp__supabase__get_advisors` - Check for security/performance issues
|
|
|
|
|
+
|
|
|
|
|
+**Branching (Development):**
|
|
|
|
|
+- `mcp__supabase__create_branch` - Create a development branch
|
|
|
|
|
+- `mcp__supabase__list_branches` - List all branches
|
|
|
|
|
+- `mcp__supabase__merge_branch` - Merge branch to production
|
|
|
|
|
+- `mcp__supabase__delete_branch` - Delete a development branch
|
|
|
|
|
+
|
|
|
|
|
+#### Best Practices
|
|
|
|
|
+
|
|
|
|
|
+1. **Always use MCP tools** for Supabase operations in Claude Code
|
|
|
|
|
+2. **Check Edge Function logs** when debugging deployment issues:
|
|
|
|
|
+ ```
|
|
|
|
|
+ mcp__supabase__get_logs(service: "edge-function")
|
|
|
|
|
+ ```
|
|
|
|
|
+3. **Monitor deployments** by listing Edge Functions after deployment
|
|
|
|
|
+4. **Environment variables** are configured via `.env` files in both frontend and supabase directories
|
|
|
|
|
+5. **For production deployment**, ensure both `.env` files are properly configured
|
|
|
|
|
+
|
|
|
|
|
+#### Common Workflows
|
|
|
|
|
+
|
|
|
|
|
+**Deploying Edge Functions via CLI:**
|
|
|
|
|
+```bash
|
|
|
|
|
+# Deploy a specific function
|
|
|
|
|
+supabase functions deploy <function-name> --project-ref ztklqodcdjeqpsvhlpud
|
|
|
|
|
+
|
|
|
|
|
+# Deploy multiple functions
|
|
|
|
|
+supabase functions deploy api oauth-woocommerce oauth-shopify --project-ref ztklqodcdjeqpsvhlpud
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+**Checking Deployment Status:**
|
|
|
|
|
+Use the MCP tool `mcp__supabase__list_edge_functions` to verify deployment status and version numbers.
|
|
|
|
|
+
|
|
|
|
|
+**Debugging 404/500 Errors:**
|
|
|
|
|
+1. Check if Edge Function is deployed using `mcp__supabase__list_edge_functions`
|
|
|
|
|
+2. Review logs using `mcp__supabase__get_logs(service: "edge-function")`
|
|
|
|
|
+3. Verify environment variables are set in `supabase/.env`
|
|
|
|
|
+4. Redeploy the function if needed
|
|
|
|
|
+
|
|
|
## Development Workflow
|
|
## Development Workflow
|
|
|
|
|
|
|
|
When making changes:
|
|
When making changes:
|