UNPKG

mcp-adr-analysis-server

Version:

MCP server for analyzing Architectural Decision Records and project architecture

119 lines 3.89 kB
/** * Configuration management for MCP ADR Analysis Server * Handles environment variables and default settings */ import { z } from 'zod'; /** * Configuration schema for validation */ declare const ConfigSchema: z.ZodObject<{ projectPath: z.ZodString; adrDirectory: z.ZodDefault<z.ZodString>; logLevel: z.ZodDefault<z.ZodEnum<{ DEBUG: "DEBUG"; INFO: "INFO"; WARN: "WARN"; ERROR: "ERROR"; }>>; cacheEnabled: z.ZodDefault<z.ZodBoolean>; cacheDirectory: z.ZodDefault<z.ZodString>; maxCacheSize: z.ZodDefault<z.ZodNumber>; analysisTimeout: z.ZodDefault<z.ZodNumber>; firecrawlApiKey: z.ZodOptional<z.ZodString>; firecrawlBaseUrl: z.ZodDefault<z.ZodString>; firecrawlEnabled: z.ZodDefault<z.ZodBoolean>; }, z.core.$strip>; export type ServerConfig = z.infer<typeof ConfigSchema>; /** * Load and validate configuration from environment variables * * @description Loads server configuration from environment variables with fallback defaults. * Validates all configuration values using Zod schema and returns a type-safe config object. * * @returns {ServerConfig} Validated configuration object with all required settings * * @throws {Error} When configuration validation fails or required values are missing * * @example * ```typescript * // Load configuration with environment variables * process.env.PROJECT_PATH = '/path/to/project'; * process.env.LOG_LEVEL = 'DEBUG'; * * const config = loadConfig(); * console.log(config.projectPath); // '/path/to/project' * console.log(config.logLevel); // 'DEBUG' * ``` * * @example * ```typescript * // Load configuration with defaults * const config = loadConfig(); * console.log(config.adrDirectory); // 'docs/adrs' * console.log(config.cacheEnabled); // true * console.log(config.maxCacheSize); // 104857600 (100MB) * ``` * * @since 2.0.0 * @category Configuration */ export declare function loadConfig(): ServerConfig; /** * Get the absolute path for ADR directory */ export declare function getAdrDirectoryPath(config: ServerConfig): string; /** * Get the absolute path for cache directory */ export declare function getCacheDirectoryPath(config: ServerConfig): string; /** * Validate that the project path exists and is accessible * * @description Performs filesystem validation to ensure the specified project path * exists, is accessible, and is a directory. This is critical for server initialization * as all ADR analysis operations depend on a valid project root. * * @param {string} projectPath - Absolute or relative path to validate * * @returns {Promise<void>} Resolves if path is valid, rejects with descriptive error * * @throws {Error} When path doesn't exist, isn't a directory, or isn't accessible * * @example * ```typescript * // Validate existing project directory * await validateProjectPath('/path/to/project'); * console.log('Project path is valid'); * ``` * * @example * ```typescript * // Handle validation errors * try { * await validateProjectPath('/invalid/path'); * } catch (error) { * console.error('Validation failed:', error.message); * // Error: PROJECT_PATH does not exist: /invalid/path * } * ``` * * @since 2.0.0 * @category Configuration * @category Validation */ export declare function validateProjectPath(projectPath: string): Promise<void>; /** * Create logger with configured log level */ export declare function createLogger(config: ServerConfig): { debug: (message: string, ...args: any[]) => void; info: (message: string, ...args: any[]) => void; warn: (message: string, ...args: any[]) => void; error: (message: string, ...args: any[]) => void; }; /** * Print configuration summary for debugging */ export declare function printConfigSummary(config: ServerConfig): void; export {}; //# sourceMappingURL=config.d.ts.map