UNPKG

defect-inspection-tools-mcp-server

Version:

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

67 lines 3.13 kB
import dotenv from 'dotenv'; import path from 'path'; // Load environment variables from .env file dotenv.config({ path: path.resolve(process.cwd(), '.env') }); function parseArgs() { const args = process.argv.slice(2); const config = {}; for (let i = 0; i < args.length; i++) { const arg = args[i]; if (arg === '--mongo-uri' && i + 1 < args.length) { config.mongoUri = args[++i]; } else if (arg === '--db-name' && i + 1 < args.length) { config.dbName = args[++i]; } else if (arg === '--mongodb-uri-syia-etl' && i + 1 < args.length) { config.secondaryMongoUri = args[++i]; } else if (arg === '--db-name-syia-etl' && i + 1 < args.length) { config.secondaryDbName = args[++i]; } else if (arg === '--openai-api-key' && i + 1 < args.length) { config.openaiApiKey = args[++i]; } else if (arg === '--api-port' && i + 1 < args.length) { config.apiPort = args[++i]; } else if (arg === '--log-level' && i + 1 < args.length) { config.logLevel = args[++i]; } else if (arg === '--typesense-host' && i + 1 < args.length) { config.typesenseHost = args[++i]; } else if (arg === '--typesense-port' && i + 1 < args.length) { config.typesensePort = args[++i]; } else if (arg === '--typesense-protocol' && i + 1 < args.length) { config.typesenseProtocol = args[++i]; } else if (arg === '--typesense-api-key' && i + 1 < args.length) { config.typesenseApiKey = args[++i]; } else if (arg === '--cohere-api-key' && i + 1 < args.length) { config.cohereApiKey = args[++i]; } else if (arg === '--perplexity-api-key' && i + 1 < args.length) { config.perplexityApiKey = args[++i]; } } return { mongoUri: config.mongoUri || process.env.MONGO_URI || 'mongodb://localhost:27017', dbName: config.dbName || process.env.DB_NAME || 'defect_inspection_tools', secondaryMongoUri: config.secondaryMongoUri || process.env.SECONDARY_MONGO_URI || '', secondaryDbName: config.secondaryDbName || process.env.SECONDARY_DB_NAME || '', openaiApiKey: config.openaiApiKey || process.env.OPENAI_API_KEY || '', apiPort: config.apiPort || process.env.API_PORT || '3000', logLevel: config.logLevel || process.env.LOG_LEVEL || 'info', typesenseHost: config.typesenseHost || process.env.TYPESENSE_HOST || '', typesensePort: config.typesensePort || process.env.TYPESENSE_PORT || '8108', typesenseProtocol: config.typesenseProtocol || process.env.TYPESENSE_PROTOCOL || 'http', typesenseApiKey: config.typesenseApiKey || process.env.TYPESENSE_API_KEY || '', cohereApiKey: config.cohereApiKey || process.env.COHERE_API_KEY || '', perplexityApiKey: config.perplexityApiKey || process.env.PERPLEXITY_API_KEY || '' }; } export const config = parseArgs(); //# sourceMappingURL=config.js.map