defect-inspection-tools-mcp-server
Version:
Defect inspection tools server handling defect detection, analysis, and reporting with AI/ML capabilities for quality control
54 lines (53 loc) • 2.39 kB
TypeScript
import { BaseService, ServiceConfig, ServiceHealthStatus, ServiceResponse } from './base-service.js';
import { AxiosRequestConfig } from 'axios';
export interface ExternalApiConfig extends ServiceConfig {
baseURL?: string;
timeout?: number;
maxRetries?: number;
retryDelay?: number;
defaultHeaders?: Record<string, string>;
rateLimitPerSecond?: number;
}
export interface RequestOptions {
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
url: string;
data?: any;
params?: Record<string, any>;
headers?: Record<string, string>;
timeout?: number;
sanitizeRequest?: boolean;
sanitizeResponse?: boolean;
}
export interface ApiResponse<T = any> {
data: T;
status: number;
statusText: string;
headers: Record<string, string>;
config: AxiosRequestConfig;
}
export declare class ExternalApiService extends BaseService {
private client;
protected config: Required<ServiceConfig> & ExternalApiConfig;
private requestQueue;
private isProcessingQueue;
constructor(serviceName: string, config: ExternalApiConfig);
private setupInterceptors;
healthCheck(): Promise<ServiceHealthStatus>;
makeRequest<T = any>(options: RequestOptions): Promise<ServiceResponse<ApiResponse<T>>>;
get<T = any>(url: string, params?: Record<string, any>, options?: Omit<RequestOptions, 'method' | 'url' | 'params'>): Promise<ServiceResponse<ApiResponse<T>>>;
post<T = any>(url: string, data?: any, options?: Omit<RequestOptions, 'method' | 'url' | 'data'>): Promise<ServiceResponse<ApiResponse<T>>>;
put<T = any>(url: string, data?: any, options?: Omit<RequestOptions, 'method' | 'url' | 'data'>): Promise<ServiceResponse<ApiResponse<T>>>;
delete<T = any>(url: string, options?: Omit<RequestOptions, 'method' | 'url'>): Promise<ServiceResponse<ApiResponse<T>>>;
patch<T = any>(url: string, data?: any, options?: Omit<RequestOptions, 'method' | 'url' | 'data'>): Promise<ServiceResponse<ApiResponse<T>>>;
private enforceRateLimit;
private processQueue;
updateConfig(newConfig: Partial<ExternalApiConfig>): void;
setAuthHeader(token: string, type?: 'Bearer' | 'Basic' | 'ApiKey'): void;
removeAuthHeader(): void;
getConfig(): Required<ServiceConfig>;
getQueueStatus(): {
queueLength: number;
isProcessing: boolean;
};
clearQueue(): void;
}