UNPKG

midjourney-mcp

Version:

A Model Context Protocol server for Midjourney integration via MJ API

36 lines 1.02 kB
/** * Configuration management for Midjourney MCP Server */ /** * Validates and returns the configuration */ export function validateConfig() { const apiKey = process.env['MJ_API_KEY']; if (!apiKey) { throw new Error("MJ_API_KEY environment variable is required. " + "Please set it to your MJ API key (sk-xxx format)."); } if (!apiKey.startsWith('sk-')) { throw new Error("Invalid MJ_API_KEY format. " + "API key should start with 'sk-'."); } return { apiKey, baseUrl: process.env['MJ_BASE_URL'] || "https://aiclound.vip", timeout: parseInt(process.env['MJ_TIMEOUT'] || "30000", 10), maxRetries: parseInt(process.env['MJ_MAX_RETRIES'] || "3", 10), }; } /** * Gets the configuration with defaults */ export function getConfig() { try { return validateConfig(); } catch (error) { console.error("Configuration error:", error); throw error; } } //# sourceMappingURL=config.js.map