Integrates with various AWS services including Cost Explorer, Cost Optimization Hub, Compute Optimizer, Trusted Advisor, and Performance Insights to analyze AWS costs and provide optimization recommendations
Supports integration with Git for version control of the MCP server code and configuration
Hosts the MCP server code repository, allowing users to clone and contribute to the project
Supports Markdown format for report generation, enabling detailed cost optimization reports to be produced in a human-readable format
Uses Python to integrate with AWS services and implement cost optimization analysis capabilities
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CFM Tips - Cost Optimization MCP Serveranalyze my EC2 instances for right-sizing opportunities"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
CFM Tips - Cost Optimization MCP Server
A comprehensive Model Context Protocol (MCP) server for AWS cost analysis and optimization recommendations, designed to work seamlessly with Kiro CLI and other MCP-compatible clients.
✅ Features
Core AWS Services Integration
Cost Explorer - Retrieve cost data and usage metrics
Cost Optimization Hub - Get AWS cost optimization recommendations
Compute Optimizer - Right-sizing recommendations for compute resources
Trusted Advisor - Cost optimization checks and recommendations
Performance Insights - RDS performance metrics and analysis
Cost Optimization Playbooks
🔧 EC2 Right Sizing - Identify underutilized EC2 instances with 12 specialized analysis tools
💾 EBS Optimization - Find unused and underutilized volumes
🗄️ RDS Optimization - Identify idle and underutilized databases
⚡ Lambda Optimization - Find overprovisioned and unused functions
🪣 S3 Optimization - Comprehensive S3 cost analysis and storage class optimization with 11 specialized tools
📋 CloudTrail Optimization - Analyze and optimize CloudTrail configurations
📊 CloudWatch Optimization - Optimize monitoring costs across logs, metrics, alarms, and dashboards
💰 Database Savings Plans - Analyze and optimize database commitment plans for Aurora, RDS, DynamoDB, and more
🌐 NAT Gateway Optimization - Identify underutilized, redundant, and unused NAT Gateways
📈 Comprehensive Analysis - Multi-service cost analysis
Advanced Features
Real CloudWatch Metrics - Uses actual AWS metrics for analysis
Multiple Output Formats - JSON and Markdown report generation
Cost Calculations - Estimated savings and cost breakdowns
Actionable Recommendations - Priority-based optimization suggestions
Related MCP server: CodeAnalysis MCP Server
📁 Project Structure
🔐 Security and Permissions - Least Privileges
Security Best Practices
The CFM Tips MCP server follows AWS security best practices and requires only read-only permissions. Here are the key security principles:
Core Security Principles
Read-Only Access: All operations are read-only - no create, update, or delete permissions
Least Privilege: Grant only the minimum permissions required for cost analysis
No Resource Modification: The tool cannot modify, terminate, or create AWS resources
Audit Trail: All API calls are logged via CloudTrail for security monitoring
Credential Security: Supports multiple secure credential methods (IAM roles, profiles, etc.)
Recommended Security Setup
1. Create Dedicated IAM Role (Recommended)
2. Enable CloudTrail Monitoring
3. Use IAM Profiles (Alternative)
Security Validation
Verify Read-Only Access
Monitor API Usage
Network Security
VPC Endpoint Configuration (Optional) For enhanced security in private networks:
Firewall Rules
Credential Management
Environment Variables (Development)
IAM Role (Production - Recommended)
AWS CLI Profile (Multi-Account)
Service-Specific Security Notes
Cost Optimization Hub
Requires enrollment in AWS Cost Optimization Hub
No additional security considerations beyond IAM permissions
Trusted Advisor
Requires Business or Enterprise support plan
Some checks may require additional permissions
Performance Insights
Must be enabled on RDS instances
Provides database performance metrics (no sensitive data)
S3 Analysis
Only accesses bucket metadata and configuration
Does not read object contents or data
Respects bucket policies and ACLs
Compliance Considerations
Data Privacy
Tool analyzes only AWS service metadata and metrics
No application data or user content is accessed
All analysis is based on AWS service configurations and usage patterns
Audit Requirements
All API calls are logged via CloudTrail
Tool provides detailed logging of all operations
Supports compliance reporting through AWS Config integration
Multi-Account Security
IAM Policy Requirements
The CFM Tips MCP server requires comprehensive read-only permissions across multiple AWS services. Below are the complete IAM policies needed:
Core Cost Optimization Policy
EC2 and Network Optimization Policy
Storage and Database Services Policy
Lambda and CloudWatch Policy
Consolidated Single Policy (Alternative)
For simplified management, you can use this single comprehensive policy:
🛠️ Installation
System Requirements
Minimum Requirements
Operating System: Linux, macOS, or Windows 10/11
Python: 3.11+ recommended for best performance
Network: Outbound HTTPS access to AWS APIs (*.amazonaws.com:443)
Python Dependencies
Quick Start
1. Clone and Setup
2. AWS Configuration
Choose one of the following methods:
Option A: AWS CLI Configuration
Option B: Environment Variables
Option C: IAM Role (for EC2/ECS/Lambda)
3. Apply IAM Permissions
Create and attach the IAM policies from the Security section above to your AWS user or role.
4. Install MCP Configuration
Integration Options
Option 1: Kiro CLI Integration
Option 2: Kiro IDE Integration
Open Kiro IDE or Kiro Developer Plugin
Navigate to Chat → 🛠️ Configure MCP Servers → ➕ Add new MCP
Use the following configuration:
- Scope: Global - Name: cfm-tips - Transport: stdio - Command: python3 - Arguments: /full/path/to/cfm-tips-mcp/mcp_server_with_runbooks.py - Timeout: 60
🔧 Available Tools
Cost Analysis Tools
get_cost_explorer_data- Retrieve AWS cost and usage datalist_coh_enrollment- Check Cost Optimization Hub enrollmentget_coh_recommendations- Get cost optimization recommendationsget_coh_summaries- Get recommendation summariesget_compute_optimizer_recommendations- Get compute optimization recommendations
EC2 Optimization
ec2_rightsizing- Analyze EC2 instances for right-sizing opportunitiesec2_report- Generate detailed EC2 optimization reportsec2_stopped_instances- Identify stopped instances that could be terminatedec2_unattached_eips- Identify unattached Elastic IP addressesec2_old_generation- Identify old generation instances for upgradeec2_detailed_monitoring- Find instances without detailed monitoring enabledec2_graviton_compatible- Identify instances compatible with Graviton processorsec2_burstable_analysis- Analyze burstable instances for credit usage optimizationec2_spot_opportunities- Identify instances suitable for Spot pricingec2_unused_reservations- Identify unused On-Demand Capacity Reservationsec2_scheduling_opportunities- Find instances suitable for scheduling optimizationec2_commitment_plans- Analyze Reserved Instance and Savings Plans opportunitiesec2_governance_violations- Detect governance violations and policy non-complianceec2_comprehensive_report- Generate comprehensive EC2 optimization reports
EBS Optimization
ebs_optimization- Analyze EBS volumes for optimizationebs_unused- Identify unused EBS volumesebs_report- Generate EBS optimization reports
RDS Optimization
rds_optimization- Analyze RDS instances for optimizationrds_idle- Identify idle RDS instancesrds_report- Generate RDS optimization reports
Lambda Optimization
lambda_optimization- Analyze Lambda functions for optimizationlambda_unused- Identify unused Lambda functionslambda_report- Generate Lambda optimization reports
S3 Optimization
s3_general_spend_analysis- Analyze overall S3 spending patterns and usages3_storage_class_selection- Get guidance on choosing cost-effective storage classess3_storage_class_validation- Validate existing data storage class appropriatenesss3_archive_optimization- Identify and optimize long-term archive data storages3_api_cost_minimization- Minimize S3 API request charges through optimizations3_multipart_cleanup- Identify and clean up incomplete multipart uploadss3_governance_check- Implement S3 cost controls and governance compliances3_comprehensive_analysis- Run comprehensive S3 cost optimization analysiss3_comprehensive_optimization_tool- Unified comprehensive S3 optimization with parallel executions3_quick_analysis- Fast 30-second analysis for spending overview and quick winss3_bucket_analysis- Analyze specific S3 buckets for optimization opportunities
CloudTrail Optimization
get_management_trails- Get CloudTrail management trailsrun_cloudtrail_trails_analysis- Run CloudTrail trails analysis for optimizationgenerate_cloudtrail_report- Generate CloudTrail optimization reports
CloudWatch Optimization
cloudwatch_general_spend_analysis- Analyze CloudWatch spending patterns across logs, metrics, alarms, and dashboardscloudwatch_metrics_optimization- Identify custom metrics cost optimization opportunitiescloudwatch_logs_optimization- Optimize log retention and ingestion costscloudwatch_alarms_and_dashboards_optimization- Improve monitoring efficiency and reduce alarm costscloudwatch_comprehensive_optimization_tool- Run comprehensive CloudWatch analysis with intelligent orchestrationquery_cloudwatch_analysis_results- Query stored CloudWatch analysis results using SQLvalidate_cloudwatch_cost_preferences- Validate cost preferences and get functionality coverage estimatesget_cloudwatch_cost_estimate- Get detailed cost estimates for CloudWatch optimization analysis
Database Savings Plans
database_savings_plans_analysis- Comprehensive analysis for Aurora, RDS, DynamoDB, ElastiCache, DocumentDB, Neptune, Keyspaces, Timestream, and DMSdatabase_savings_plans_purchase_analyzer- Model custom commitment scenarios with user-specified hourly amountsdatabase_savings_plans_existing_analysis- Analyze existing Database Savings Plans utilization and coverage
NAT Gateway Optimization
nat_gateway_optimization- Comprehensive NAT Gateway optimization analysis for underutilized, redundant, and unused gatewaysnat_gateway_underutilized- Identify underutilized NAT Gateways based on data transfer metricsnat_gateway_redundant- Find potentially redundant NAT Gateways in the same availability zonenat_gateway_unused- Identify NAT Gateways not referenced by any route tables
Comprehensive Analysis
comprehensive_analysis- Multi-service cost analysis
Additional Tools
get_trusted_advisor_checks- Get Trusted Advisor recommendationsget_performance_insights_metrics- Get RDS Performance Insights data
📊 Example Usage
Basic Cost Analysis
Resource Optimization
CloudWatch and Monitoring Optimization
Database Cost Optimization
Report Generation
Multi-Service Analysis
🔍 Troubleshooting
Installation Issues
Python Version Compatibility
Dependency Installation Failures
Virtual Environment Issues
AWS Configuration Issues
Credentials Not Found
Region Configuration Problems
IAM Permission Errors
Service-Specific Issues
Cost Optimization Hub Not Working
No CloudWatch Metrics Found
S3 Analysis Failures
RDS Performance Insights Errors
MCP Integration Issues
Kiro IDE Connection Problems
Kiro CLI Issues
Performance Issues
Slow Analysis Performance
API Rate Limiting
Common Error Messages
"NoCredentialsError"
"AccessDenied" or "UnauthorizedOperation"
"EndpointConnectionError"
"ServiceNotAvailable" or "OptInRequired"
Getting Additional Help
Enable Debug Logging
Run Diagnostic Tools
Contact Support
Check the RUNBOOKS_GUIDE.md for detailed usage instructions
Review logs in the
logs/directoryRun integration tests:
python3 test_runbooks.pyCreate GitHub issue with error logs and system information
🧩 Add-on MCPs
Add-on AWS Pricing MCP Server MCP server for accessing real-time AWS pricing information and providing cost analysis capabilities https://github.com/awslabs/mcp/tree/main/src/aws-pricing-mcp-server
🎯 Key Benefits
Immediate Cost Savings - Identify unused resources for deletion
Right-Sizing Opportunities - Optimize overprovisioned resources across EC2, RDS, and Lambda
Real Metrics Analysis - Uses actual CloudWatch data for accurate analysis
Actionable Reports - Clear recommendations with cost estimates and priority rankings
Comprehensive Coverage - Analyze EC2, EBS, RDS, Lambda, S3, CloudWatch, NAT Gateways, and more
Advanced EC2 Optimization - 12 specialized tools covering Graviton, Spot, governance, and more
Intelligent S3 Analysis - 11 tools for storage class optimization, lifecycle policies, and cost control
CloudWatch Cost Control - 8 tools for optimizing monitoring, logging, and alerting costs
Database Commitment Optimization - Comprehensive Savings Plans analysis for all database services
Network Cost Optimization - NAT Gateway analysis and redundancy elimination
Easy Integration - Works seamlessly with Kiro CLI and Amazon Q
📈 Expected Results
The CFM Tips cost optimization server can help you:
Identify cost savings on average across all AWS services
Find unused resources costing hundreds of dollars monthly
Right-size overprovisioned instances for optimal performance/cost ratio
Optimize storage costs through volume type and storage class recommendations
Eliminate idle resources that provide no business value
Reduce S3 costs by 30-60% through intelligent storage class transitions
Clean up storage waste from incomplete multipart uploads and orphaned data
Optimize API request patterns to minimize S3 request charges
Reduce CloudWatch costs through log retention optimization and metrics analysis
Optimize monitoring efficiency by identifying unused alarms and dashboards
Maximize Database Savings Plans utilization across Aurora, RDS, DynamoDB, and more
Eliminate network waste by optimizing NAT Gateway usage and removing redundant gateways
Upgrade to modern instances including Graviton processors for better price-performance
Leverage Spot pricing for suitable workloads to reduce costs by up to 90%
Optimize Reserved Instances and Savings Plans commitments for maximum savings
🤝 Contributing
We welcome contributions! Please see our contributing guidelines:
Fork the repository
Create a feature branch
Make your changes
Add tests for new functionality
Submit a pull request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.