r2-uploader-mcp
Enables uploading PR screenshots to Cloudflare R2 via presigned URLs, allowing Claude to attach images to PR descriptions without binary data passing through MCP.
README
[!WARNING] Deprecated. I no longer use or maintain this. Now I use dtinth/s3-uploader-mcp which supports any S3-compatible object storage service in addition to R2. I originally built this MCP server with Cloudflare Workers because (1) Cloudflare Workers has a built-in integration with R2; and (2) Cloudflare Access has Managed OAuth where it handles the OAuth 2 + DCR dance, making it easy to secure MCP servers without having to handle the MCP Authorization Flow by ourselves (just validate the
Cf-Access-Jwt-Assertionheader that Cloudflare Access injects into our MCP server). However, (1) The built-in integration with R2 doesn’t support generating presigned URLs, for that we need to generate Access Key and Secret Access Keys, negating the benefits of having a built-in integration; and (2) Cloudflare Access has a session duration cap of 1 month, meaning I must re-authentiate with the MCP server monthly. The resulting service is now hard to deploy and inconvenient to use, unlike the plug-and-play experience I envisioned, hence the pivot.
r2-uploader-mcp
MCP server for uploading PR screenshots to Cloudflare R2, secured by Cloudflare Access.
Claude Code calls get_upload_url, gets a presigned PUT URL, uploads the file
with curl, then embeds the public URL in the PR description. No binary data
goes through MCP — clean and fast.
Architecture
Claude (chat/code)
└── MCP tool call: get_upload_url("before.png")
└── Worker generates R2 presigned PUT URL + public URL
└── Claude Code: curl -X PUT -T before.png "<put_url>"
└── R2 stores file, public URL embeds in PR markdown
Auth flow:
Claude → Cloudflare Access OAuth dance → JWT injected as Cf-Access-Jwt-Assertion
Worker verifies JWT (issuer, audience, expiry) → serves MCP
Upload URLs are presigned using the R2 S3 API
(via aws4fetch) with an R2 API token —
the Worker doesn't use an r2_buckets binding.
Deploy
Everything below is post-deploy dashboard configuration — no code edits or redeploys needed.
1. Create the R2 bucket
wrangler r2 bucket create r2-uploads
Enable public access in the Cloudflare dashboard: R2 → r2-uploads → Settings → Public Access → Enable
Copy the public bucket URL (looks like pub-abc123.r2.dev).
2. Create an R2 API token
- Go to R2 → Overview → Manage API tokens (or R2 → r2-uploads → Settings → API tokens)
- Create API token
- Permissions: Object Read & Write, scoped to the
r2-uploadsbucket - Copy the Access Key ID, Secret Access Key, and your Account ID (shown in the token details / R2 overview sidebar)
3. Create a Cloudflare Access self-hosted app
- Go to Cloudflare One → Access controls → Applications
- Add an application → Self-hosted and private
- Under Destinations → Public hostnames, enter your deployed Worker's subdomain and domain (e.g.
r2-uploader-mcp.<YOUR_SUBDOMAIN>.workers.dev) - Name:
R2 Uploader MCP - Add a policy: allow your email address (or email domain)
- Configure your IdP (Google, GitHub, OTP, etc.)
- On the Additional settings tab, turn on Managed OAuth — this lets non-browser MCP clients (like Claude Code) authenticate via a standard OAuth 2.0 flow instead of a browser redirect
- To connect from claude.ai (web), add
https://claude.ai/api/mcp/auth_callbackas an allowed redirect URI in the Managed OAuth settings - Save — copy the AUD tag from the app's Basic Information (under Additional settings)
4. Set the Worker's secrets
In the Cloudflare dashboard: Workers & Pages → r2-uploader-mcp → Settings → Variables and Secrets, add each of these as a Secret (not a plaintext Variable):
| Secret | Value |
|---|---|
TEAM_DOMAIN |
https://yourteam.cloudflareaccess.com |
POLICY_AUD |
the AUD tag from step 3 |
R2_PUBLIC_DOMAIN |
the public bucket domain from step 1 (e.g. pub-abc123def456.r2.dev) |
R2_ACCOUNT_ID |
your Cloudflare account ID from step 2 |
R2_BUCKET_NAME |
r2-uploads |
R2_ACCESS_KEY_ID |
Access Key ID from step 2 |
R2_SECRET_ACCESS_KEY |
Secret Access Key from step 2 |
ALLOWED_EXTS (optional) |
comma-separated extensions, e.g. .png,.jpg,.webm,.zip,.html. Defaults to .png,.jpg,.jpeg,.gif,.webp |
UPLOAD_PREFIX (optional) |
key prefix for uploaded objects, e.g. screenshots/. Defaults to uploads/ |
These take effect immediately — no redeploy required. Using Secrets (rather
than the vars block in wrangler.jsonc) means they won't be reset by
the automatic redeploys from the Workers Builds pipeline the deploy button
sets up.
The dashboard's "Edit variables" view has a bulk-paste mode — fill in the placeholders below and paste the whole block in:
TEAM_DOMAIN=https://yourteam.cloudflareaccess.com
POLICY_AUD=<AUD tag from Access app>
R2_PUBLIC_DOMAIN=pub-abc123def456.r2.dev
R2_ACCOUNT_ID=<your Cloudflare account ID>
R2_BUCKET_NAME=r2-uploads
R2_ACCESS_KEY_ID=<R2 API token access key id>
R2_SECRET_ACCESS_KEY=<R2 API token secret access key>
ALLOWED_EXTS=.png,.jpg,.jpeg,.gif,.webp
UPLOAD_PREFIX=uploads/
ALLOWED_EXTS and UPLOAD_PREFIX are optional — drop those two lines to use
the defaults shown above. Make sure each one is added as a Secret, not a
plaintext Variable.
5. Connect to Claude
In Claude settings → MCP → Add server:
https://r2-uploader-mcp.<YOUR_SUBDOMAIN>.workers.dev/mcp
Claude will initiate the Access OAuth flow the first time you connect.
Usage
In Claude Code
Tell Claude Code to include a screenshot in the PR:
Take a screenshot of the rendered UI, upload it, and include it in the PR description.
Claude Code will:
- Call
get_upload_url("screenshot.png") - Run the returned
curlcommand to upload - Embed
in the PR body using the returned public URL
Tools
| Tool | Description |
|---|---|
get_upload_url(filename) |
Returns presigned PUT URL + public URL + ready-to-run curl command |
Notes
- Presigned URLs expire in 5 minutes — Claude Code should upload immediately after receiving them
- File types allowed:
.png,.jpg,.jpeg,.gif,.webpby default — configurable via theALLOWED_EXTSvariable - Keys are namespaced as
uploads/<date>/<uuid><ext>by default — configurable via theUPLOAD_PREFIXvariable - The R2 public bucket URL is permanent — uploaded files don't expire
- Public URLs are unguessable (random UUID per file) but not access-controlled — anyone with the link can view the file
- Access logs every connection attempt in the Cloudflare One dashboard
- The Worker logs each request (method, path, authenticated email or rejection reason) and each
get_upload_urlcall to the console — view live withwrangler tailor in Workers & Pages → r2-uploader-mcp → Logs
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。