UNPKG

mcp-swagger-parser

Version:

Enterprise-grade OpenAPI/Swagger specification parser for Model Context Protocol (MCP) projects

61 lines 1.89 kB
/** * Core OpenAPI parser */ import type { OpenAPISpec, ParseResult, ParserConfig, ValidationResult } from '../types/index'; /** * Main OpenAPI parser class */ export declare class OpenAPIParser { private config; private urlParser; private fileParser; private textParser; private validator; private normalizer; private swagger2Converter; constructor(config?: ParserConfig); /** * Parse OpenAPI specification from a URL */ parseFromUrl(url: string, options?: { timeout?: number; headers?: Record<string, string>; }): Promise<ParseResult>; /** * Parse OpenAPI specification from a file */ parseFromFile(filePath: string, options?: { encoding?: BufferEncoding; }): Promise<ParseResult>; /** * Parse OpenAPI specification from text content */ parseFromString(content: string, options?: { format?: 'json' | 'yaml' | 'auto'; filename?: string; }): Promise<ParseResult>; /** * Validate an OpenAPI specification */ validate(spec: OpenAPISpec): Promise<ValidationResult>; /** * Process and validate the parsed specification */ private processSpec; /** * Generate metadata for the parsed specification */ private generateMetadata; /** * Handle and transform errors */ private handleError; } /** * Convenience functions for quick parsing */ export declare function parseFromUrl(url: string, config?: ParserConfig): Promise<ParseResult>; export declare function parseFromFile(filePath: string, config?: ParserConfig): Promise<ParseResult>; export declare function parseFromString(content: string, config?: ParserConfig): Promise<ParseResult>; export declare function validate(spec: OpenAPISpec, config?: ParserConfig): Promise<ValidationResult>; //# sourceMappingURL=parser.d.ts.map