Integrates with Perplexity Sonar API to fetch real-time industry benchmarks, ROI ranges, implementation timelines, success rates, and technology adoption trends for AI project predictions.
Uses Supabase as the backend database for storing ROI predictions, project comparisons, transaction management, and maintaining conversation history with RLS policies.
@spaik/mcp-server-roi
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!
π What's New in v1.3.1
Bug Fixes
Fixed critical "Cannot read properties of undefined (reading 'industry')" error
Enhanced input validation for all tools
Improved error messages for better user experience
What's New in v1.3.0
Breaking Changes
Removed quick-assessment tool: Replaced by enhanced predict_roi with Dutch validation
PERPLEXITY_API_KEY now required: Mandatory for Dutch market validation
New Features
Dutch Market Validation: All predictions validated against Dutch industry averages
Automatic Value Adjustment: Unrealistic values (>3x industry average) are intelligently adjusted
Market-Specific Insights: Dutch trends and patterns incorporated in analysis
Enhanced Confidence Scoring: Based on alignment with Dutch market data
From v1.2.0
Natural Language Input: Use conversational text instead of complex JSON
Smart Defaults: 80% reduction in required fields
Flexible Formats: Accept "$50k", "85%", "6 months" formats
Key Features
π― Core Capabilities
ROI Predictions: Generate detailed 5-year financial projections with Dutch market validation
Monte Carlo Simulations: Advanced risk analysis with multiple distribution models
Multi-Project Comparison: Compare up to 10 projects with ML-powered insights
Dutch Market Validation: Mandatory validation against Dutch industry benchmarks
Industry Benchmarks: Real-time data via Perplexity API integration
π€ AI & ML Features
Universal NLP: All tools support natural language input
Intent Detection: Automatically routes to the correct tool
Context Awareness: Maintains conversation history
ML Comparison Engine: Pattern recognition and success prediction
Voice Output: Accessibility-friendly summaries
Synergy Detection: Identify value-add opportunities between projects
Risk Scoring: Multi-factor risk assessment with confidence levels
πΌ Financial Metrics
NPV (Net Present Value) with customizable discount rates
IRR (Internal Rate of Return) using Newton's method
Payback Period with linear interpolation
Break-even Analysis with monthly precision
Cash Flow Projections with ramp-up modeling
π Production Features
Transaction Management: Atomic operations with rollback
Retry Logic: Exponential backoff for resilience
Real-time Benchmarks: Perplexity Sonar API integration
Graceful Degradation: Fallback to static data when APIs unavailable
Comprehensive Logging: Structured logs with context
Installation
From npm
From source
Quick Start
Simple Natural Language Example
Instead of complex JSON, just describe what you need:
Get Help Anytime
Configuration
1. Environment Setup
Create a .env file based on .env.example:
2. Required Environment Variables
3. Database Setup
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 functions
Usage with Claude Desktop
Database 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-functionsClaude 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" } } } }
Available Tools
1. predict_roi
Generate comprehensive ROI predictions with Monte Carlo simulations.
π Natural Language Example:
Simplified JSON Example:
Traditional Example (still supported):
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 data
2. compare_projects
Compare multiple projects with ML-powered insights and visualizations.
π Natural Language Example:
Simplified Example:
Traditional Example:
Key Parameters:
project_idsorproject_names: Projects to comparecomparison_metrics: ['roi', 'npv', 'payback_period', 'risk_score']enable_ml_insights: ML predictions and pattern matchingnatural_language_input: Describe what to compare
3. get_examples (π)
Get relevant usage examples for any tool.
Usage:
4. help (π)
Get interactive help and tool recommendations.
Usage:
Industry Support
Pre-configured benchmarks and calculations for:
π¦ Financial Services (fraud detection, compliance, trading)
π₯ Healthcare (patient records, diagnostics, scheduling)
ποΈ Retail (inventory, customer service, personalization)
π Manufacturing (predictive maintenance, quality control)
π» Technology (DevOps, security, analytics)
π Education (grading, admissions, tutoring)
ποΈ Government (document processing, citizen services)
Advanced Features
Real-time Benchmarks
When Perplexity API key is provided:
Current industry ROI ranges
Implementation timelines
Success rates by company size
Technology adoption trends
ML-Powered Insights
Success probability prediction (0-100%)
Risk factor identification
Synergy opportunities between projects
Industry-specific pattern matching
Natural Language Processing
Parse requirements from conversational input
Extract metrics and volumes automatically
Generate structured use cases
Support for voice-friendly outputs
LLM Usage Guide
Optimized for AI Agents
This MCP server has been specifically optimized for use with LLMs and AI agents, featuring:
1. Semantic-Rich Responses
All tools return multi-layered responses with progressive disclosure:
2. Natural Language Elements
Pre-generated summaries and explanations
Voice-ready output for accessibility
Conversational tone options
Context-aware recommendations
3. Token Optimization
Hierarchical data structure for selective parsing
Summary-first approach reduces token usage
Optional detail levels based on agent needs
Efficient JSON structure with clear semantics
4. Multi-Agent Coordination
The server implements three internal optimization agents:
Context Optimizer: Transforms raw data into semantic layers
Intelligence Amplifier: Adds ML insights and predictions
Experience Harmonizer: Adapts output format for optimal consumption
Best Practices for LLM Integration
Progressive Information Retrieval
# Start with executive summary response.executive_summary # Drill down as needed if needs_details: response.insights.primary response.financial_metrics.expectedConversation Memory
Tools maintain context across calls
Reference previous analyses for consistency
Build on prior insights
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
All errors include actionable guidance
Graceful degradation with fallbacks
Clear validation messages for corrections
Response Structure Example
Performance Benchmarks
Tool Execution: 1-3 seconds average
Perplexity API: ~15 seconds for complex queries
Database Operations: < 500ms
Monte Carlo (100k iterations): < 5 seconds
ML Predictions: < 1 second
LLM Response Generation: < 100ms
Development
Testing
The project includes comprehensive test coverage:
Security Considerations
Database Access: Uses Supabase service key for admin operations
Input Validation: All inputs validated with Zod schemas
Error Handling: Sensitive information sanitized in error messages
API Keys: Store securely, never commit to repository
Troubleshooting
Common Issues
"Permission denied for table projects"
Ensure
SUPABASE_SERVICE_KEYis set in environmentCheck RLS policies in Supabase dashboard
"Perplexity API error"
Verify API key is valid
Check API rate limits
System falls back to static benchmarks automatically
"Transaction timeout"
Increase
DEFAULT_TRANSACTION_TIMEOUTin .envReduce number of use cases per request
Architecture
License
MIT Β© SPAIK
Support
Issues: https://github.com/SPAIK-io/mcp-server-roi/issues
Documentation: See CLAUDE.md for detailed development guide
Examples: Check
/examplesdirectory for usage patterns
Contributing
Contributions are welcome! Please:
Fork the repository
Create a feature branch
Add tests for new functionality
Ensure all tests pass
Submit a pull request
Changelog
v1.3.0 (2025-07-03)
Breaking: Removed quick-assessment tool
Breaking: PERPLEXITY_API_KEY now required
π Mandatory Dutch market validation for all predictions
π Automatic adjustment of unrealistic values
π Market-specific insights based on Dutch trends
π Enhanced confidence scoring aligned with market data
v1.2.0 (2025-07-01)
π Universal natural language support for all tools
π Smart defaults reduce required fields by 80%
π Flexible input formats ("$50k", "85%", "6 months")
π User-friendly error messages with suggestions
π New utility tools:
get_examplesandhelpπ Intent detection automatically routes to correct tool
π Context awareness for conversation history
π Self-documenting tools with embedded examples
π LLM-optimized response structure
π Comprehensive prompt engineering guide
v1.1.1 (2025-06-30)
Bug fixes and performance improvements
v1.0.0 (2025-06-24)
Initial release with full MCP implementation
Real-time benchmark integration
ML-powered project comparison
Natural language input support
Comprehensive transaction management