Skip to main content
Glama
156554395

Tencent Cloud COS MCP Server

by 156554395

get_signed_url

Generate temporary signed URLs for Tencent Cloud COS objects to provide secure, time-limited access to cloud storage files without exposing permanent credentials.

Instructions

获取COS对象的临时签名URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expire_timeNoURL有效期(秒),默认3600秒
object_keyYesCOS中的对象键名

Implementation Reference

  • Defines the input schema, name, and description for the 'get_signed_url' tool, used for MCP tool listing.
    get_signed_url: {
      name: 'get_signed_url',
      description: '获取COS对象的临时签名URL',
      inputSchema: {
        type: 'object',
        properties: {
          object_key: {
            type: 'string',
            description: 'COS中的对象键名'
          },
          expire_time: {
            type: 'number',
            description: 'URL有效期(秒),默认3600秒'
          }
        },
        required: ['object_key']
      }
    },
  • MCP CallToolRequestSchema handler case for 'get_signed_url': extracts arguments, calls cosService.getSignedUrl, formats and returns response.
    case 'get_signed_url':
      const urlResult = await cosService.getSignedUrl(args.object_key, args.expire_time);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({ success: true, data: urlResult }, null, 2)
          }
        ]
      };
  • Core implementation of getSignedUrl: validates config, generates signed URL using Tencent COS SDK's getObjectUrl with Sign: true.
    async getSignedUrl(key, expireTime = 3600) {
      this._checkConfig();
      
      try {
        const params = {
          Bucket: this.config.Bucket,
          Region: this.config.Region,
          Key: key,
          Sign: true,
          Expires: expireTime
        };
    
        const url = await this.cos.getObjectUrl(params);
        return { success: true, url };
      } catch (error) {
        throw new Error(`获取签名URL失败: ${error.message}`);
      }
    }

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/156554395/tx-cos-mcp'

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