UNPKG

defect-inspection-tools-mcp-server

Version:

Defect inspection tools server handling defect detection, analysis, and reporting with AI/ML capabilities for quality control

135 lines (134 loc) 3.24 kB
import { TextContent, ImageContent, EmbeddedResource } from "@modelcontextprotocol/sdk/types.js"; import { ObjectId } from "mongodb"; export interface ToolArguments { session_id?: string; user_id?: string; image_url?: string; image_path?: string; analysis_type?: string; confidence_threshold?: number; defect_type?: string; severity_level?: string; inspection_id?: string; product_id?: string; batch_id?: string; query?: string; limit?: number; skip?: number; offset?: number; filters?: Record<string, any>; sort_by?: string; sort_order?: string; search_type?: string; start_date?: string; end_date?: string; startDate?: string; endDate?: string; collection?: string; projection?: Record<string, any>; imo?: number; imo_number?: number; vessel_name?: string; vesselName?: string; stage?: string; inspection_type?: string; inspectionType?: string; report_type?: string; reportType?: string; status?: string; currentStatus?: string; table_name?: string; fleet_name?: string; operation?: string; case_id?: string; casefileId?: string; casefile_id?: string; data?: string; document_url?: string; per_page?: number; casefileName?: string; casefileSummary?: string; importance?: number; category?: string; role?: string; emailAddress?: string; email?: string; description?: string; inspections?: any[]; [key: string]: any; } export interface DefectInfo { id: string; type: string; severity: string; confidence: number; location: { x: number; y: number; width: number; height: number; }; description: string; timestamp: Date; } export interface InspectionResult { inspectionId: string; productId: string; batchId?: string; timestamp: Date; overallScore: number; defects: DefectInfo[]; status: "PASS" | "FAIL" | "REVIEW"; imageUrl?: string; } export interface QualityReport { reportId: string; productId: string; batchId?: string; inspectionResults: InspectionResult[]; summary: { totalInspections: number; passRate: number; failRate: number; commonDefects: string[]; }; generatedAt: Date; } export type ToolResponse = Array<TextContent | ImageContent | EmbeddedResource>; export interface ServerConfig { serverName: string; serverVersion: string; capabilities: { resources: { read: boolean; list: boolean; templates: boolean; }; tools: { list: boolean; call: boolean; }; prompts: { list: boolean; get: boolean; }; }; } export interface DefectDocument { _id?: ObjectId; inspectionId: string; productId: string; batchId?: string; defects: DefectInfo[]; overallScore: number; status: "PASS" | "FAIL" | "REVIEW"; imageUrl?: string; createdAt: Date; updatedAt: Date; } export interface Config { mongoUri: string; mongoDbName: string; openaiApiKey: string; baseUrl?: string; }