UNPKG

minimax-mcp-tools

Version:

Async MCP server with Minimax API integration for image generation and text-to-speech

69 lines 1.91 kB
import { MinimaxConfigError } from '../utils/error-handler.js'; export class ConfigManager { static instance = null; config; constructor() { if (ConfigManager.instance) { return ConfigManager.instance; } this.config = this.loadConfig(); ConfigManager.instance = this; } static getInstance() { if (!ConfigManager.instance) { ConfigManager.instance = new ConfigManager(); } return ConfigManager.instance; } loadConfig() { return { apiKey: this.getRequiredEnv('MINIMAX_API_KEY'), apiHost: 'https://api.minimaxi.com', logLevel: 'error', tempDir: '/tmp', maxConcurrency: 5, retryAttempts: 3, retryDelay: 1000 }; } getRequiredEnv(key) { const value = process.env[key]; if (!value) { throw new MinimaxConfigError(`Required environment variable ${key} is not set`); } return value; } get(key) { return this.config[key]; } getApiKey() { return this.config.apiKey; } getApiHost() { return this.config.apiHost; } getTempDir() { return this.config.tempDir; } getMaxConcurrency() { return this.config.maxConcurrency; } getRetryConfig() { return { attempts: this.config.retryAttempts, delay: this.config.retryDelay }; } isDebugMode() { return this.config.logLevel === 'debug'; } validate() { const required = ['apiKey']; const missing = required.filter(key => !this.config[key]); if (missing.length > 0) { throw new MinimaxConfigError(`Missing required configuration: ${missing.join(', ')}`); } return true; } } //# sourceMappingURL=config-manager.js.map