Step-by-step instructions for creating and configuring a B2 bucket for remote camera storage
Install the B2 command-line tools. See official documentation for more information and other operating systems.
brew install b2-tools
Set up authentication with your B2 account credentials.
b2 authorize-account
Create a new bucket with lifecycle rules for automatic cleanup and 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
Add CORS rules to allow uploads from your web applications.
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
Generate an application key with read and write permissions for the bucket.
b2 key create --bucket mcp-remote-camera-us-east --duration 31536000 mcp-remote-camera readFiles,writeFiles
Retrieve the S3-compatible endpoint URL for your bucket. This is needed for S3 configuration.
b2 account get | jq -r '.s3endpoint'