Skip to main content
Glama
Zain4391

Supabase Management API MCP Server

by Zain4391
create-a-project.js4.62 kB
/** * Create a new Supabase project. * * @param {Object} args - Arguments for creating a project. * @param {string} args.db_pass - The database password. * @param {string} args.name - The project name. * @param {string} args.organization_slug - The organization slug. * @param {string} args.organization_id - The organization ID. * @param {string} args.plan - The plan (e.g., "free"). * @param {string} args.region - The region (e.g., "eu-west-2"). * @param {Object} [args.region_selection] - Region selection object. * @param {string} [args.region_selection.type] - Type of region selection. * @param {string} [args.region_selection.code] - Region code. * @param {boolean} [args.kps_enabled] - Whether KPS is enabled. * @param {string} [args.desired_instance_size] - Desired instance size. * @param {string} [args.template_url] - Template URL. * @param {string} [args.release_channel] - Release channel. * @param {string} [args.postgres_engine] - Postgres engine version. * @returns {Promise<Object>} - The response from the Supabase Management API. */ const createProject = async ({ db_pass, name, organization_slug, organization_id, plan, region, region_selection, kps_enabled, desired_instance_size, template_url, release_channel, postgres_engine }) => { const baseUrl = 'https://api.supabase.com'; const bearerToken = process.env.SUPABASE_PUBLIC_API_API_KEY; try { const url = `${baseUrl}/v1/projects`; const body = { db_pass, name, organization_slug, organization_id, plan, region, region_selection, kps_enabled, desired_instance_size, template_url, release_channel, postgres_engine }; // Remove undefined keys Object.keys(body).forEach( (key) => body[key] === undefined && delete body[key] ); const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': `Bearer ${bearerToken}` }, body: JSON.stringify(body) }); if (!response.ok) { let err; try { err = await response.json(); } catch { err = await response.text(); } throw new Error(typeof err === 'string' ? err : JSON.stringify(err)); } return await response.json(); } catch (error) { return { error: error instanceof Error ? error.message : JSON.stringify(error) }; } }; /** * Tool definition for creating a Supabase project. */ const apiTool = { function: createProject, definition: { type: 'function', function: { name: 'create_project', description: 'Create a new Supabase project.', parameters: { type: 'object', properties: { db_pass: { type: 'string', description: 'The database password.' }, name: { type: 'string', description: 'The project name.' }, organization_slug: { type: 'string', description: 'The organization slug.' }, organization_id: { type: 'string', description: 'The organization ID.' }, plan: { type: 'string', description: 'The plan (e.g., "free").' }, region: { type: 'string', description: 'The region (e.g., "eu-west-2").' }, region_selection: { type: 'object', description: 'Region selection object.', properties: { type: { type: 'string', description: 'Type of region selection.' }, code: { type: 'string', description: 'Region code.' } } }, kps_enabled: { type: 'boolean', description: 'Whether KPS is enabled.' }, desired_instance_size: { type: 'string', description: 'Desired instance size.' }, template_url: { type: 'string', description: 'Template URL.' }, release_channel: { type: 'string', description: 'Release channel.' }, postgres_engine: { type: 'string', description: 'Postgres engine version.' } }, required: [ 'db_pass', 'name', 'organization_slug', 'organization_id', 'plan', 'region' ] } } } }; export { apiTool };

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/Zain4391/Supabase_MCP'

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