home / mcp / cfm tips - cost optimization mcp server
Provides AWS cost analysis and optimization recommendations via MCP, integrating Cost Explorer, Optimize Hub, Compute Optimizer, and more.
Configuration
View docs{
"mcpServers": {
"aws-samples-sample-cfm-tips-mcp": {
"command": "python3",
"args": [
"/full/path/to/cfm-tips-mcp/mcp_server_with_runbooks.py"
]
}
}
}You can deploy and run the CFM Tips Cost Optimization MCP Server to analyze AWS usage, surface cost-saving opportunities, and deliver actionable recommendations through MCP-compatible clients. This server integrates with multiple AWS services to provide right-sizing insights, optimization suggestions, and comprehensive cost analyses across EC2, EBS, S3, RDS, Lambda, NAT Gateways, and more, all powered by real CloudWatch data and structured outputs for easy consumption.
You will connect a compatible MCP client to the CFM Tips MCP Server to perform cost analysis and optimization. Start the MCP server through a local process, then point your client to the server via a standard input/output interface. Use the client to issue queries such as asking for cost optimization recommendations, requesting EC2 right-sizing opportunities, or generating a comprehensive optimization report. The server exposes tools that retrieve AWS Cost Explorer data, compute optimization recommendations, and multi-service analyses, enabling you to derive immediate cost savings and actionable guidance.
Prerequisites you need before starting: Python 3.11 or newer, and outbound HTTPS access to AWS APIs.
Step 1: Clone the project repository.
git clone https://github.com/aws-samples/sample-cfm-tips-mcp.git
cd sample-cfm-tips-mcpStep 2: Install Python dependencies.
pip install -r requirements.txtStep 3: Configure AWS access. Choose one method below.
# Option A: AWS CLI configuration
aws configure
# Option B: Environment variables
export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_DEFAULT_REGION=us-east-1
# Option C: IAM role (if running on AWS compute with IAM role)
# No additional configuration neededStep 4: Apply IAM permissions per security guidance from the cost optimization server setup.
Step 5: Install MCP configuration to enable the server with runbooks.
python3 setup.pyStep 6: Run the MCP server. The server is intended to be launched as a local process and consumed by MCP clients.
If you are integrating with Kiro CLI or Kiro IDE, follow the integration steps to register the MCP server and start issuing queries.
Integration with Kiro CLI allows you to chat with the MCP server and issue natural language queries that are translated into cost optimization analyses.
The server supports real CloudWatch metrics, multiple output formats, and actionable recommendations with estimated savings.
Security considerations emphasize read-only access with least privilege, auditable API calls, and credential management through IAM roles or profiles.
For diagnostics and troubleshooting, you can enable debug logging, run diagnostic utilities, and review logs in the logs directory.
Retrieve cost and usage data from AWS Cost Explorer to support cost analysis.
Check Cost Optimization Hub enrollment status for the account.
Fetch cost optimization recommendations from the Cost Optimization Hub.
Obtain summaries of optimization recommendations.
Get EC2, EBS, Lambda, and related compute optimization recommendations.
Analyze EC2 instances for right-sizing opportunities.
Generate detailed EC2 optimization reports.
Identify stopped EC2 instances that could be terminated to save costs.
Identify unattached Elastic IP addresses to reduce idle charges.
Identify older generation instances for potential upgrade.
Find instances missing detailed monitoring for cost-aware decisions.
Identify instances compatible with Graviton processors for potential migration.
Analyze burstable instances for CPU credit optimization.
Identify EC2 instances suitable for Spot pricing to save costs.
Identify unused On-Demand Capacity Reservations.
Find instances that can be scheduled to reduce costs.
Analyze Reserved Instances and Savings Plans opportunities.
Detect governance violations related to EC2 usage.
Generate a comprehensive EC2 optimization report.
Analyze EBS volumes for optimization opportunities.
Identify unused EBS volumes.
Generate EBS optimization reports.
Analyze RDS instances for optimization.
Identify idle RDS instances.
Generate RDS optimization reports.
Analyze Lambda functions for optimization opportunities.
Identify unused Lambda functions.
Generate Lambda optimization reports.
Analyze overall S3 spending patterns.
Provide guidance on selecting cost-effective storage classes.
Validate current data storage classes for cost efficiency.
Identify and optimize long-term archive storage.
Minimize S3 API request costs through optimization.
Identify and clean up incomplete multipart uploads.
Implement S3 cost controls and governance compliance.
Run comprehensive S3 cost optimization analysis.
Unified comprehensive S3 optimization with parallel execution.
Fast 30-second analysis for spending overview.
Analyze specific S3 buckets for optimization opportunities.
Get CloudTrail management trails.
Run CloudTrail trails analysis for optimization.
Generate CloudTrail optimization reports.
Analyze CloudWatch spending across logs, metrics, alarms, and dashboards.
Identify cost optimization opportunities for custom metrics.
Optimize log retention and ingestion costs.
Improve monitoring efficiency and reduce alarm costs.
Run comprehensive CloudWatch analysis with orchestration.
Query stored CloudWatch analysis results using SQL.
Validate cost preferences and coverage estimates.
Get detailed cost estimates for CloudWatch optimization.
Comprehensive analysis for Savings Plans across database services.
Model custom database Savings Plans scenarios.
Analyze existing Savings Plans utilization.
Comprehensive NAT Gateway optimization.
Identify underutilized NAT Gateways.
Find potentially redundant NAT Gateways.
Identify NAT Gateways not referenced by route tables.
Multi-service cost analysis.
Get Trusted Advisor recommendations.
Get RDS Performance Insights data.