Content
# my-oss-upload-mcp
A lightweight MCP Server for uploading files, images, and design slices to Aliyun OSS.
Zero dependencies, native implementation of MCP protocol, runs on Node.js 16+.
## Demo

## Applicable Scenarios
Can be used with Blue Lake MCP, Figma MCP to download slices, and implement a process of uploading files to OSS → returning CDN links.
Your backend management system uses Aliyun OSS STS temporary credentials to upload files directly, and calls the backend interface to register file information after uploading. This tool automatically completes the following process:
```
Parse STS credentials → Upload file to OSS → Call backend interface to register → Return CDN link
```
Can be used with AI IDEs (such as Kiro, Cursor, Windsurf, etc.) to upload images directly in the conversation and obtain CDN links.
## Provided Tools
| Tool Name | Description |
| --- | --- |
| `upload_image` | Upload a single local image, return CDN link |
| `batch_upload` | Batch upload all images in a directory, return all CDN links |
| `list_uploads` | View the list of recently uploaded files on the backend |
Supported formats: png / jpg / jpeg / gif / webp / svg / bmp / ico
## Quick Start
### 1. Configure MCP
Add the following configuration to your AI IDE's MCP configuration file:
```json
{
"mcpServers": {
"my-oss-upload-mcp": {
"command": "node",
"args": ["/path/to/my-oss-upload-mcp/server.js"],
"env": {
"ADMIN_COOKIE": "Your backend login cookie/Token",
"ADMIN_PAGE_URL": "https://your-domain.com/admin/attach/",
"REGISTER_URL": "https://your-domain.com/admin/attach/edit",
"CDN_PREFIX": "https://cdn.your-domain.com/",
"OSS_ENDPOINT": "https://your-bucket.oss-cn-shanghai.aliyuncs.com",
"OSS_BUCKET": "your-bucket-name",
"OSS_PATH_PREFIX": "attach"
},
"disabled": false,
"autoApprove": ["upload_image", "batch_upload", "list_uploads"]
}
}
}
```
### 2. Environment Variable Description
| Variable Name | Required | Description |
| --- | --- | --- |
| `ADMIN_COOKIE` | ✅ | Backend management system login cookie |
| `ADMIN_PAGE_URL` | ✅ | Backend file management page URL (used to parse STS credentials) |
| `REGISTER_URL` | ✅ | Interface URL for registering files after upload |
| `CDN_PREFIX` | ✅ | CDN link prefix, e.g. `https://cdn.example.com/` |
| `OSS_ENDPOINT` | ✅ | Aliyun OSS endpoint, e.g. `https://bucket.oss-cn-shanghai.aliyuncs.com` |
| `OSS_BUCKET` | ✅ | OSS bucket name |
| `OSS_PATH_PREFIX` | ❌ | File path prefix, default `attach` |
### 3. Obtain Cookie/Token
1. Fill in the `ADMIN_COOKIE` environment variable
## STS Credential Parsing
OSS upload credentials:
- `AccessKeyId`
- `AccessKeySecret`
- `SecurityToken`
If your backend returns credentials through an interface, you need to modify the `getCredentials()` method.
## Working Principle
```
┌─────────────┐ ┌──────────────────┐ ┌─────────────┐
│ AI IDE │────▶│ my-oss-upload │────▶│ Backend Page │
│ (MCP Client)│ │ (MCP Server) │ │ Parse STS │
└─────────────┘ └──────┬───────────┘ └─────────────┘
│
┌──────▼───────────┐
│ Aliyun OSS │
│ PUT upload file │
└──────┬───────────┘
│
┌──────▼───────────┐
│ Backend register interface │
│ POST register information │
└──────┬───────────┘
│
┌──────▼───────────┐
│ Return CDN link │
└──────────────────┘
```
## Precautions
- Cookie has an expiration time, and you need to log in to the backend and update `ADMIN_COOKIE` after it expires
- STS temporary credentials also have an expiration time (usually 15 minutes ~ 1 hour), and the tool will automatically re-obtain credentials when they expire
- Uploaded file name format is `file{timestamp}.{ext}`, and the default remark uses the original file name
## License
MIT