The presign tools generate temporary S3-compatible URLs that allow clients to read from or write to R2 directly, without routing the payload through the Worker. This makes them the right choice for objects larger thanDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/xxyoudeadpunkxx/cloudflare-r2-remote-mcp-worker/llms.txt
Use this file to discover all available pages before exploring further.
MAX_TRANSFER_BYTES or any scenario where bypassing the Worker for throughput is desirable. Presign tools are disabled by default and must be enabled explicitly with ENABLE_PRESIGN_TOOLS=true.
Prerequisites
Before using presign tools, configure the following inwrangler.jsonc and your Worker secrets:
wrangler.jsonc
R2_S3_ENDPOINT is optional. When not set, it is derived automatically from CLOUDFLARE_ACCOUNT_ID as https://<account-id>.r2.cloudflarestorage.com. Set it explicitly only if you need to override this value.r2_presign_get
Generates a temporary presigned GET URL for one R2 object. The URL allows any bearer to download the object directly from R2 without authentication for the duration of the expiration window. ParametersThe object key for which to generate a download URL. Relative to
R2_ROOT_PREFIX when set.How long the URL remains valid, in seconds. Must be between 1 and 604800 (7 days). Defaults to 3600 (1 hour). Optional.
{ key: string, url: string, expiresInSeconds: number }
Example
r2_presign_put
Generates a temporary presigned PUT URL for one R2 object. The URL allows any bearer to upload content directly to R2 at the specified key without routing through the Worker. ParametersThe destination object key. Relative to
R2_ROOT_PREFIX when set.MIME type to associate with the uploaded object. When provided, the HTTP client must send a matching
Content-Type header in the PUT request. Optional.How long the URL remains valid, in seconds. Must be between 1 and 604800 (7 days). Defaults to 3600 (1 hour). Optional.
{ key: string, url: string, contentType?: string, expiresInSeconds: number }
Example
Security
Presigned URLs are bearer credentials. Anyone who obtains a URL can use it until it expires. Follow these practices when working with presigned URLs:- Use short expirations for sensitive or access-controlled content. The default is 1 hour; consider using 15–30 minutes (
900–1800seconds) when the URL is being passed to a short-lived process. - Use the minimum required expiration. The maximum is 7 days (604,800 seconds). Reserve long-lived URLs for publicly accessible content such as shared downloads.
- Scope with
R2_ROOT_PREFIX. WhenR2_ROOT_PREFIXis set, the key passed to presign tools is resolved under the root prefix before generating the URL. The client receives the relative key in the response. - Rotate R2 S3 credentials periodically and revoke them immediately if they are exposed.
MAX_TRANSFER_BYTES does not apply to presigned URL transfers. The payload goes directly between the client and R2 over S3-compatible APIs and never passes through the Worker.