connect_minio
Establish a connection to MinIO object storage servers using endpoint, port, and authentication credentials to enable file management operations.
Instructions
连接到MinIO服务器
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endPoint | Yes | MinIO服务器地址 | |
| port | Yes | MinIO服务器端口 | |
| useSSL | No | 是否使用SSL连接 | |
| accessKey | Yes | 访问密钥 | |
| secretKey | Yes | 秘密密钥 | |
| region | No | 区域设置(可选) |
Implementation Reference
- src/index.ts:321-332 (handler)MCP tool dispatch handler for 'connect_minio'. Validates input using MinIOConfigSchema, connects via MinIOStorageClient, and returns success message.case 'connect_minio': { const config = MinIOConfigSchema.parse(args); await this.minioClient.connect(config); return { content: [ { type: 'text', text: `成功连接到MinIO服务器 ${config.endPoint}:${config.port}` } ] }; }
- src/index.ts:67-82 (registration)Tool registration definition including name, description, and input schema in the ListTools response.{ name: 'connect_minio', description: '连接到MinIO服务器', inputSchema: { type: 'object', properties: { endPoint: { type: 'string', description: 'MinIO服务器地址' }, port: { type: 'number', description: 'MinIO服务器端口' }, useSSL: { type: 'boolean', description: '是否使用SSL连接', default: false }, accessKey: { type: 'string', description: '访问密钥' }, secretKey: { type: 'string', description: '秘密密钥' }, region: { type: 'string', description: '区域设置(可选)' } }, required: ['endPoint', 'port', 'accessKey', 'secretKey'] } },
- src/types.ts:4-11 (schema)Zod schema (MinIOConfigSchema) for validating the input parameters of the connect_minio tool. Used in handler for parsing.export const MinIOConfigSchema = z.object({ endPoint: z.string().describe('MinIO服务器地址'), port: z.number().min(1).max(65535).describe('MinIO服务器端口'), useSSL: z.boolean().default(false).describe('是否使用SSL连接'), accessKey: z.string().describe('访问密钥'), secretKey: z.string().describe('秘密密钥'), region: z.string().optional().describe('区域设置(可选)') });
- src/minio-client.ts:14-31 (helper)Core implementation of MinIO connection in MinIOStorageClient.connect(). Creates Minio.Client instance and tests connection by listing buckets.async connect(config: MinIOConfig): Promise<void> { try { this.client = new Minio.Client({ endPoint: config.endPoint, port: config.port, useSSL: config.useSSL, accessKey: config.accessKey, secretKey: config.secretKey, region: config.region }); // 测试连接 await this.client.listBuckets(); this.config = config; } catch (error) { throw new Error(`连接MinIO服务器失败: ${error instanceof Error ? error.message : String(error)}`); } }