/** * Health Scoring System * * Calculates a comprehensive health score (0-100) for an MCP server. * Combines multiple factors: test coverage, error rate, performance, deprecation, and breaking changes. */ import type { BehavioralBaseline, BehavioralDiff, ChangeSeverity } from './types.js'; import type { PerformanceReport } from './performance-tracker.js'; import type { DeprecationReport } from './deprecation-tracker.js'; import type { DiffImpactAnalysis } from './change-impact-analyzer.js'; /** * Health trend direction. */ export type HealthTrend = 'improving' | 'stable' | 'degrading'; /** * Priority level for action items. */ export type ActionPriority = 'critical' | 'high' | 'medium' | 'low'; /** * Action item for improving health score. */ export interface HealthActionItem { /** Priority of the action */ priority: ActionPriority; /** Category of the action */ category: 'coverage' | 'errors' | 'performance' | 'deprecation' | 'breaking_changes' | 'documentation'; /** Description of the issue */ description: string; /** Suggested action to take */ suggestedAction: string; /** Estimated impact on health score */ estimatedImpact: number; /** Related tool name (if applicable) */ tool?: string; } /** * Component scores that make up the overall health score. */ export interface HealthComponents { /** Test coverage score (0-100) - % of tools with passing tests */ testCoverage: number; /** Error rate score (0-100) - inverse of % failing tests */ errorRate: number; /** Performance score (0-100) - based on latency trends */ performanceScore: number; /** Deprecation score (0-100) - penalty for deprecated tools */ deprecationScore: number; /** Breaking change score (0-100) - penalty for breaking changes */ breakingChangeScore: number; /** Documentation score (0-100) - based on description quality */ documentationScore: number; } /** * Comprehensive health score result. */ export interface HealthScore { /** Overall health score (0-100) */ overall: number; /** Individual component scores */ components: HealthComponents; /** Health trend (requires historical data) */ trend: HealthTrend; /** Letter grade (A-F) */ grade: string; /** Severity classification */ severity: ChangeSeverity; /** Prioritized action items for improvement */ actionItems: HealthActionItem[]; /** Human-readable summary */ summary: string; /** Timestamp of when score was calculated */ calculatedAt: Date; } /** * Historical health data for trend analysis. */ export interface HealthHistory { /** Timestamp */ timestamp: Date; /** Overall score at that time */ overallScore: number; /** Component scores at that time */ components: HealthComponents; } /** * Input data for health calculation. */ export interface HealthInput { /** Current baseline */ baseline: BehavioralBaseline; /** Diff from previous baseline (if available) */ diff?: BehavioralDiff; /** Performance report (if available) */ performanceReport?: PerformanceReport; /** Deprecation report (if available) */ deprecationReport?: DeprecationReport; /** Impact analysis (if available) */ impactAnalysis?: DiffImpactAnalysis; /** Historical health data for trend analysis */ history?: HealthHistory[]; /** Test results (tool name -> passed/failed) */ testResults?: Map; } export { HEALTH_SCORING } from '../constants.js'; /** * Weight configuration for component scores. * Uses values from centralized constants. */ export declare const HEALTH_WEIGHTS: { readonly testCoverage: 0.25; readonly errorRate: 0.25; readonly performanceScore: 0.15; readonly deprecationScore: 0.1; readonly breakingChangeScore: 0.15; readonly documentationScore: 0.1; }; /** * Grade thresholds. * Uses values from centralized constants. */ export declare const GRADE_THRESHOLDS: { readonly A: 90; readonly B: 80; readonly C: 70; readonly D: 60; readonly F: 0; }; /** * Severity thresholds. * Uses values from centralized constants. */ export declare const SEVERITY_THRESHOLDS: { readonly none: 90; readonly info: 70; readonly warning: 50; readonly breaking: 0; }; /** * Penalty values for various issues. * Uses values from centralized constants. */ export declare const HEALTH_PENALTIES: { readonly deprecatedTool: 10; readonly expiredTool: 25; readonly breakingChange: 15; readonly warningChange: 5; readonly missingDescription: 5; readonly shortDescription: 2; readonly performanceRegression: 10; }; /** * Calculate comprehensive health score for an MCP server. */ export declare function calculateHealthScore(input: HealthInput): HealthScore; /** * Format health score for console output. */ export declare function formatHealthScore(score: HealthScore): string; /** * Check if health score meets minimum threshold. */ export declare function meetsHealthThreshold(score: HealthScore, minScore: number): boolean; /** * Get health badge color based on score. */ export declare function getHealthBadgeColor(score: number): 'green' | 'yellow' | 'orange' | 'red'; /** * Create a health history entry from a health score. */ export declare function createHealthHistoryEntry(score: HealthScore): HealthHistory; //# sourceMappingURL=health-scorer.d.ts.map