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

    Interface HttpPipelineOptions

    Construction options for the runtime-neutral HTTP fetch handler.

    interface HttpPipelineOptions {
        createServer?: (
            config: B2Config,
            capabilities?: string[] | null,
            options?: CreateServerOptions,
        ) => McpServer;
        credentialProvider?: CredentialProvider;
        fetchCapabilities?: (
            config: B2Config,
            capabilityCacheKey?: string,
            logKey?: string,
        ) => Promise<string[] | null>;
        idleSweepMode?: "interval" | "request";
        mcpHandler?: Pick<McpHttpHandler, "close" | "fetch">;
        secretBroker?: SecretBroker;
    }

    Hierarchy (View Summary)

    Index
    createServer?: (
        config: B2Config,
        capabilities?: string[] | null,
        options?: CreateServerOptions,
    ) => McpServer

    Server factory override for tests and adapters.

    Type Declaration

      • (
            config: B2Config,
            capabilities?: string[] | null,
            options?: CreateServerOptions,
        ): McpServer
      • Build the MCP server and register the B2 tool surface.

        Registration is capability-aware: when capabilities is a non-null array, only tools the key can use are registered (per src/utils/tool-capabilities), and Partner tools register only with a distinct master key. null/undefined registers the full surface (operator override and legacy unit tests); an empty array is a fail-closed capability set, not "unknown".

        Credential model: B2_APPLICATION_KEY_ID / B2_APPLICATION_KEY is the application key that drives the B2 native API, S3, and key management. Only the Partner API tools use a master key (B2_MASTER_KEY_ID / B2_MASTER_KEY, optional); a single non-master key covers everything else. B2's S3 endpoint rejects master keys, which is why the application key is the primary credential.

        Parameters

        • config: B2Config

          Resolved B2 credentials and runtime policy.

        • Optionalcapabilities: string[] | null

          Capabilities returned by B2 authorize, null for the full-surface operator override, or an empty array to fail closed.

        • options: CreateServerOptions = {}

          Optional caller-scoped controls such as verified OAuth scopes.

        Returns McpServer

        The configured MCP server instance.

        const config = loadConfig();
        const capabilities = await fetchCapabilities(config);
        const server = createServer(config, capabilities);
    credentialProvider?: CredentialProvider

    Credential provider used to resolve B2 config for each request.

    fetchCapabilities?: (
        config: B2Config,
        capabilityCacheKey?: string,
        logKey?: string,
    ) => Promise<string[] | null>

    Capability discovery override for tests and adapters.

    Type Declaration

      • (
            config: B2Config,
            capabilityCacheKey?: string,
            logKey?: string,
        ): Promise<string[] | null>
      • 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);
    idleSweepMode?: "interval" | "request"

    Whether idle sweeps run on an interval or only on request handling.

    mcpHandler?: Pick<McpHttpHandler, "close" | "fetch">

    Optional MCP SDK handler override for tests.

    secretBroker?: SecretBroker

    Secret broker used when principal credential mode is active.