UNPKG

@pedrocid/music-mcp

Version:

MCP server for controlling Apple Music on macOS (v1.0.5)

38 lines (37 loc) 1.63 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getConfig = getConfig; exports.validateConfig = validateConfig; const os_1 = __importDefault(require("os")); function getConfig() { return { logFile: process.env.MUSIC_MCP_LOG_FILE || `${os_1.default.homedir()}/Library/Logs/music-mcp.log`, logLevel: (process.env.MUSIC_MCP_LOG_LEVEL || 'info').toLowerCase(), consoleLogging: process.env.MUSIC_MCP_CONSOLE_LOGGING === 'true', cacheTtl: parseInt(process.env.MUSIC_MCP_CACHE_TTL || '300', 10), maxSearchResults: parseInt(process.env.MUSIC_MCP_MAX_SEARCH_RESULTS || '50', 10), timeoutSeconds: parseInt(process.env.MUSIC_MCP_TIMEOUT_SECONDS || '30', 10), artworkExport: process.env.MUSIC_MCP_ARTWORK_EXPORT !== 'false', lenientParsing: process.env.MUSIC_MCP_LENIENT_PARSING !== 'false' }; } function validateConfig() { const issues = []; const config = getConfig(); if (config.cacheTtl < 0) { issues.push('MUSIC_MCP_CACHE_TTL must be non-negative'); } if (config.maxSearchResults < 1) { issues.push('MUSIC_MCP_MAX_SEARCH_RESULTS must be positive'); } if (config.timeoutSeconds < 1) { issues.push('MUSIC_MCP_TIMEOUT_SECONDS must be positive'); } if (!['debug', 'info', 'warn', 'error'].includes(config.logLevel)) { issues.push('MUSIC_MCP_LOG_LEVEL must be one of: debug, info, warn, error'); } return issues; }