@backblaze-labs/b2-mcp
    Preparing search index...

    Function fetchCapabilities

    • Discover the B2 key capabilities used for capability-aware registration.

      Parameters

      • config: B2Config

        B2 credential and runtime configuration.

      • OptionalcapabilityCacheKey: string

        Optional cache key override for tests or caller-specific HTTP routing.

      • OptionallogKey: string

        Optional non-secret log key override.

      Returns Promise<string[] | null>

      A copy of the discovered capabilities, or null when registration should expose the full tool surface.

      The returned capabilities come from b2_authorize_account and decide which tools are even registered for the credential. Setting B2_REGISTER_ALL_TOOLS=true is the explicit operator/test escape hatch and returns null; all other authorization failures are sanitized and thrown so internet-facing servers fail closed.

      Positive non-empty results are cached briefly by credential fingerprint and concurrent discoveries for the same key share one in-flight authorize call.

      CredentialResolutionError when B2 authorization or capability discovery fails.

      const capabilities = await fetchCapabilities(config);
      const server = createServer(config, capabilities);