@mcp-z/client
    Preparing search index...

    Interface ServerRegistry

    A registry of spawned MCP servers with connection management. Provides access to individual server handles, connection management, and collection-wide close.

    interface ServerRegistry {
        "[asyncDispose]": () => Promise<void>;
        clients: Set<ManagedClient>;
        close: (
            signal?: Signals,
            opts?: { timeoutMs?: number },
        ) => Promise<CloseResult>;
        config: ServersConfig;
        connect: (
            name: string,
            options?: {
                dcrAuthenticator?: Partial<DcrAuthenticatorOptions>;
                logger?: Logger;
                versionNegotiation?: VersionNegotiationOptions;
            },
        ) => Promise<ManagedClient>;
        searchCapabilities: (
            query: string,
            options?: SearchOptions,
        ) => Promise<SearchResponse>;
    }
    Index
    "[asyncDispose]": () => Promise<void>

    Support for await using pattern (automatic close).

    clients: Set<ManagedClient>

    Set of connected clients tracked by this registry. Automatically populated when using registry.connect().

    close: (signal?: Signals, opts?: { timeoutMs?: number }) => Promise<CloseResult>

    Close all clients and servers gracefully. Stops new connections, waits for in-flight connections, closes tracked clients, and then stops only processes owned by this registry. Stdio children receive stdin EOF first and the requested signal on POSIX if they remain open; owned HTTP children may use their configured application-specific stop command. POSIX cleanup tracks the detached process group; Windows can terminate only the direct child and cannot verify descendants. Cleanup failures are reported after every owned resource has been attempted.

    Type Declaration

      • (signal?: Signals, opts?: { timeoutMs?: number }): Promise<CloseResult>
      • Parameters

        • Optionalsignal: Signals

          Signal to send to processes (default: SIGINT)

        • Optionalopts: { timeoutMs?: number }

          Options including timeout

        Returns Promise<CloseResult>

        Promise resolving to whether any process timed out and how many required emergency force termination

    The resolved servers configuration that was used. Useful for debugging and understanding what was started.

    connect: (
        name: string,
        options?: {
            dcrAuthenticator?: Partial<DcrAuthenticatorOptions>;
            logger?: Logger;
            versionNegotiation?: VersionNegotiationOptions;
        },
    ) => Promise<ManagedClient>

    Connect to a server by name. The connected client is automatically tracked for close.

    Type Declaration

      • (
            name: string,
            options?: {
                dcrAuthenticator?: Partial<DcrAuthenticatorOptions>;
                logger?: Logger;
                versionNegotiation?: VersionNegotiationOptions;
            },
        ): Promise<ManagedClient>
      • Parameters

        • name: string

          Server name from configuration

        • Optionaloptions: {
              dcrAuthenticator?: Partial<DcrAuthenticatorOptions>;
              logger?: Logger;
              versionNegotiation?: VersionNegotiationOptions;
          }

          Authentication, logging, and protocol negotiation options

        Returns Promise<ManagedClient>

        Connected MCP SDK Client

    searchCapabilities: (
        query: string,
        options?: SearchOptions,
    ) => Promise<SearchResponse>

    Search indexed capabilities across all currently connected clients. Requires at least one connected client; respects SearchOptions filters.