Skip to main content
Glama

generate_presigned_url

Create time-limited URLs for secure access to MinIO storage objects without authentication, enabling temporary sharing or uploads.

Instructions

生成预签名URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketNameYes存储桶名称
objectNameYes对象名称
methodNoHTTP方法GET
expiresNo过期时间(秒)

Implementation Reference

  • Handler for the 'generate_presigned_url' tool that validates input parameters using Zod, calls the MinIO client's generatePresignedUrl method, and formats the response with the generated URL.
    case 'generate_presigned_url': { const { bucketName, objectName, method, expires } = z.object({ bucketName: z.string(), objectName: z.string(), method: z.enum(['GET', 'PUT', 'DELETE']).default('GET'), expires: z.number().default(3600) }).parse(args); const url = await this.minioClient.generatePresignedUrl(bucketName, objectName, method, { expires }); return { content: [ { type: 'text', text: `预签名URL (${method}, 有效期${expires}秒):\n${url}` } ] }; }
  • src/index.ts:212-225 (registration)
    Registration of the 'generate_presigned_url' tool in the MCP server, including name, description, and input schema definition.
    { name: 'generate_presigned_url', description: '生成预签名URL', inputSchema: { type: 'object', properties: { bucketName: { type: 'string', description: '存储桶名称' }, objectName: { type: 'string', description: '对象名称' }, method: { type: 'string', enum: ['GET', 'PUT', 'DELETE'], description: 'HTTP方法', default: 'GET' }, expires: { type: 'number', description: '过期时间(秒)', default: 3600 } }, required: ['bucketName', 'objectName'] } },
  • Helper method in MinIOStorageClient that implements the presigned URL generation logic using the MinIO SDK's presigned methods for GET, PUT, and DELETE.
    async generatePresignedUrl(bucketName: string, objectName: string, method: 'GET' | 'PUT' | 'DELETE' = 'GET', options?: PresignedUrlOptions): Promise<string> { this.ensureConnected(); const expires = options?.expires || 3600; // 默认1小时 switch (method) { case 'GET': return await this.client!.presignedGetObject(bucketName, objectName, expires, options?.reqParams, options?.requestDate); case 'PUT': return await this.client!.presignedPutObject(bucketName, objectName, expires); case 'DELETE': return await this.client!.presignedUrl('DELETE', bucketName, objectName, expires, options?.reqParams, options?.requestDate); default: throw new Error(`不支持的HTTP方法: ${method}`); } }

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/pickstar-2002/minio-storage-mcp'

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