Skip to main content
Glama

get_file_url

Generate a secure, time-limited download URL for files stored in Supabase Storage buckets to enable controlled access to private files.

Instructions

Generate signed download URL for secure file access

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucket_nameYesSource bucket
expires_inNoURL expiration in seconds (default: 7200)
storage_pathYesFull file path in storage

Implementation Reference

  • The handler function that implements the core logic of the 'get_file_url' tool. It extracts parameters, generates a secure hash for auditing, creates a signed URL using Supabase storage API, handles errors, audits the request, and returns the signed URL with expiration and metadata.
    async function handleGetFileUrl(args: any, requestId: string, startTime: number) { const { bucket_name, storage_path, expires_in = 7200 } = args; const inputHash = generateSecureHash(JSON.stringify({ bucket_name, storage_path, expires_in })); try { const { data, error } = await supabase.storage .from(bucket_name) .createSignedUrl(storage_path, expires_in); if (error) { throw new Error(`Failed to create signed URL: ${error.message}`); } const expiresAt = new Date(Date.now() + expires_in * 1000).toISOString(); auditRequest('get_file_url', true, inputHash); const result: SignedUrlResult = { signedUrl: data.signedUrl, expiresAt, fileSize: 0, // Would need additional call to get file info mimeType: 'unknown' // Would need additional call to get file info }; return { content: [ { type: 'text', text: JSON.stringify({ ...result, request_id: requestId, processing_time: Date.now() - startTime }, null, 2) } ] }; } catch (error) { auditRequest('get_file_url', false, inputHash, getErrorMessage(error)); throw error; } }
  • The input schema and metadata definition for the 'get_file_url' tool, registered in the ListToolsRequestSchema handler. Defines parameters, validation rules, and description.
    { name: 'get_file_url', description: 'Generate signed download URL for secure file access', inputSchema: { type: 'object', properties: { bucket_name: { type: 'string', description: 'Source bucket', minLength: 3, maxLength: 63 }, storage_path: { type: 'string', description: 'Full file path in storage', maxLength: 1024 }, expires_in: { type: 'number', description: 'URL expiration in seconds (default: 7200)', minimum: 60, maximum: 604800, default: 7200 } }, required: ['bucket_name', 'storage_path'], additionalProperties: false } },
  • src/index.ts:476-477 (registration)
    The dispatch/registration point in the main CallToolRequestSchema handler switch statement that routes calls to the 'get_file_url' tool to its handler function.
    case 'get_file_url': return await handleGetFileUrl(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