/**
 * MCP Registry Client
 *
 * Client for discovering MCP servers from centralized registries.
 * Supports multiple registry sources including:
 * - Official MCP Registry
 * - NPM packages
 * - GitHub repositories
 * - Custom registries
 *
 * @module mcp/mcpRegistryClient
 * @since 8.39.0
 */
import { EventEmitter } from "events";
import type { MCPServerInfo, MCPTransportType } from "../types/mcpTypes.js";
import type { JsonObject } from "../types/common.js";
/**
 * Registry source types
 */
export type RegistrySourceType = "official" | "npm" | "github" | "custom";
/**
 * Registry entry for an MCP server
 */
export type RegistryEntry = {
    /**
     * Unique identifier
     */
    id: string;
    /**
     * Server name
     */
    name: string;
    /**
     * Server description
     */
    description: string;
    /**
     * Server version
     */
    version: string;
    /**
     * Author or maintainer
     */
    author?: string;
    /**
     * License
     */
    license?: string;
    /**
     * Homepage URL
     */
    homepage?: string;
    /**
     * Repository URL
     */
    repository?: string;
    /**
     * NPM package name (if applicable)
     */
    npmPackage?: string;
    /**
     * Installation command
     */
    installCommand?: string;
    /**
     * Command to run the server
     */
    command?: string;
    /**
     * Command arguments
     */
    args?: string[];
    /**
     * Required environment variables
     */
    requiredEnvVars?: string[];
    /**
     * Supported transport types
     */
    transports?: MCPTransportType[];
    /**
     * Server categories
     */
    categories?: string[];
    /**
     * Server tags
     */
    tags?: string[];
    /**
     * Tool names provided by the server
     */
    tools?: string[];
    /**
     * Download count (popularity metric)
     */
    downloads?: number;
    /**
     * Star count (if from GitHub)
     */
    stars?: number;
    /**
     * Last updated date
     */
    lastUpdated?: string;
    /**
     * Verification status
     */
    verified?: boolean;
    /**
     * Custom metadata
     */
    metadata?: JsonObject;
};
/**
 * Registry configuration
 */
export type RegistryConfig = {
    /**
     * Registry type
     */
    type: RegistrySourceType;
    /**
     * Registry URL or identifier
     */
    url?: string;
    /**
     * Authentication token
     */
    authToken?: string;
    /**
     * Request timeout in milliseconds
     */
    timeout?: number;
    /**
     * Enable caching
     */
    enableCache?: boolean;
    /**
     * Cache TTL in milliseconds
     */
    cacheTTL?: number;
};
/**
 * Search options for registry queries
 */
export type RegistrySearchOptions = {
    /**
     * Search query (name, description, tags)
     */
    query?: string;
    /**
     * Filter by categories
     */
    categories?: string[];
    /**
     * Filter by tags
     */
    tags?: string[];
    /**
     * Filter by transport type
     */
    transport?: MCPTransportType;
    /**
     * Only verified servers
     */
    verifiedOnly?: boolean;
    /**
     * Sort by field
     */
    sortBy?: "name" | "downloads" | "stars" | "lastUpdated";
    /**
     * Sort direction
     */
    sortDirection?: "asc" | "desc";
    /**
     * Maximum results
     */
    limit?: number;
    /**
     * Offset for pagination
     */
    offset?: number;
};
/**
 * Search result
 */
export type RegistrySearchResult = {
    entries: RegistryEntry[];
    totalCount: number;
    page: number;
    pageSize: number;
    hasMore: boolean;
};
/**
 * Registry client configuration
 */
export type MCPRegistryClientConfig = {
    /**
     * Default registries to use
     */
    registries?: RegistryConfig[];
    /**
     * Enable automatic caching
     */
    enableCache?: boolean;
    /**
     * Default cache TTL
     */
    defaultCacheTTL?: number;
    /**
     * Request timeout
     */
    timeout?: number;
    /**
     * User agent string
     */
    userAgent?: string;
};
/**
 * MCP Registry Client
 *
 * Provides methods to discover and install MCP servers from registries.
 *
 * @example
 * ```typescript
 * const client = new MCPRegistryClient();
 *
 * // Search for servers
 * const results = await client.search({ query: "database" });
 *
 * // Get server details
 * const entry = await client.getEntry("postgres");
 *
 * // Convert to MCPServerInfo
 * const serverInfo = client.toServerInfo(entry);
 * ```
 */
export declare class MCPRegistryClient extends EventEmitter {
    private config;
    private cache;
    private customEntries;
    constructor(config?: MCPRegistryClientConfig);
    /**
     * Search the registry
     */
    search(options?: RegistrySearchOptions): Promise<RegistrySearchResult>;
    /**
     * Get a specific entry by ID
     */
    getEntry(id: string): Promise<RegistryEntry | undefined>;
    /**
     * Get all available entries
     */
    getAllEntries(): Promise<RegistryEntry[]>;
    /**
     * Get entries by category
     */
    getByCategory(category: string): Promise<RegistryEntry[]>;
    /**
     * Get entries by tag
     */
    getByTag(tag: string): Promise<RegistryEntry[]>;
    /**
     * Get all categories
     */
    getCategories(): Promise<string[]>;
    /**
     * Get all tags
     */
    getTags(): Promise<string[]>;
    /**
     * Convert registry entry to MCPServerInfo
     */
    toServerInfo(entry: RegistryEntry): MCPServerInfo;
    /**
     * Add a custom registry entry
     */
    addCustomEntry(entry: RegistryEntry): void;
    /**
     * Remove a custom registry entry
     */
    removeCustomEntry(id: string): boolean;
    /**
     * Add a registry configuration
     */
    addRegistry(config: RegistryConfig): void;
    /**
     * Clear the cache
     */
    clearCache(): void;
    /**
     * Check if required environment variables are set
     */
    checkRequiredEnvVars(entry: RegistryEntry): {
        ready: boolean;
        missing: string[];
    };
    /**
     * Get installation command for an entry
     */
    getInstallCommand(entry: RegistryEntry): string | undefined;
    /**
     * Get popular servers
     */
    getPopularServers(limit?: number): Promise<RegistryEntry[]>;
    /**
     * Get verified servers
     */
    getVerifiedServers(): Promise<RegistryEntry[]>;
    /**
     * Get statistics
     */
    getStatistics(): Promise<{
        totalEntries: number;
        verifiedEntries: number;
        categories: number;
        tags: number;
        customEntries: number;
    }>;
}
/**
 * Global MCP registry client instance
 */
export declare const globalMCPRegistryClient: MCPRegistryClient;
/**
 * Quick lookup function for well-known servers
 */
export declare function getWellKnownServer(id: string): RegistryEntry | undefined;
/**
 * Get all well-known servers
 */
export declare function getAllWellKnownServers(): RegistryEntry[];
