Backblaze B2 MCP Server
OfficialServer Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| PORT | No | HTTP listen port (default: PORT or 3000) used when no --port argument is provided | 3000 |
| B2_REGION | No | Fallback/default S3-compatible endpoint region; authorized B2 responses override this for S3/report tools | us-west-004 |
| B2_APP_KEY | No | Legacy alias for B2_APPLICATION_KEY retained for compatibility | |
| B2_LOG_FILE | No | Optional path for redacted structured JSON logs. When set, the file replaces stderr; stdout is never used for logs | stderr |
| B2_HTTP_HOST | No | Standalone Node HTTP listen host; set to 127.0.0.1 when binding behind a same-host reverse proxy | |
| B2_APP_KEY_ID | No | Legacy alias for B2_APPLICATION_KEY_ID retained for compatibility | |
| B2_MASTER_KEY | No | Master credential secret for SDK-backed Partner/Groups tools; required with Partner API entitlement for those operations | |
| B2_SECRET_SINK | No | Durable-secret output mode: file, inline, or off. File mode supports b2_create_key and b2_create_group_member; b2_reserve_trial_create_account requires explicit inline mode | file |
| B2_MAX_SESSIONS | No | HTTP transport: global concurrent in-flight request cap | 1000 |
| B2_ALLOWED_HOSTS | No | HTTP transport Host allowlist (DNS-rebinding protection) — set for any internet-facing HTTP deployment | |
| B2_MASTER_KEY_ID | No | Master credential ID for SDK-backed Partner/Groups tools; required with Partner API entitlement for those operations | |
| B2_MCP_TRANSPORT | No | CLI default transport when no stdio/http argument or --transport flag is passed; Docker images set this to http | stdio |
| B2_MCP_UA_SUFFIX | No | Optional operator token appended after the built-in b2-mcp/<version> product token on the outbound User-Agent | |
| B2_ALLOWED_ORIGINS | No | HTTP transport Origin allowlist (DNS-rebinding protection) — set for any internet-facing HTTP deployment | |
| B2_APPLICATION_KEY | No | Application key secret | |
| B2_SECRET_SINK_FILE | No | Append-only plaintext JSONL credential ledger for file sink mode | ~/.b2-mcp/secrets.jsonl |
| B2_MCP_OUTPUT_FORMAT | No | LLM-facing TextContent.text format for structured successes: compact json or opt-in toon | json |
| B2_APPLICATION_KEY_ID | No | Application key ID (non-master) — the workhorse for native B2 and S3-compatible tools | |
| B2_DESTRUCTIVE_POLICY | No | Gate on destructive tools: confirm, elicit, block, or allow | confirm |
| B2_MCP_RATE_LIMIT_RPS | No | HTTP transport: per-credential request throttling (requests per second) | 60 |
| B2_ALLOW_UNSCOPED_KEYS | No | Explicitly allow b2_create_key to mint unscoped keys with write/delete capabilities | false |
| B2_TRUST_PROXY_HEADERS | No | HTTP transport: trust X-Forwarded-For / X-Real-IP for unauthenticated admission keys only behind a trusted proxy | false |
| B2_ALLOW_INLINE_SECRETS | No | Dedicated HTTP/serverless opt-in required before B2_SECRET_SINK=inline can return durable secrets in MCP responses | false |
| B2_HTTP_CREDENTIAL_MODE | No | headers, server, or principal; unset preserves existing header-based clients | headers |
| B2_MAX_SESSIONS_PER_KEY | No | HTTP transport: per-credential concurrent in-flight request cap | 20 |
| B2_MCP_RATE_LIMIT_BURST | No | HTTP transport: per-credential request throttling burst size | 120 |
| B2_ALLOW_KEY_MGMT_GRANTS | No | Explicitly allow b2_create_key to mint keys with listKeys, writeKeys, or deleteKeys | false |
| B2_CAPABILITY_CACHE_TTL_MS | No | Bounded capability-discovery cache TTL | 300000 |
| B2_DESTRUCTIVE_ELICITATION | No | Set to off, false, or 0 to disable MCP form elicitation | on |
| B2_HTTP_HEADERS_TIMEOUT_MS | No | Standalone Node HTTP transport headers timeout | 10000 |
| B2_HTTP_REQUEST_TIMEOUT_MS | No | Standalone Node HTTP transport request timeout | 30000 |
| B2_MAX_KEY_DURATION_SECONDS | No | Optional maximum for b2_create_key; when set, non-expiring keys and longer durations are refused before any B2 create call | |
| B2_PRINCIPAL_CREDENTIAL_MAP | No | JSON map from verified MCP principal to a customer-managed credential reference | |
| B2_STDIO_CAPABILITY_TIMEOUT_MS | No | Stdio bootstrap capability-discovery deadline; local expiry starts with a fail-closed tool surface | 10000 |
| B2_CAPABILITY_CACHE_MAX_ENTRIES | No | Bounded capability-discovery cache maximum entries | 10000 |
| B2_S3_SAVE_TO_PATH_IDLE_TIMEOUT_MS | No | Idle timeout while streaming s3_get_object results to saveToPath | 60000 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| resources | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| b2_authorize_accountA | Authorize with B2 and return account info including accountId, apiUrl, and downloadUrl. The server handles authorization automatically, but this tool is useful for verifying credentials and retrieving account details. |
| b2_create_bucketA | Create a persistent B2 bucket with optional metadata, CORS, lifecycle, default encryption, and Object Lock enablement. Use for initial provisioning with a key that has writeBuckets; use b2_update_bucket for later settings changes and s3_head_bucket to check S3 reachability. Bucket names are globally unique, case-insensitive, 6-63 characters, letters/digits/hyphens/periods, and cannot start with 'b2-', begin/end with a period, contain '..', or look like an IPv4 address. Because names are unique across all of B2, requesting a name already in use (by this or any other account) fails with a duplicate-name error instead of returning the existing bucket; reuse the existing bucket only if it belongs to your own account, otherwise choose a different globally unique name. |
| b2_create_group_memberA | Create a Backblaze account for a new Partner group member. In file sink mode, the one-time application key secret is written to the configured out-of-band secret sink and the MCP response contains only redacted metadata plus a secretSink pointer. In inline mode, the secret is returned with an explicit warning. |
| b2_create_keyA | Create a B2 application key and route its one-time secret through the configured secret sink. Use for least-privilege scoped credentials; use b2_list_keys to inspect existing keys and b2_delete_key to revoke retired keys. Requires writeKeys, idempotencyKey, and destructive confirmation by policy. File sink mode returns redacted metadata plus a secretSink pointer; inline mode returns the secret only when explicitly enabled. Policy refuses key-management grants and unscoped write/delete grants unless explicit environment overrides are enabled; when B2_MAX_KEY_DURATION_SECONDS is set, it also refuses non-expiring keys or durations above that limit. |
| b2_delete_bucketA | Delete a B2 bucket. The bucket must be empty — all files and file versions must be deleted first. |
| b2_delete_keyA | Permanently delete a B2 application key. Use b2_list_keys first to verify applicationKeyId, keyName, capabilities, and dependent systems; use b2_create_key before deletion when rotating credentials. Requires deleteKeys and destructive confirmation by policy. The key secret cannot be recovered, and anything still using the deleted key loses access immediately. |
| b2_eject_group_memberA | Eject a member from a Group. The account is NOT deleted — just removed (the member resets their password on next login). Optionally change their email on eject. Cannot be re-added via API (only the Group Management page). |
| b2_get_bucket_notification_rulesA | Read the B2 event-notification webhook rules for a bucket. Use before b2_set_bucket_notification_rules to diff or preserve existing rules, because set replaces the complete rule set. Requires readBucketNotifications or writeBucketNotifications, has no side effects, and redacts webhook URL host/path/query, HMAC secrets, and custom-header values in the MCP response. |
| b2_list_bucketsA | List B2 buckets for the authorized account. Optionally filter by bucket ID, name, or type. When the key is bucket-scoped and no bucketId/bucketName filter is supplied, requests are automatically narrowed to the authorized bucket IDs. Returns bucket ID, name, type, CORS rules, and lifecycle rules for each bucket. Capped to |
| b2_list_group_membersA | List active (ACCEPTED) Group members for a specific Group. Returns up to 1,000 members per call; use nextEmail for pagination. Includes B2 storage stats per member. |
| b2_list_groupsA | List active Groups administered by a Group admin account. Returns up to 100 groups per call; use nextGroupId for pagination. Requires the account to be authorized for the Partner API. |
| b2_list_keysA | List the application keys associated with the B2 account. Does not return the actual key secrets — only key IDs, names, capabilities, and restrictions. |
| b2_list_largest_filesA | List a bucket's largest objects by size via a live listing. For 'largest files', 'what's taking up space in '. Give the bucket by name or bucketId; optional path prefix. Sorting by size requires a full listing, so on very large buckets the scan is bounded by max_scan and a time budget — it then returns the largest among the objects scanned with truncated=true; pass a prefix to focus on a subtree for a complete ranking. Returns name, size, and upload time — never contents. |
| b2_rank_egress_leadersA | Rank top egress (downloaded bytes) by account or bucket over a period — default month-to-date. For 'who's downloading the most', 'where is egress concentrated'. Returns leaders with each one's share of total egress, from the daily usage reports. Scope follows the caller's key. Needs Usage Reports enabled. |
| b2_report_usage_growthA | Rank accounts by how much STORED data grew or shrank between two points in time, from the daily B2 usage reports (uses stored_gb, the end-of-day snapshot). For 'which customers grew the most/least', 'who's moving data off'. Compares the latest snapshot against one month/quarter/year earlier and fetches only those two days, so it stays fast even on large report buckets. Returns the two dates compared and per-account start vs current GB and % growth (new accounts flagged). Scope follows the caller's key (a partner key sees all its sub-accounts). Needs Usage Reports enabled. |
| b2_reserve_trial_create_accountA | Reserve and create a B2 Reserve trial account through the Partner API, returning a durable application key for the new account. Requires a Partner-entitled master key, and is a billable, irreversible account creation governed by the destructive-operation gate. Available only in explicit inline secret-sink mode because Reserve Trial has no provider-side recovery path if a file-sink write fails after account creation; the minted key is shown once, so capture it. Retries are not deduplicated server-side, so repeating the call can create another account regardless of idempotencyKey; verify whether the account already exists and reconcile before retrying. Use b2_create_group_member to add an account to an existing Partner group instead of provisioning a standalone trial. |
| b2_set_bucket_notification_rulesA | Replace the complete B2 event-notification webhook rule set for a bucket. Use b2_get_bucket_notification_rules first and submit the full desired rule set; this is not a patch or append API. Requires writeBucketNotifications and destructive confirmation by policy. Each webhook URL must be a public HTTPS endpoint, and echoed URL details, HMAC secrets, and custom-header values are redacted from the response. |
| b2_unfinished_uploadsA | Find abandoned multipart uploads that silently consume storage in a bucket. For 'bucket bloat', 'stuck/incomplete uploads', 'wasted storage'. Returns count, oldest upload age, and wasted bytes. Give the bucket by name or bucketId. Live listing, bounded by max_uploads and an internal time budget — on a very bloated bucket it returns a truncated result (and wasted_gb may be a lower bound) and recommends a lifecycle rule. |
| b2_update_bucketA | Update persistent settings on an existing B2 bucket: visibility, metadata, CORS, lifecycle, default encryption, replication, Object Lock, and default retention. Requires the writeBuckets capability. Use b2_list_buckets first to inspect the current bucketId/revision and use ifRevisionIs for safer retries; use s3_put_bucket_lifecycle only when you specifically need the S3 lifecycle API shape. Gated cases: bucketType allPublic, fileLockEnabled false, defaultRetention.mode null, lifecycleRules with daysFromHidingToDeleting, and any replicationConfiguration update. |
| b2_update_file_legal_holdA | Set or clear a legal hold on a specific file version in B2. When a legal hold is active, the file cannot be deleted regardless of retention settings. Requires the writeFileLegalHolds capability on the application key. |
| b2_update_file_retentionA | Set or modify the retention policy on a specific file version in B2. Supports governance and compliance retention modes. In compliance mode, the retain-until date can only be extended. Requires the writeFileRetentions capability. |
| s3_abort_multipart_uploadA | Abort an in-progress S3-compatible multipart upload and release all associated storage. |
| s3_complete_multipart_uploadA | Finalize an S3-compatible multipart upload in B2 by assembling uploaded parts. Use only after s3_create_multipart_upload and s3_get_presigned_upload_part_url (or s3_upload_part_copy) have produced every required part; use s3_list_parts to verify uploaded parts before retrying. Requires writeFiles. Completion is idempotent only when B2 already committed the exact same part list; if the response is lost, reconcile with s3_head_object or s3_list_object_versions before retrying. |
| s3_copy_objectA | Copy an object within B2 or between B2 buckets via B2's S3-compatible CopyObject API. The acl input is retained as a no-op S3 compatibility hint; B2 access follows the destination bucket policy. |
| s3_create_multipart_uploadA | Initiate an S3-compatible multipart upload for a large object in B2 and return an UploadId. Requires the writeFiles capability. This starts an unfinished large-file upload that accrues storage for each uploaded part until you finalize with s3_complete_multipart_upload or discard it with s3_abort_multipart_upload; use s3_list_multipart_uploads to enumerate abandoned uploads, or b2_unfinished_uploads for storage-cost analysis of a selected bucket. Initiating the upload does not reserve or lock the destination key, so concurrent writes may still target it. Use s3_put_object only for tiny (≤1 MiB) inline payloads; prefer a single-object presigned PUT (s3_get_presigned_url) for most single-object transfers, including large ones; use multipart when an object is uploaded or copied as parallel parts. Flow: s3_create_multipart_upload → s3_get_presigned_upload_part_url → PUT each part directly to B2 (capture each ETag) → s3_complete_multipart_upload with those ETags. Parts are numbered 1–10000 and every part except the last must be ≥5 MiB, and no part may exceed 5 GiB. |
| s3_delete_objectA | Delete one B2 object through the S3-compatible API. Use s3_list_object_versions first when you need to target a specific version or delete marker; use s3_delete_objects for batches up to 1000. Requires deleteFiles and destructive confirmation by policy; targeting a specific versionId additionally requires readFiles, because native B2 version binding is verified first. Omitting versionId applies normal S3 delete semantics and can create a delete marker in versioned buckets; providing versionId permanently removes that version after that binding check. |
| s3_delete_objectsA | Delete multiple objects from a B2 bucket with bounded SDK concurrency (up to 1000 objects). |
| s3_get_bucket_locationA | Get the region (location constraint) of a B2 bucket via the S3-compatible API. No native b2_* equivalent — used to verify region/endpoint pairing. |
| s3_get_objectA | Read a SMALL object inline (≤1 MiB, returned base64) — for manifests, sidecars, and configs the agent must inspect — or stream any size to a local path with saveToPath. saveToPath writes the fetched bytes to the local filesystem (creating parent directories), removes the partial file if the stream fails (cleanup of its own output only), and performs no mutation of B2 or any remote data. For real object data, generate a GetObject URL with s3_get_presigned_url and download directly from B2 (bytes never pass through the server or the model context). |
| s3_get_presigned_upload_part_urlA | Generate short-lived presigned PUT URL bearer capabilities for parts of an S3-compatible multipart upload, so the client/worker uploads each part DIRECTLY to B2. Prefer this over s3_get_presigned_url for multipart uploads; use s3_get_presigned_url for single-object PUT/GET transfers. The response includes expiresIn/expiresAt; treat each URL as sensitive until it expires. Flow: s3_create_multipart_upload → s3_get_presigned_upload_part_url → PUT each part to its URL (capture the ETag from each response header) → s3_complete_multipart_upload with those ETags. Parts except the last must be ≥5 MiB, and no part may exceed 5 GiB. |
| s3_get_presigned_urlA | Generate a short-lived presigned URL bearer capability for one B2 object — GetObject (download) or PutObject (upload). Prefer this for single-object transfers; use s3_create_multipart_upload and s3_get_presigned_upload_part_url for multipart uploads. The response includes the URL, operation, expiresIn, and expiresAt; treat the URL as sensitive until it expires. This is the preferred path for moving real object data: bytes flow directly between the client/worker and B2 and never pass through the MCP server. Note: presigned POST (browser form uploads) is NOT supported by B2; use a PutObject URL instead. |
| s3_head_bucketA | Check whether a B2 bucket exists and is reachable on the S3-compatible endpoint with the current credentials. Use this to validate S3-surface reachability (the native b2_list_buckets confirms existence but not S3 reachability). |
| s3_head_objectA | Get metadata for a B2 object without downloading it. Returns content type, size, last modified, ETag, and custom metadata. |
| s3_list_multipart_uploadsA | List in-progress S3-compatible multipart uploads for a B2 bucket. Use to resume or audit unfinished uploads before s3_get_presigned_upload_part_url, s3_complete_multipart_upload, or s3_abort_multipart_upload; use b2_unfinished_uploads when you need storage-cost analysis across bounded listings. Requires listFiles. Results are paginated with maxUploads (default 100, range 1-1000) and key/upload markers; delimiter responses include commonPrefixes. |
| s3_list_object_versionsA | List object versions and delete markers in a B2 bucket using the S3-compatible API. Use before version-targeted s3_get_object, s3_head_object, s3_copy_object, or s3_delete_object calls; use s3_list_objects_v2 when current live objects are enough. Requires listFiles. Results are paginated with maxKeys (default 1000, max 1000) and paired key/version markers. |
| s3_list_objects_v2A | List objects in a B2 bucket via the S3-compatible ListObjectsV2 API. Supports prefix filtering, delimiter-based folder listings, and pagination. |
| s3_list_partsA | List the parts that have been uploaded for an in-progress S3-compatible multipart upload. |
| s3_put_bucket_lifecycleA | Set S3 lifecycle rules on a B2 bucket; pass rules: [] to clear the S3 lifecycle configuration. Supports AbortIncompleteMultipartUpload, Expiration, and NoncurrentVersionExpiration. B2 does not support Transition/storage-class rules. |
| s3_put_objectA | Upload a SMALL object inline (≤1 MiB) to a B2 bucket — for manifests, sidecars, and tiny configs. Provide base64-encoded content or a local file path. For real object data, generate a PutObject URL with s3_get_presigned_url and upload directly to B2 (bytes never pass through the server), or use the multipart tools for large objects. |
| s3_upload_part_copyA | Copy a byte range from an existing B2 object into a part of an in-progress S3-compatible multipart upload, without downloading or re-uploading the data. Requires the writeFiles capability on the destination and read access to the source object. The source must be a bucket reachable within the same B2 account and region as the destination; cross-account sources cannot be copied this way. Use this to assemble large objects from data already in B2; use s3_get_presigned_upload_part_url instead when the client must upload new bytes. The copied part belongs to the upload created by s3_create_multipart_upload, so it obeys the 1–10000 part numbering, the ≥5 MiB minimum for every part except the last, and the 5 GiB per-part maximum. A missing or inaccessible source, or a range outside the source object, fails the part copy. Returns the part ETag to pass to s3_complete_multipart_upload. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| b2_server_config | Non-secret Backblaze B2 MCP server configuration. |
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/backblaze-labs/b2-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server