mcp-cos-upload
v1.0.3
Published
MCP server for uploading files to Tencent Cloud COS
Readme
mcp-cos-upload
MCP server for uploading files to Tencent Cloud COS. Supports uploading from URL (e.g., Figma export) or text content.
Installation
npm install mcp-cos-uploadUsage
MCP Configuration (Cursor / Claude Desktop)
Add to your MCP configuration:
{
"mcpServers": {
"cos-upload": {
"command": "npx",
"args": ["-y", "mcp-cos-upload"],
"env": {
"COS_SECRET_ID": "your_secret_id",
"COS_SECRET_KEY": "your_secret_key",
"COS_DEFAULT_BUCKET": "your_bucket_name",
"COS_DEFAULT_REGION": "ap-guangzhou",
"COS_KEY_PREFIX": "uploads/",
"COS_CDN_DOMAIN": "your-cdn-domain.com"
}
}
}
}Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| COS_SECRET_ID | ✅ | Tencent Cloud SecretId |
| COS_SECRET_KEY | ✅ | Tencent Cloud SecretKey |
| COS_DEFAULT_BUCKET | ✅ | Default COS bucket name |
| COS_DEFAULT_REGION | ✅ | Default COS region (e.g., ap-guangzhou) |
| COS_KEY_PREFIX | ❌ | Key prefix for uploaded files (e.g., uploads/) |
| COS_CDN_DOMAIN | ❌ | Custom CDN domain (e.g., cdn.example.com) |
Tools
cos_upload
Upload a file to Tencent Cloud COS.
Parameters:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| url | string | ❌ | URL to download and upload |
| filepath | string | ❌ | Local file path to upload |
| content | string | ❌ | Text content to upload |
| bucket | string | ❌ | COS bucket name (uses env default if not provided) |
| region | string | ❌ | COS region (uses env default if not provided) |
| key | string | ❌ | Object key (auto-generated if not provided) |
| folder | string | ❌ | Folder prefix (overrides COS_KEY_PREFIX) |
| filename | string | ❌ | Custom filename |
| ext | string | ❌ | File extension (e.g., png, jpg, svg) |
| compress | boolean | ❌ | Enable image compression (default: true) |
| quality | number | ❌ | Compression quality 1-100 (default: 80, for JPEG/WebP/PNG) |
Note:
url,filepath, andcontentare mutually exclusive - provide only one.
Example:
Upload this image to COS: https://example.com/image.pngImage Compression
Supports automatic compression for uploaded images:
| Format | Compression | |--------|-------------| | PNG | Lossless/lossy compression | | JPEG | Quality adjustment with mozjpeg | | WebP | Quality adjustment | | GIF | Optimization | | SVG | SVGO optimization (removes redundant code) |
Compression is enabled by default. Use compress: false to upload original files.
License
MIT
