The meta-function-generator function is a Supabase Edge Function that dynamically generates new edge functions.
This function provides a way to create new edge functions programmatically. It can generate function code, configuration files, and deploy the new functions to the Supabase project.
- Generate edge function code from templates
- Create configuration files (deno.json, import maps)
- Support for TypeScript and JavaScript
- Integration with MCP (Model Context Protocol)
- Automatic deployment of generated functions
The Meta Function Generator consists of several components:
- Function code generator
- Configuration file generator
- MCP server integration
- Deployment utilities
| Variable | Description | Default |
|---|---|---|
SUPABASE_ACCESS_TOKEN |
Supabase access token for API authentication | Required |
SUPABASE_PROJECT_ID |
ID of the Supabase project | Required |
FUNCTION_TEMPLATE_PATH |
Path to function templates | ./templates |
POST /functions/v1/meta-function-generator
{
"functionName": "my-new-function",
"template": "basic-http",
"parameters": {
"endpoint": "/api/data",
"method": "GET",
"responseType": "json"
},
"deploy": true
}{
"success": true,
"functionId": "func_12345abcdef",
"files": [
"index.ts",
"deno.json"
],
"deploymentStatus": "success"
}The function supports several built-in templates:
basic-http: Simple HTTP endpointdatabase-crud: CRUD operations for a database tableauth-webhook: Authentication webhookscheduled-job: Function that runs on a schedulemcp-tool: MCP tool implementation
The function can generate MCP-compatible functions that implement:
- MCP tools
- MCP resources
- MCP resource templates
- Access to this function should be restricted
- Generated functions should be reviewed before deployment
- Proper error handling and validation is essential
- Avoid generating functions with hardcoded credentials