npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

yupao-oss-mcp-server

v1.0.4

Published

MCP 服务器:上传图片到鱼泡 OSS,支持单张和批量上传,自动生成永久 CDN 链接

Downloads

48

Readme

yupao-oss

上传图片到鱼泡内网 OSS 的 MCP 服务器

一个基于 Model Context Protocol (MCP) 的服务器,为 AI 工具提供图片上传到阿里云 OSS 的能力。支持单张和批量上传,自动生成永久 CDN 链接。

License: ISC Node.js Version TypeScript

配置

方式 1:通过 npx 使用(推荐)

无需克隆仓库,直接在 MCP 客户端配置:

{
  "mcpServers": {
    "yupao-oss": {
      "command": "npx",
      "args": ["-y", "yupao-oss-mcp-server"],
      "env": {
        "OSS_BUCKET": "your-bucket-name",
        "OSS_ACCESS_KEY_ID": "your_access_key_id",
        "OSS_ACCESS_KEY_SECRET": "your_access_key_secret",
        "OSS_REGION": "oss-cn-beijing"
      }
    }
  }
}

方式 2:本地安装使用

# 克隆仓库
git clone https://github.com/FendSunShine/oss-mcp-server.git
cd oss-mcp-server

# 安装依赖
npm install

# 构建
npm run build

然后配置:

{
  "mcpServers": {
    "yupao-oss": {
      "command": "node",
      "args": ["/absolute/path/to/oss-mcp-server/dist/index.js"],
      "env": {
        "OSS_BUCKET": "your-bucket-name",
        "OSS_ACCESS_KEY_ID": "your_access_key_id",
        "OSS_ACCESS_KEY_SECRET": "your_access_key_secret",
        "OSS_REGION": "oss-cn-beijing"
      }
    }
  }
}

环境变量说明

| 变量名 | 必需 | 说明 | 默认值 | |--------|------|------|--------| | OSS_BUCKET | ✅ | OSS bucket 名称 | - | | OSS_ACCESS_KEY_ID | ✅ | OSS access key ID | - | | OSS_ACCESS_KEY_SECRET | ✅ | OSS access key secret | - | | OSS_REGION | ✅ | OSS 区域(如 oss-cn-beijing) | - | | OSS_CDN_DOMAIN | ❌ | CDN 域名 | https://cdn.yupaowang.com | | OSS_CDN_DIRECTORY | ❌ | CDN 目录前缀 | yupao_common |

使用场景

这个 MCP 服务器特别适合以下场景:

  1. Figma 设计稿转代码:从 Figma 提取图片并上传到 OSS,获取永久 CDN 地址用于代码生成
  2. AI 辅助开发:在 AI 对话中直接上传图片到 CDN
  3. 批量图片处理:一次性上传多张图片,自动生成 CDN 链接
  4. 设计资源管理:将临时图片链接转换为永久 CDN 地址

功能特性

  • ✅ 单张图片上传
  • ✅ 批量图片上传
  • ✅ 自动生成唯一文件名(基于 SHA-256)
  • ✅ 支持多种图片格式(png, jpg, jpeg, webp, gif, svg)
  • ✅ 防止文件覆盖
  • ✅ 详细的日志记录
  • ✅ 完整的错误处理

安装

npm install

配置

环境变量

复制 .env.example.env 并填入实际配置:

cp .env.example .env

必需的环境变量:

  • OSS_BUCKET: OSS bucket 名称
  • OSS_ACCESS_KEY_ID: OSS access key ID
  • OSS_ACCESS_KEY_SECRET: OSS access key secret
  • OSS_REGION: OSS 区域(如 oss-cn-beijing)

可选的环境变量(有默认值):

  • OSS_CDN_DOMAIN: CDN 域名(默认:https://cdn.yupaowang.com)
  • OSS_CDN_DIRECTORY: CDN 目录前缀(默认:yupao_common)

使用方法

开发模式

npm run dev

生产模式

npm run build
npm start

MCP 客户端配置

Kiro IDE

在项目的 .kiro/settings/mcp.json 中配置:

{
  "mcpServers": {
    "yupao-oss": {
      "command": "node",
      "args": ["/path/to/oss-mcp-server/dist/index.js"],
      "env": {
        "OSS_BUCKET": "your-bucket-name",
        "OSS_ACCESS_KEY_ID": "your_key_id",
        "OSS_ACCESS_KEY_SECRET": "your_key_secret",
        "OSS_REGION": "oss-cn-beijing"
      }
    }
  }
}

Claude Desktop

~/Library/Application Support/Claude/claude_desktop_config.json 中配置:

{
  "mcpServers": {
    "yupao-oss": {
      "command": "node",
      "args": ["/path/to/oss-mcp-server/dist/index.js"],
      "env": {
        "OSS_BUCKET": "your-bucket-name",
        "OSS_ACCESS_KEY_ID": "your_key_id",
        "OSS_ACCESS_KEY_SECRET": "your_key_secret",
        "OSS_REGION": "oss-cn-beijing"
      }
    }
  }
}

Cursor IDE

在 Cursor 设置中添加 MCP 服务器配置。

MCP 工具

upload_image

上传单张图片到 OSS。

参数:

  • url (string, 必需): 图片的 HTTP(S) URL
  • fileType (string, 必需): 文件类型,支持 png/jpg/jpeg/webp/gif/svg

返回:

{
  "success": true,
  "cdnUrl": "https://cdn.yupaowang.com/yupao_common/a1b2c3d4.png",
  "fileSize": 102400
}

upload_images_batch

批量上传多张图片到 OSS。

参数:

  • items (array, 必需): 上传项数组
    • url (string): 图片 URL
    • fileType (string): 文件类型

返回:

{
  "results": [
    {
      "success": true,
      "cdnUrl": "https://cdn.yupaowang.com/yupao_common/a1b2c3d4.png",
      "fileSize": 102400
    },
    {
      "success": false,
      "error": "下载失败: 网络超时"
    }
  ],
  "summary": {
    "total": 2,
    "success": 1,
    "failed": 1
  }
}

使用示例

在 AI 对话中使用

用户:把这个 Figma 图片上传到 OSS
AI:调用 upload_image 工具
    - url: https://www.figma.com/api/mcp/asset/xxx
    - fileType: png
    返回:https://cdn.yupaowang.com/yupao_common/a1b2c3d4.png

批量上传

用户:把这些图片都上传到 OSS
AI:调用 upload_images_batch 工具
    - items: [
        { url: "https://...", fileType: "png" },
        { url: "https://...", fileType: "jpg" }
      ]
    返回:成功 2/2

项目结构

oss-mcp-server/
├── src/
│   ├── config/              # 配置管理
│   │   ├── config-manager.ts
│   │   └── constants.ts
│   ├── services/            # 服务层
│   │   ├── mcp-server.ts    # MCP 服务器
│   │   └── oss-upload.service.ts  # OSS 上传服务
│   ├── types/               # 类型定义
│   │   └── index.ts
│   ├── utils/               # 工具函数
│   │   └── validator.ts
│   └── index.ts             # 入口文件
├── .env.example             # 环境变量示例
├── package.json
├── tsconfig.json
└── README.md

开发

构建

npm run build

运行

npm start

注意事项

  1. 确保 OSS 凭证安全,不要提交到代码仓库
  2. 相同内容的图片会生成相同的文件名(基于 SHA-256)
  3. 批量上传时,单个失败不会影响其他图片
  4. 下载超时设置为 30 秒
  5. 支持的文件类型:png, jpg, jpeg, webp, gif, svg

License

ISC