"use client";
import { useCallback } from "react";
import { useStigmer } from "../hooks";
import { useResourceList } from "../search";
/**
 * Data hook that fetches a paginated list of MCP servers for the Library.
 *
 * Wraps `stigmer.mcpServer.list()` with pagination, scope filtering,
 * and text search. All parameters are externally controlled — the
 * consumer manages page state, query debouncing, and scope toggling.
 *
 * For picker/type-ahead search with internal debouncing and query
 * state management, use {@link useMcpServerSearch} instead.
 *
 * Pass `null` as `org` to skip fetching (stable no-op).
 *
 * @example
 * ```tsx
 * const { mcpServers, totalCount, isLoading } = useMcpServerList("acme", {
 *   page: 1,
 *   pageSize: 20,
 *   scope: "org",
 * });
 * ```
 *
 * @example
 * ```tsx
 * // Show all MCP servers including public/platform ones
 * const { mcpServers } = useMcpServerList("acme", { scope: "all" });
 * ```
 */
export function useMcpServerList(org, options) {
    const stigmer = useStigmer();
    const listFn = useCallback((params) => stigmer.mcpServer.list(params), [stigmer]);
    const { entries, totalCount, totalPages, currentPage, isLoading, error, refetch } = useResourceList(listFn, org, options);
    return { mcpServers: entries, totalCount, totalPages, currentPage, isLoading, error, refetch };
}
//# sourceMappingURL=useMcpServerList.js.map