home / mcp / cfm tips - cost optimization mcp server

CFM Tips - Cost Optimization MCP Server

Provides AWS cost analysis and optimization recommendations via MCP, integrating Cost Explorer, Optimize Hub, Compute Optimizer, and more.

Installation
Add the following to your MCP client configuration file.

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.

How to use

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.

How to install

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-mcp

Step 2: Install Python dependencies.

pip install -r requirements.txt

Step 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 needed

Step 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.py

Step 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.

Additional notes

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.

Available tools

get_cost_explorer_data

Retrieve cost and usage data from AWS Cost Explorer to support cost analysis.

list_coh_enrollment

Check Cost Optimization Hub enrollment status for the account.

get_coh_recommendations

Fetch cost optimization recommendations from the Cost Optimization Hub.

get_coh_summaries

Obtain summaries of optimization recommendations.

get_compute_optimizer_recommendations

Get EC2, EBS, Lambda, and related compute optimization recommendations.

ec2_rightsizing

Analyze EC2 instances for right-sizing opportunities.

ec2_report

Generate detailed EC2 optimization reports.

ec2_stopped_instances

Identify stopped EC2 instances that could be terminated to save costs.

ec2_unattached_eips

Identify unattached Elastic IP addresses to reduce idle charges.

ec2_old_generation

Identify older generation instances for potential upgrade.

ec2_detailed_monitoring

Find instances missing detailed monitoring for cost-aware decisions.

ec2_graviton_compatible

Identify instances compatible with Graviton processors for potential migration.

ec2_burstable_analysis

Analyze burstable instances for CPU credit optimization.

ec2_spot_opportunities

Identify EC2 instances suitable for Spot pricing to save costs.

ec2_unused_reservations

Identify unused On-Demand Capacity Reservations.

ec2_scheduling_opportunities

Find instances that can be scheduled to reduce costs.

ec2_commitment_plans

Analyze Reserved Instances and Savings Plans opportunities.

ec2_governance_violations

Detect governance violations related to EC2 usage.

ec2_comprehensive_report

Generate a comprehensive EC2 optimization report.

ebs_optimization

Analyze EBS volumes for optimization opportunities.

ebs_unused

Identify unused EBS volumes.

ebs_report

Generate EBS optimization reports.

rds_optimization

Analyze RDS instances for optimization.

rds_idle

Identify idle RDS instances.

rds_report

Generate RDS optimization reports.

lambda_optimization

Analyze Lambda functions for optimization opportunities.

lambda_unused

Identify unused Lambda functions.

lambda_report

Generate Lambda optimization reports.

s3_general_spend_analysis

Analyze overall S3 spending patterns.

s3_storage_class_selection

Provide guidance on selecting cost-effective storage classes.

s3_storage_class_validation

Validate current data storage classes for cost efficiency.

s3_archive_optimization

Identify and optimize long-term archive storage.

s3_api_cost_minimization

Minimize S3 API request costs through optimization.

s3_multipart_cleanup

Identify and clean up incomplete multipart uploads.

s3_governance_check

Implement S3 cost controls and governance compliance.

s3_comprehensive_analysis

Run comprehensive S3 cost optimization analysis.

s3_comprehensive_optimization_tool

Unified comprehensive S3 optimization with parallel execution.

s3_quick_analysis

Fast 30-second analysis for spending overview.

s3_bucket_analysis

Analyze specific S3 buckets for optimization opportunities.

cloudtrail_get_management_trails

Get CloudTrail management trails.

cloudtrail_run_analysis

Run CloudTrail trails analysis for optimization.

cloudtrail_generate_report

Generate CloudTrail optimization reports.

cloudwatch_general_spend_analysis

Analyze CloudWatch spending across logs, metrics, alarms, and dashboards.

cloudwatch_metrics_optimization

Identify cost optimization opportunities for custom metrics.

cloudwatch_logs_optimization

Optimize log retention and ingestion costs.

cloudwatch_alarms_and_dashboards_optimization

Improve monitoring efficiency and reduce alarm costs.

cloudwatch_comprehensive_optimization_tool

Run comprehensive CloudWatch analysis with orchestration.

query_cloudwatch_analysis_results

Query stored CloudWatch analysis results using SQL.

validate_cloudwatch_cost_preferences

Validate cost preferences and coverage estimates.

get_cloudwatch_cost_estimate

Get detailed cost estimates for CloudWatch optimization.

database_savings_plans_analysis

Comprehensive analysis for Savings Plans across database services.

database_savings_plans_purchase_analyzer

Model custom database Savings Plans scenarios.

database_savings_plans_existing_analysis

Analyze existing Savings Plans utilization.

nat_gateway_optimization

Comprehensive NAT Gateway optimization.

nat_gateway_underutilized

Identify underutilized NAT Gateways.

nat_gateway_redundant

Find potentially redundant NAT Gateways.

nat_gateway_unused

Identify NAT Gateways not referenced by route tables.

comprehensive_analysis

Multi-service cost analysis.

get_trusted_advisor_checks

Get Trusted Advisor recommendations.

get_performance_insights_metrics

Get RDS Performance Insights data.