UNPKG

mcp-cve-intelligence-server-lite-test

Version:

Lite Model Context Protocol server for comprehensive CVE intelligence gathering with multi-source exploit discovery, designed for security professionals and cybersecurity researchers - Alpha Release

122 lines 4.43 kB
import { CVE, CVESearchFilters, CVESearchResult, CVESource } from '../types/cve.js'; export interface SourceValidationResult { isValid: boolean; errors: string[]; warnings: string[]; } export interface RequestOptions { headers: Record<string, string>; timeout: number; } export declare abstract class BaseCVESourceImplementation { protected static readonly USER_AGENT: string; protected config: CVESource; protected apiKey?: string; constructor(config: CVESource, apiKey?: string); abstract buildSearchRequest(filters: CVESearchFilters): { url: string; options: RequestOptions; }; abstract buildDetailsRequest(cveId: string): { url: string; options: RequestOptions; }; abstract normalizeSearchResults(data: Record<string, unknown>): CVESearchResult; abstract normalizeCVEData(data: Record<string, unknown>): CVE; /** * Validates the source configuration * Default implementation checks basic requirements */ validateConfig(): SourceValidationResult; /** * Validates API key configuration for this source * Default implementation provides basic API key checks */ validateApiKey(): SourceValidationResult; /** * Override this method in concrete implementations for source-specific configuration validation */ protected validateSourceSpecificConfig(): SourceValidationResult; /** * Override this method in concrete implementations for source-specific API key validation */ protected validateSourceSpecificApiKey(): SourceValidationResult; /** * Gets the expected API key environment variable name for this source * Override in concrete implementations to specify the correct env var */ getApiKeyEnvironmentVariable(): string | undefined; /** * Gets alternative environment variable names that might contain the API key * Override in concrete implementations to specify alternative env vars */ getAlternativeApiKeyEnvironmentVariables(): string[]; /** * Determines if this source can use the provided API key * Override in concrete implementations for source-specific key validation */ canUseApiKey(apiKey: string): boolean; /** * Gets the source-specific identifier used for API key mapping * Override in concrete implementations to specify the correct identifier */ getApiKeyIdentifier(): string; /** * Determines if this source matches the given source name/identifier * Used for API key resolution from external mappings */ matchesSourceIdentifier(identifier: string): boolean; /** * Performs comprehensive validation of the source */ validateFull(): SourceValidationResult; testConnection(): Promise<boolean>; getBaseUrl(): string; protected getTimeout(): number; /** * Gets authentication headers for API requests. * Override this method in concrete implementations for custom authentication schemes. * * @returns Record of header name to header value */ protected getAuthHeaders(): Record<string, string>; /** * Public method to get authentication headers for external use (e.g., SourceManager) * This method delegates to the protected getAuthHeaders() method that can be overridden by subclasses * * @returns Record of header name to header value */ getRequestAuthHeaders(): Record<string, string>; /** * Gets the standard User-Agent string for all CVE sources */ protected getUserAgent(): string; getConfig(): CVESource; getName(): string; isEnabled(): boolean; getPriority(): number; getFeatures(): string[]; supportsFeature(feature: string): boolean; hasFeature(feature: string): boolean; /** * Calculate exploit indicators for a CVE based on its references * This method should be called during CVE normalization */ protected calculateExploitIndicators(references?: Array<{ url: string; source?: string; tags?: string[]; }>): { hasExploitIndicators: boolean; indicators: { source: string; type: string; url: string; title: string; verified?: boolean; published?: string; }[]; calculatedAt: string; }; } //# sourceMappingURL=base.d.ts.map