← 返回 Skills 市场
chao-eng

Cloudflare R2 S3 存储工具

作者 chao-eng · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
126
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install cloudflare-r2-s3
功能描述
Cloudflare R2 S3 兼容存储工具,支持配置 API 密钥、上传文件并获取公开访问地址。使用当需要上传文件到 Cloudflare R2 获取公开链接时。
使用说明 (SKILL.md)

Cloudflare R2 S3 存储工具

Cloudflare R2 提供 10GB 免费存储额度,兼容 S3 API,可以用来存储文件并生成公开访问地址。

功能特性

  • ✅ 支持配置 S3 API 端点、访问密钥和存储桶
  • ✅ 上传本地文件到 R2 存储桶
  • ✅ 自动生成公开访问 URL
  • ✅ 支持列出存储桶中的文件
  • ✅ 支持删除文件
  • ✅ 兼容其他 S3 兼容存储服务(如 MinIO)

配置方式

在使用前需要配置以下环境变量或配置文件:

# ~/.openclaw/config/cloudflare-r2.env
CLOUDFLARE_R2_ACCOUNT_ID=your-account-id
CLOUDFLARE_R2_ACCESS_KEY_ID=your-access-key
CLOUDFLARE_R2_SECRET_ACCESS_KEY=your-secret-key
CLOUDFLARE_R2_BUCKET_NAME=your-bucket-name
CLOUDFLARE_R2_PUBLIC_DOMAIN=your-public-domain  # 可选,自定义公开域名

或者在调用时传入参数。

使用方法

上传文件

from scripts.r2_uploader import R2Uploader

uploader = R2Uploader()
result = uploader.upload_file(local_path, object_name=None, public=True)
print(result['public_url'])  # 获取公开访问地址

命令行使用

# 上传文件
python skills/cloudflare-r2-s3/scripts/r2_uploader.py upload /path/to/file.jpg [object-name]

# 列出文件
python skills/cloudflare-r2-s3/scripts/r2_uploader.py list

# 删除文件
python skills/cloudflare-r2-s3/scripts/r2_uploader.py delete object-name

Cloudflare R2 配置步骤

  1. 创建 R2 存储桶

    • 登录 Cloudflare 控制台 → R2 → 创建存储桶
    • 记住存储桶名称
  2. 创建 API 令牌

    • R2 → 管理 R2 API 令牌 → 创建 API 令牌
    • 授予 Object Read + Write 权限
    • 保存 Access Key ID 和 Secret Access Key
  3. 配置公开访问(可选但推荐)

    • 在存储桶设置 → "Public Access" → 启用
    • 可以使用 Cloudflare 提供的 pub-${bucket-name}.r2.dev 域名
    • 或者绑定自定义域名

依赖

需要安装 boto3:

pip install boto3

脚本说明

  • scripts/r2_uploader.py - 主上传工具,支持命令行和 API 调用
  • references/config_example.env - 配置文件示例
安全使用建议
This skill appears to do what it says: it reads a local config file (~/.openclaw/config/cloudflare-r2.env) or accepts parameters and uses boto3 to talk to Cloudflare R2. Before installing or using it: (1) be aware you must supply R2 credentials (account id, access key id, secret access key) and a bucket name — these are sensitive; the registry metadata did not declare them, so do not expect automatic secret management. (2) Prefer creating a least-privilege API key that only permits object read/write on the specific bucket. (3) Note the tool may set uploaded objects to public-read (public URL generation); avoid using with sensitive files unless you disable public uploads. (4) Ensure you install required Python deps (boto3 and python-dotenv) in a controlled environment. (5) If you have concerns, review the included scripts yourself or run the tool in an isolated environment (container/VM) and use dedicated credentials.
功能分析
Type: OpenClaw Skill Name: cloudflare-r2-s3 Version: 1.0.0 The skill is a standard utility for managing Cloudflare R2 storage via the S3 API. The primary script, `scripts/r2_uploader.py`, uses the legitimate `boto3` library to perform file uploads, listing, and deletion as described in the documentation. No evidence of data exfiltration, malicious execution, or prompt injection was found.
能力评估
Purpose & Capability
Name/description, SKILL.md and the Python script all consistently implement an S3-compatible Cloudflare R2 uploader (upload, list, delete, generate public URLs). The use of boto3 and an R2 endpoint is appropriate for this purpose.
Instruction Scope
SKILL.md and the script instruct the agent to read a configuration file (~/.openclaw/config/cloudflare-r2.env) or accept parameters for R2 account ID, access key, secret, bucket name and optional public domain — this is expected. One minor coherence issue: the registry metadata declares no required env vars, but the skill does require sensitive env vars/config at runtime (documented in SKILL.md and enforced by the script).
Install Mechanism
There is no install spec (instruction-only with an included script) which minimizes installer risk. The script depends on boto3 and python-dotenv; SKILL.md calls out pip install boto3 but does not mention python-dotenv (dotenv is imported in the script). No downloads or remote install URLs are used.
Credentials
The tool legitimately requires Cloudflare R2 credentials (account id, access key id, secret access key) and a bucket name. Those are sensitive secrets but are proportional to the stated purpose. However, the package/registry metadata did not declare any required env vars or a primary credential, which is an inconsistency the user should be aware of before installing or granting secrets.
Persistence & Privilege
The skill does not request permanent/always inclusion, does not modify other skills or system settings, and only reads a user config file. It does not persist elevated privileges or perform unexpected background actions.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install cloudflare-r2-s3
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /cloudflare-r2-s3 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
初始版本:支持配置API密钥、上传文件并获取公开访问链接
元数据
Slug cloudflare-r2-s3
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Cloudflare R2 S3 存储工具 是什么?

Cloudflare R2 S3 兼容存储工具,支持配置 API 密钥、上传文件并获取公开访问地址。使用当需要上传文件到 Cloudflare R2 获取公开链接时。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 126 次。

如何安装 Cloudflare R2 S3 存储工具?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install cloudflare-r2-s3」即可一键安装,无需额外配置。

Cloudflare R2 S3 存储工具 是免费的吗?

是的,Cloudflare R2 S3 存储工具 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Cloudflare R2 S3 存储工具 支持哪些平台?

Cloudflare R2 S3 存储工具 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Cloudflare R2 S3 存储工具?

由 chao-eng(@chao-eng)开发并维护,当前版本 v1.0.0。

💬 留言讨论