Skip to main content
Glama

generate_presigned_url

Create time-limited access URLs for MinIO object storage files using specified HTTP methods (GET, PUT, DELETE). Ideal for secure, temporary access and sharing of stored objects.

Instructions

生成预签名URL

Input Schema

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

Implementation Reference

  • src/index.ts:213-225 (registration)
    Registration of the 'generate_presigned_url' tool, 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'] } },
  • MCP tool handler case that parses arguments, calls minioClient.generatePresignedUrl, and formats the response.
    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}` } ] }; }
  • Core implementation of generatePresignedUrl method that generates presigned URLs for GET, PUT, DELETE using MinIO client.
    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}`); } }
  • TypeScript interface PresignedUrlOptions used in the generatePresignedUrl function signature.
    export interface PresignedUrlOptions { expires?: number; // 过期时间(秒) reqParams?: Record<string, string>; // 请求参数 requestDate?: Date; // 请求日期 }

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