Skip to main content
Glama
josuekongolo

CompanyIQ MCP Server

by josuekongolo
risk_analyzer.ts2.67 kB
export interface RiskAssessment { overallScore: number; bankruptcyRisk: number; factors: string[]; recommendation: string; } export class RiskAnalyzer { assessBankruptcyRisk(company: any, financialHistory: any[]): RiskAssessment { let riskScore = 50; // Base const factors: string[] = []; // Check bankruptcy/liquidation status if (company.bankrupt) { riskScore = 100; factors.push('⚠️ Company is currently bankrupt'); return { overallScore: riskScore, bankruptcyRisk: riskScore, factors, recommendation: 'AVOID' }; } if (company.under_liquidation) { riskScore += 30; factors.push('⚠️ Company under liquidation'); } // Check financial trends if (financialHistory.length >= 2) { const latest = financialHistory[0]; const previous = financialHistory[1]; // Declining revenue if (latest.revenue < previous.revenue) { const decline = ((previous.revenue - latest.revenue) / previous.revenue) * 100; if (decline > 20) { riskScore += 15; factors.push(`📉 Revenue declined ${decline.toFixed(0)}%`); } } // Negative profit if (latest.profit && latest.profit < 0) { riskScore += 10; factors.push('💸 Operating at a loss'); } // Low equity if (latest.equity && latest.assets && (latest.equity / latest.assets) < 0.2) { riskScore += 15; factors.push('⚖️ Low equity ratio (<20%)'); } } // Employee reduction if (financialHistory.length >= 2) { const employeeChange = financialHistory[0].employees - financialHistory[1].employees; if (employeeChange < -5) { riskScore += 10; factors.push(`👥 Reduced workforce by ${Math.abs(employeeChange)} employees`); } } // No recent updates if (company.fetched_at) { const daysSinceUpdate = Math.floor( (Date.now() - new Date(company.fetched_at).getTime()) / (1000 * 60 * 60 * 24) ); if (daysSinceUpdate > 180) { riskScore += 5; factors.push('📅 Outdated company data'); } } riskScore = Math.min(100, Math.max(0, riskScore)); let recommendation: string; if (riskScore >= 70) recommendation = 'HIGH RISK - Avoid'; else if (riskScore >= 40) recommendation = 'MODERATE RISK - Proceed with caution'; else recommendation = 'LOW RISK - Stable'; if (factors.length === 0) { factors.push('✅ No significant risk factors identified'); } return { overallScore: riskScore, bankruptcyRisk: riskScore, factors, recommendation }; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/josuekongolo/companyiq-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server