/** * Profile configuration loader and validator * * Why validation: Profile config comes from user files. Invalid config would * cause runtime errors. Validate upfront with clear error messages. * * ✅ Schemas are now auto-generated from TypeScript types! * When adding fields to src/types/profile.ts: * 1. Update TypeScript interface (compile-time checking) * 2. Run `npm run generate-schemas` (auto-generates JSON + Zod schemas) * 3. That's it! No manual sync needed. * * See IMPLEMENTATION.md for details. */ import type { Profile } from '../types/profile.js'; import type { OpenAPIParser } from '../openapi/openapi-parser.js'; export declare class ProfileLoader { load(profilePath: string): Promise; /** * Validate semantic rules beyond schema * * Why separate: Some rules can't be expressed in JSON Schema (e.g., * "if composite=true then steps must exist"). Fail fast with clear messages. */ private validateLogic; private validatePrompts; private extractPromptTemplateVariables; /** * Generate helpful suggestions for invalid operation keys */ private generateOperationKeySuggestions; /** * Validate composite steps form a DAG (no circular dependencies) * * Why: Circular dependencies would cause infinite loops or deadlocks. * We use DFS with color-coding to detect cycles. */ private validateCompositeStepsDAG; /** * Create a default profile with auto-generated tools from OpenAPI spec * * Why: Allows running server without profile for quick exploration. * Generates simple pass-through tools for all operations. * * Auth Strategy: * 1. Parse security scheme from OpenAPI spec * 2. If found, generate auth interceptor * 3. Fallback to bearer token from MCP4_API_TOKEN env var */ static createDefaultProfile(profileName: string, parser: OpenAPIParser): Profile; /** * Generate auth interceptor from OpenAPI security scheme * * Strategy: * 1. Parse security scheme from OpenAPI spec * 2. If not found, check for force auth override via env vars * 3. Map to profile auth interceptor format * 4. Use env var name from AUTH_ENV_VAR or default to MCP4_API_TOKEN * * Returns empty object if no security scheme found (public API) and no force override */ private static generateAuthInterceptor; /** * Generate a simple tool from an OpenAPI operation * * Creates a tool with parameters based on the operation's path/query/header parameters * and request body. Uses operationId as tool name and summary/description for tool description. */ private static generateToolFromOperation; /** * Map OpenAPI schema to parameter type */ private static mapOpenAPISchemaToParameterType; /** * Recursively flatten schema properties to parameters */ private static flattenSchemaToParameters; private static normalizeToolNames; } //# sourceMappingURL=profile-loader.d.ts.map