openapi-directory-mcp
Version: 
Model Context Protocol server for accessing enhanced triple-source OpenAPI directory (APIs.guru + additional APIs + custom imports)
203 lines • 6.13 kB
TypeScript
/**
 * Custom spec client - filesystem-based implementation following ApiClient interface
 * Provides same interface as primary/secondary clients for seamless integration
 */
import { ICacheManager } from "../cache/types.js";
import { ApiGuruAPI, ApiGuruMetrics, ApiGuruServices } from "../types/api.js";
import { ManifestManager } from "./manifest-manager.js";
/**
 * Custom specification client that reads from local filesystem
 * Implements same interface as ApiClient and SecondaryApiClient
 */
export declare class CustomSpecClient {
    private manifestManager;
    private cache;
    constructor(cacheManager: ICacheManager);
    private fetchWithCache;
    /**
     * List all providers in custom specs (always returns ["custom"])
     */
    getProviders(): Promise<{
        data: string[];
    }>;
    /**
     * List all APIs for the custom provider
     */
    getProvider(provider: string): Promise<{
        data: Record<string, any>;
    }>;
    /**
     * List all services for custom provider (returns names of imported APIs)
     */
    getServices(provider: string): Promise<ApiGuruServices>;
    /**
     * Retrieve one version of a particular API (without service)
     */
    getAPI(providerOrId: string, api?: string): Promise<ApiGuruAPI>;
    /**
     * Retrieve one version of a particular API with a serviceName
     * Custom specs don't use services, so this delegates to getAPI
     */
    getServiceAPI(provider: string, service: string, _api: string): Promise<ApiGuruAPI>;
    /**
     * List all APIs from custom specs with optional pagination
     */
    listAPIs(page?: number, limit?: number): Promise<any>;
    /**
     * Get metrics for custom specs
     */
    getMetrics(): Promise<ApiGuruMetrics>;
    /**
     * Check if custom specs has a specific API
     */
    hasAPI(apiId: string): Promise<boolean>;
    /**
     * Check if custom specs has a specific provider
     */
    hasProvider(provider: string): Promise<boolean>;
    /**
     * Get paginated APIs (for compatibility)
     */
    getPaginatedAPIs(page?: number, limit?: number): Promise<{
        results: Array<{
            id: string;
            title: string;
            description: string;
            provider: string;
            preferred: string;
            categories: string[];
        }>;
        pagination: {
            page: number;
            limit: number;
            total_results: number;
            total_pages: number;
            has_next: boolean;
            has_previous: boolean;
        };
    }>;
    /**
     * Search APIs in custom specs
     */
    searchAPIs(query: string, pageOrProvider?: number | string, limitOrPage?: number, limitParam?: number): Promise<{
        data: Array<{
            id: string;
            name: string;
            title: string;
            description: string;
            provider: string;
            preferred: string;
            categories?: string[];
        }>;
        pagination: {
            page: number;
            limit: number;
            total: number;
            totalPages?: number;
            total_results?: number;
            total_pages?: number;
            has_next?: boolean;
            has_previous?: boolean;
        };
    }>;
    /**
     * Get manifest manager for direct access
     */
    getManifestManager(): ManifestManager;
    /**
     * Invalidate all custom spec caches (called when specs are imported/removed)
     */
    invalidateCache(): void;
    /**
     * Get summary information for all custom specs
     */
    getCustomSpecsSummary(): Promise<{
        total_specs: number;
        total_size: number;
        by_format: {
            yaml: number;
            json: number;
        };
        by_source: {
            file: number;
            url: number;
        };
        last_updated: string;
        specs: Array<{
            id: string;
            name: string;
            version: string;
            title: string;
            imported: string;
            size: number;
            security_issues?: number;
        }>;
    }>;
    /**
     * Get endpoints for a specific custom API
     */
    getAPIEndpoints(apiId: string, page?: number, limit?: number, tag?: string): Promise<any>;
    /**
     * Get provider statistics for custom source
     */
    getProviderStats(provider: string): Promise<any>;
    /**
     * Get API summary by ID for custom source
     */
    getAPISummaryById(apiId: string): Promise<any>;
    /**
     * Get popular APIs from custom source (returns all since custom specs are curated)
     */
    getPopularAPIs(limit?: number): Promise<any>;
    /**
     * Get recently updated APIs from custom source
     */
    getRecentlyUpdatedAPIs(limit?: number): Promise<any>;
    /**
     * Get OpenAPI specification for a custom API
     */
    getOpenAPISpec(url: string): Promise<any>;
    /**
     * Get endpoint schema for custom source
     */
    getEndpointSchema(apiId: string, method: string, path: string): Promise<any>;
    /**
     * Get endpoint examples for custom source
     */
    getEndpointExamples(apiId: string, method: string, path: string): Promise<any>;
    /**
     * Get detailed information about a specific endpoint
     */
    getEndpointDetails(apiId: string, method: string, path: string): Promise<{
        method: string;
        path: string;
        summary?: string;
        description?: string;
        operationId?: string;
        tags: string[];
        deprecated?: boolean;
        parameters: Array<{
            name: string;
            in: string;
            required: boolean;
            type: string;
            description?: string;
        }>;
        responses: Array<{
            code: string;
            description: string;
            content_types: string[];
        }>;
        consumes: string[];
        produces: string[];
        security?: Array<{
            type: string;
            scopes?: string[];
        }>;
    }>;
    /**
     * List APIs with pagination support (for testing compatibility)
     */
    private listAPIsPaginated;
}
//# sourceMappingURL=custom-spec-client.d.ts.map