import fs from 'fs';
import path from 'path';
export function getConfiguredMcpIds(projectDir) {
    const mcpPath = path.join(projectDir, '.mcp.json');
    if (!fs.existsSync(mcpPath))
        return [];
    try {
        const json = JSON.parse(fs.readFileSync(mcpPath, 'utf-8'));
        return Object.keys(json.mcpServers ?? {});
    }
    catch {
        return [];
    }
}
export function validateSquadMcps(squadMcps, configuredMcps) {
    if (!squadMcps || squadMcps.length === 0)
        return;
    const missing = squadMcps.filter(m => !configuredMcps.includes(m));
    if (missing.length > 0) {
        throw new Error(`Squad requires MCPs not configured: ${missing.join(', ')}.\n` +
            `Run: expxagents mcp setup ${missing.join(' ')}`);
    }
}
