Backblaze B2 Bucket Setup Guide

Step-by-step instructions for creating and configuring a B2 bucket for remote camera storage

1. Install B2 CLI Tools

Install the B2 command-line tools. See official documentation for more information and other operating systems.

brew install b2-tools

2. Authorize Your Account

Set up authentication with your B2 account credentials.

b2 authorize-account

3. Create the Bucket

Create a new bucket with lifecycle rules for automatic cleanup and server-side encryption.

Note: This command sets up automatic deletion of files after 2 days (1 day hidden + 1 day to delete) and enables AES256 server-side encryption.
b2 bucket create \ --lifecycle-rule '{"daysFromUploadingToHiding": 1, "daysFromHidingToDeleting": 1, "fileNamePrefix": ""}' \ --default-server-side-encryption SSE-B2 \ --default-server-side-encryption-algorithm AES256 \ mcp-remote-camera-us-east \ allPrivate

4. Configure CORS Rules

Add CORS rules to allow uploads from your web applications.

Important: The allowedOrigins must include https://www.ai.moda
b2 bucket update --cors-rules '[{"corsRuleName":"AllowS3PutAll","allowedOrigins":["https://www.ai.moda"],"allowedHeaders":["Cache-Control","Content-Disposition","Content-Encoding","Content-MD5","Content-Type","Expires","If-Match","If-None-Match","x-amz-meta-mcp-session-id"],"allowedOperations":["s3_put"],"exposeHeaders":["ETag","x-amz-request-id","x-amz-id-2","x-amz-version-id","Content-Length","Date","x-amz-expiration","x-amz-server-side-encryption"],"maxAgeSeconds":86400}]' mcp-remote-camera-us-east

5. Create Access Key

Generate an application key with read and write permissions for the bucket.

Note: The key duration is set to 1 year (31536000 seconds). Save the key ID and secret key when they are displayed.
b2 key create --bucket mcp-remote-camera-us-east --duration 31536000 mcp-remote-camera readFiles,writeFiles

6. Get S3 Endpoint (Optional)

Retrieve the S3-compatible endpoint URL for your bucket. This is needed for S3 configuration.

b2 account get | jq -r '.s3endpoint'
Next Steps: After completing these steps, use the S3 Configuration Generator to create your configuration with the endpoint URL and access keys.