mcp-use TypeScript API
    Preparing search index...

    Interface ConnectorInitOptions

    Shared initialization options for all connector transports.

    interface ConnectorInitOptions {
        authProvider?: AuthProvider | OAuthClientProvider;
        clientOptions?: ClientOptions;
        defaultRequestOptions?: RequestOptions;
        onElicitation?: (params: {} | {}) => Promise<{ [key: string]: unknown }>;
        onNotification?: NotificationHandler;
        onSampling?: (
            params: {},
        ) => Promise<{ [key: string]: unknown } | { [key: string]: unknown }>;
        reconnectionOptions?: {
            initialReconnectionDelay?: number;
            maxReconnectionDelay?: number;
            maxRetries?: number;
            reconnectionDelayGrowFactor?: number;
        };
        roots?: {}[];
        wrapTransport?: (transport: any, serverId: string) => any;
    }
    Index
    authProvider?: AuthProvider | OAuthClientProvider

    OAuth client provider for automatic authentication

    clientOptions?: ClientOptions

    Options forwarded to the underlying MCP Client instance.

    By default, all connectors (HTTP and stdio) use DialectJsonSchemaValidator to support common $schema dialects (draft-04, draft-07, 2019-09, 2020-12) for cross-version compatibility with v1-era servers. Override with clientOptions.jsonSchemaValidator if stricter validation is needed.

    defaultRequestOptions?: RequestOptions

    Arbitrary request options (timeouts, cancellation, etc.) used by helper methods when they issue SDK requests. Can be overridden per‑call.

    onElicitation?: (params: {} | {}) => Promise<{ [key: string]: unknown }>

    Optional callback function to handle elicitation requests from servers. When provided, the client will declare elicitation capability and handle elicitation/create requests by calling this callback.

    Elicitation allows servers to request additional information from users:

    • Form mode: Collect structured data with JSON schema validation
    • URL mode: Direct users to external URLs for sensitive interactions
    onNotification?: NotificationHandler

    Optional callback for server notifications. When provided, registered as initial notification handler.

    onSampling?: (
        params: {},
    ) => Promise<{ [key: string]: unknown } | { [key: string]: unknown }>

    Optional callback function to handle sampling requests from servers. When provided, the client will declare sampling capability and handle sampling/createMessage requests by calling this callback.

    Sampling is deprecated by the 2026 protocol. Retained for v1 push requests and v2 multi-round-trip compatibility.

    reconnectionOptions?: {
        initialReconnectionDelay?: number;
        maxReconnectionDelay?: number;
        maxRetries?: number;
        reconnectionDelayGrowFactor?: number;
    }

    Reconnection options for streamable HTTP transport. Controls retry behavior of the underlying StreamableHTTPClientTransport.

    Type Declaration

    • OptionalinitialReconnectionDelay?: number

      Delay before the first reconnection attempt in milliseconds.

    • OptionalmaxReconnectionDelay?: number

      Maximum delay between reconnection attempts in milliseconds.

    • OptionalmaxRetries?: number

      Maximum number of reconnection attempts.

    • OptionalreconnectionDelayGrowFactor?: number

      Multiplier applied to the delay after each failed attempt.

    roots?: {}[]

    Initial roots to provide to the server. Roots allow the server to know which directories/files the client has access to.

    wrapTransport?: (transport: any, serverId: string) => any

    Optional callback to wrap the transport before passing it to the Client. Useful for logging, monitoring, or other transport-level interceptors.