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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'comprehensive security validation and audit logging,' which hints at safety features, but doesn't specify what validation entails, whether the operation is idempotent, or what happens on failure. For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('create a new storage bucket') and adds value with extra context ('comprehensive security validation and audit logging'). Every word earns its place, with no redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a mutation with security implications), no annotations, and no output schema, the description is minimally adequate. It covers the basic purpose and hints at behavioral traits but lacks details on permissions, error handling, or return values. This leaves room for improvement in guiding safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, fully documenting both parameters ('bucket_name' and 'is_public') with constraints and defaults. The description adds no additional parameter details beyond what the schema provides, such as explaining the implications of 'is_public' on security. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('create') and resource ('storage bucket'), making the purpose unambiguous. It distinguishes from siblings like 'setup_buckets' (which might configure existing buckets) and 'upload_image_batch' (which uploads files). However, it doesn't explicitly differentiate from all siblings, such as 'create_signed_urls' (which creates URLs, not buckets).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, such as needing permissions or existing infrastructure, or when to choose other tools like 'setup_buckets' for batch operations. Without this context, users must infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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