@spaik/mcp-server-roi
Version:
MCP server for AI ROI prediction and tracking with Monte Carlo simulations
61 lines • 2.38 kB
TypeScript
/**
* Shared financial calculation utilities
* These functions are used by both the FinancialCalculator and Monte Carlo worker
*/
export interface CashFlowConfig {
initialInvestment: number;
monthlyBenefits: number;
timelineMonths: number;
implementationMonths: number;
rampUpMonths: number;
ongoingMonthlyCosts: number;
}
/**
* Calculate Net Present Value (NPV)
* @param cashFlows Array of cash flows (negative for costs, positive for benefits)
* @param discountRate Monthly discount rate (e.g., 0.1/12 for 10% annual)
*/
export declare function calculateNPV(cashFlows: number[], discountRate: number): number;
/**
* Calculate NPV derivative for IRR calculation
*/
export declare function calculateNPVDerivative(cashFlows: number[], rate: number): number;
/**
* Calculate payback period in months
* Returns the number of months (including fractional part) to recover investment
*/
export declare function calculatePaybackPeriod(cashFlows: number[]): number;
/**
* Generate monthly cash flows from costs and benefits
* Handles implementation period and ramp-up period
*/
export declare function generateCashFlows(config: CashFlowConfig): number[];
/**
* Calculate monthly cash flow for a specific month
* Used by Monte Carlo simulations to generate individual month flows
*/
export declare function calculateMonthlyFlow(month: number, monthlyBenefits: number, implementationMonths: number, rampUpMonths: number, ongoingMonthlyCosts: number): number;
/**
* Calculate break-even date from start date and payback period
*/
export declare function calculateBreakEvenDate(startDate: Date, paybackPeriodMonths: number): Date;
/**
* Calculate automation factor based on potential level
*/
export declare function getAutomationFactor(potential: 'low' | 'medium' | 'high'): number;
/**
* Financial calculation constants
*/
export declare const FINANCIAL_CONSTANTS: {
readonly DEFAULT_DISCOUNT_RATE: number;
readonly DEFAULT_IMPLEMENTATION_MONTHS: 3;
readonly DEFAULT_RAMP_UP_MONTHS: 3;
readonly DEFAULT_HOURLY_RATE: 50;
readonly DEFAULT_DEVELOPER_HOURLY_RATE: 150;
readonly ERROR_COST_MULTIPLIER: 10;
readonly SCALABILITY_PROFIT_MARGIN: 0.2;
readonly DAYS_IN_MONTH: 30;
readonly FIVE_YEAR_MONTHS: 60;
readonly IMPLEMENTATION_COST_PER_USE_CASE: 50000;
};
//# sourceMappingURL=financial-utils.d.ts.map