Skip to main content
Glama
Desmond-Labs

Supabase Storage MCP

by Desmond-Labs

create_bucket

Create a new storage bucket with security validation and audit logging for Supabase Storage. Specify bucket name and public/private access to organize files securely.

Instructions

Create a new storage bucket with comprehensive security validation and audit logging

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucket_nameYesName of the bucket to create (3-63 chars, lowercase, alphanumeric with hyphens)
is_publicNoWhether the bucket should be public

Implementation Reference

  • The main handler function that implements the core logic for the 'create_bucket' tool: validates input, creates the bucket using Supabase Storage API, handles errors, audits the request, and returns a formatted response.
    async function handleCreateBucket(args: any, requestId: string, startTime: number) { const { bucket_name, is_public } = args as { bucket_name: string; is_public?: boolean }; // Input validation if (!bucket_name || typeof bucket_name !== 'string') { throw new Error('Invalid bucket_name parameter'); } const inputHash = generateSecureHash(JSON.stringify({ bucket_name, is_public })); try { const options: any = { public: is_public || false }; const { data, error } = await supabase.storage.createBucket(bucket_name, options); if (error) { throw new Error(`Failed to create bucket: ${error.message}`); } auditRequest('create_bucket', true, inputHash); return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: `Successfully created secure bucket: ${bucket_name}`, bucket_name: data.name, security_configuration: { public: options.public, audit_logging_enabled: true, threat_detection_enabled: true }, request_id: requestId, processing_time: Date.now() - startTime }, null, 2) } ] }; } catch (error) { auditRequest('create_bucket', false, inputHash, getErrorMessage(error)); throw error; } }
  • Input schema defining parameters for the 'create_bucket' tool: bucket_name (required, with validation) and optional is_public boolean.
    inputSchema: { type: 'object', properties: { bucket_name: { type: 'string', description: 'Name of the bucket to create (3-63 chars, lowercase, alphanumeric with hyphens)', minLength: 3, maxLength: 63, pattern: '^[a-z0-9][a-z0-9\\-]*[a-z0-9]$' }, is_public: { type: 'boolean', description: 'Whether the bucket should be public', default: false } }, required: ['bucket_name'], additionalProperties: false }
  • src/index.ts:65-83 (registration)
    Registration of the 'create_bucket' tool in the MCP server's listTools response, including name, description, and input schema.
    { name: 'create_bucket', description: 'Create a new storage bucket with comprehensive security validation and audit logging', inputSchema: { type: 'object', properties: { bucket_name: { type: 'string', description: 'Name of the bucket to create (3-63 chars, lowercase, alphanumeric with hyphens)', minLength: 3, maxLength: 63, pattern: '^[a-z0-9][a-z0-9\\-]*[a-z0-9]$' }, is_public: { type: 'boolean', description: 'Whether the bucket should be public', default: false } }, required: ['bucket_name'], additionalProperties: false } },
  • src/index.ts:464-465 (registration)
    Switch case in the main CallToolRequestSchema handler that dispatches 'create_bucket' calls to the handleCreateBucket function.
    case 'create_bucket': return await handleCreateBucket(args, requestId, startTime);

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/Desmond-Labs/supabase-storage-mcp'

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