Skip to main content
Glama

get_file_url

Generate secure, time-limited download URLs for files stored in Supabase Storage buckets to enable controlled access to stored content.

Instructions

Generate signed download URL for secure file access

Input Schema

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

Implementation Reference

  • The core handler function that implements the get_file_url tool logic: extracts parameters, generates a signed URL using Supabase storage.createSignedUrl, handles errors, audits the request, and returns the signed URL with expiration info.
    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 definition for the get_file_url tool, specifying parameters bucket_name (string), storage_path (string), and optional expires_in (number with constraints).
    { 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)
    Registration/dispatch in the main CallToolRequestSchema 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