Predict and track AI ROI using Monte Carlo simulations, real-time industry benchmarks, and ML-powered insights.
A Model Context Protocol (MCP) server for AI ROI prediction and tracking with Monte Carlo simulations, real-time industry benchmarks, and ML-powered insights. Now with mandatory Dutch market validation and natural language support!
npm install @spaik/mcp-server-roi
git clone https://github.com/SPAIK-io/mcp-server-roi.git
cd mcp-server-roi
npm install
npm run build
Instead of complex JSON, just describe what you need:
// Using natural language
await predictROI({
natural_language_input: "Help ACME Corp automate their customer service. They're in retail, handle 5000 emails monthly taking 15 minutes each. Budget is around $100k and we need this done in 6 months."
});
// Or use the simplified format
await predictROI({
client: "ACME Corp",
project: "Customer Service Automation",
industry: "retail",
budget: "$100k",
timeline: "6 months"
});
// Get examples for any tool
await getExamples({ tool_name: "predict_roi" });
// Get interactive help
await help({ query: "How do I calculate ROI for a healthcare project?" });
Create a .env
file based on .env.example
:
cp .env.example .env
# Required - Supabase Configuration
SUPABASE_URL=https://xxxxxxxxxxxxx.supabase.co
SUPABASE_ANON_KEY=your_supabase_anon_key
# Required for full functionality
SUPABASE_SERVICE_KEY=your_service_key # Admin access
PERPLEXITY_API_KEY=your_perplexity_key # Real-time benchmarks
# Optional - Enhanced Features
FMP_API_KEY=your_fmp_key # Financial market data
LOG_LEVEL=info # debug|info|warn|error
WORKER_POOL_SIZE=4 # CPU cores
MAX_SIMULATION_ITERATIONS=100000 # Monte Carlo precision
Run these SQL scripts in your Supabase SQL editor (in order):
database/schema.sql
- Core tables and indexesdatabase/001_security_update.sql
- Security and RLS policiesdatabase/002_transactional_functions.sql
- Transaction functionsDatabase Setup (Required):
# Apply required database functions
# See database/APPLY_FUNCTIONS.md for detailed instructions
# Option 1: Via Supabase Dashboard
# Copy contents of database/002_transactional_functions.sql
# Paste into SQL Editor and run
# Option 2: Using npm script (requires service key)
npm run apply-db-functions
Claude Desktop Configuration:
Add to your configuration file (~/Library/Application Support/Claude/claude_desktop_config.json
):
{
"mcpServers": {
"roi": {
"command": "node",
"args": ["/absolute/path/to/mcp-server-roi/dist/index.js"],
"env": {
"SUPABASE_URL": "your_supabase_url",
"SUPABASE_ANON_KEY": "your_anon_key",
"SUPABASE_SERVICE_KEY": "your_service_key",
"PERPLEXITY_API_KEY": "your_perplexity_key",
"LOG_LEVEL": "info"
}
}
}
}
Generate comprehensive ROI predictions with Monte Carlo simulations.
π Natural Language Example:
"Help ACME Bank reduce fraud losses. They process 1M transactions monthly with 0.5% fraud rate and $500 average loss. Need real-time detection system. Budget is $200k plus training."
Simplified JSON Example:
{
"client": "ACME Bank",
"project": "Fraud Detection System",
"industry": "finance", // or "financial_services"
"budget": "$200k",
"timeline": "6 months"
}
Traditional Example (still supported):
"Create an ROI prediction for ACME Corp's fraud detection system:
- Industry: Financial Services
- Use Case: Transaction monitoring
- Current: 1M transactions/month, 0.5% fraud rate, $500 avg loss
- Future: 95% detection rate, real-time processing
- Implementation: $200k software, 1000 dev hours, $50k training
- Timeline: 6 months"
Key Parameters:
organization_id
: Organization identifierproject
: Project details with industry classificationuse_cases
: Array of current β future state transformationsimplementation_costs
: Comprehensive cost breakdowntimeline_months
: 1-120 monthsenable_benchmarks
: Use real-time industry dataCompare multiple projects with ML-powered insights and visualizations.
π Natural Language Example:
"Compare customer service automation vs inventory optimization vs predictive maintenance projects for ACME Corp"
Simplified Example:
{
"projects": ["Customer Service Bot", "Smart Inventory", "Machine Monitoring"],
"focus": "roi and risk"
}
Traditional Example:
"Compare these three AI projects:
- Project A: Customer service automation (ID: xxx)
- Project B: Inventory optimization (ID: yyy)
- Project C: Predictive maintenance (ID: zzz)
Include risk analysis and synergy opportunities"
Key Parameters:
project_ids
or project_names
: Projects to comparecomparison_metrics
: ['roi', 'npv', 'payback_period', 'risk_score']enable_ml_insights
: ML predictions and pattern matchingnatural_language_input
: Describe what to compareGet relevant usage examples for any tool.
Usage:
{
"tool_name": "predict_roi",
"category": "healthcare" // optional
}
Get interactive help and tool recommendations.
Usage:
{
"query": "How do I calculate ROI for a hospital automation project?"
}
Pre-configured benchmarks and calculations for:
When Perplexity API key is provided:
This MCP server has been specifically optimized for use with LLMs and AI agents, featuring:
All tools return multi-layered responses with progressive disclosure:
{
"executive_summary": { /* High-level insights */ },
"insights": { /* Detailed analysis */ },
"recommendations": { /* Actionable next steps */ },
"narrative": { /* Natural language explanation */ },
"metadata": { /* Context and confidence */ }
}
The server implements three internal optimization agents:
Progressive Information Retrieval
# Start with executive summary
response.executive_summary
# Drill down as needed
if needs_details:
response.insights.primary
response.financial_metrics.expected
Conversation Memory
Format Preferences
{
"preferred_format": "executive_only", // For quick summaries
"detail_level": "comprehensive", // For full analysis
"include_visuals": true, // For chart-ready data
"max_response_tokens": 1000 // For token limits
}
Error Handling
// predict_roi response optimized for LLMs
{
summary: {
expected_roi: 8500, // Key metric upfront
confidence: "high", // Natural language
recommendation: "PROCEED" // Clear action
},
narrative: {
executive_briefing: "This AI investment will deliver 8,500% ROI...",
key_insights: ["Automation will save 10,000 hours monthly", ...],
risk_assessment: "Low risk with proven technology"
},
details: { /* Full calculations available if needed */ }
}
# Install dependencies
npm install
# Run in development mode
npm run dev
# Build for production
npm run build
# Run comprehensive tests
npm test
# Type checking
npm run typecheck
# Linting
npm run lint
The project includes comprehensive test coverage:
# Run all tests
npm test
# Test database connection
npx tsx test-db-connection.ts
# Run comprehensive integration tests
npx tsx test-comprehensive.ts
"Permission denied for table projects"
SUPABASE_SERVICE_KEY
is set in environment"Perplexity API error"
"Transaction timeout"
DEFAULT_TRANSACTION_TIMEOUT
in .envβββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Claude Desktop ββββββΆβ MCP Server ββββββΆβ Supabase β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β
βΌ βΌ
ββββββββββββββββ ββββββββββββββββ
β Worker Pool β β PostgreSQL β
β(Monte Carlo) β ββββββββββββββββ
ββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββ
β External APIs β
ββββββββββββββββββββββββββββββββ€
β β’ Perplexity Sonar β
β β’ Financial Modeling Prep β
ββββββββββββββββββββββββββββββββ
MIT Β© SPAIK
/examples
directory for usage patternsContributions are welcome! Please:
get_examples
and help
Excel manipulation including data reading/writing, worksheet management, formatting, charts, and pivot table
Access and manage Obsidian notes stored in iCloud Drive.
A wrapper for OpenAI's built-in tools, enabling functionalities like web search and code execution. Requires an OpenAI API key.
Interact with Canvas LMS and Gradescope using AI agents.
Mercado Pago's official MCP server, offering tools to interact with our API, simplifying tasks and product integration.
Create, read, edit, and convert Excel files without requiring Microsoft Office.
A server for date-time manipulation and timezone conversion.
Provides secure access to Atlassian Confluence content and spaces using its REST API.
A knowledge management server for stdlib and specs documents, with a configurable storage path.
Integrate with Smartsheet for project management and data analytics, requiring an API access token.