set_bucket_policy
Configure access permissions for MinIO storage buckets by applying JSON policies to control user and application access rights.
Instructions
设置存储桶策略
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bucketName | Yes | 存储桶名称 | |
| policy | Yes | JSON格式的策略 |
Implementation Reference
- src/index.ts:594-609 (handler)MCP tool handler for 'set_bucket_policy': validates input parameters using Zod, calls MinIOStorageClient.setBucketPolicy, and returns a success text response.case 'set_bucket_policy': { const { bucketName, policy } = z.object({ bucketName: z.string(), policy: z.string() }).parse(args); await this.minioClient.setBucketPolicy(bucketName, policy); return { content: [ { type: 'text', text: `成功设置存储桶 ${bucketName} 的策略` } ] }; }
- src/index.ts:278-289 (registration)Tool registration in list_tools response, including name, description, and input schema definition.{ name: 'set_bucket_policy', description: '设置存储桶策略', inputSchema: { type: 'object', properties: { bucketName: { type: 'string', description: '存储桶名称' }, policy: { type: 'string', description: 'JSON格式的策略' } }, required: ['bucketName', 'policy'] } },
- src/index.ts:595-598 (schema)Zod schema validation for input arguments in the handler.const { bucketName, policy } = z.object({ bucketName: z.string(), policy: z.string() }).parse(args);
- src/minio-client.ts:329-332 (helper)MinIOStorageClient helper method that implements setBucketPolicy by delegating to the underlying Minio Client SDK.async setBucketPolicy(bucketName: string, policy: string): Promise<void> { this.ensureConnected(); await this.client!.setBucketPolicy(bucketName, policy); }