*I gave this one prompt to an AI… and the results honestly surprised me:
*
*fetch 90 days data for aws cost and billing and give recommendation for better cost optimization
*
🚀 I Built an MCP Server That Analyzes AWS Costs Using AI (FastAPI + FinOps)
You can visit my repo the link is below:
https://github.com/Moiz-Ali-Moomin/mcp-cloud-finops-ai-agent
*Cloud bills are confusing.
*
Most of us don’t realize:
• where money is being wasted
• which resources are idle
• what to actually fix
So I built something to solve this.
👉 An MCP (Model Context Protocol) server + AI agent that analyzes AWS costs and gives actionable optimization recommendations.
*🤖 What I Built
*
I created an MCP server using FastAPI that:
• connects with AWS billing and infrastructure data
• allows an AI agent to analyze usage
• returns real optimization insights
• provides exact CLI commands to fix issues
*⚡ How It Works
*
- MCP server exposes tools (billing + infra data)
- AI agent calls these tools
- Data is analyzed (90 days usage)
- System generates: • cost insights • anomalies • optimization suggestions
*🧪 The Prompt
*
I gave a simple instruction:
“Fetch 90 days AWS cost and suggest optimizations”
*📊 What the System Returned
*
• Total spend: $11.44
• Top cost driver: EC2-Other
• Estimated savings: ~40%
👉 Almost half the cost could be optimized.
*🔍 Key Insights (Automatically Generated)
*
AWS Cost Explorer was costing money
• I was paying just to query billing data
• Suggested fix: use S3 Cost & Usage Reports + cachingUnused resources detected
• orphaned EBS volumes
• unused Elastic IPs
• idle infra
Suggested command:
aws ec2 describe-volumes --filters Name=status,Values=available
- Idle NAT Gateway • charging even without usage
Suggested fix:
terraform destroy
- Cost spikes explained • Jan spike → ECS usage • March spike → Kubernetes testing
👉 AI correlated infra activity with billing automatically
*🧠 Why MCP Makes This Powerful
*
Instead of hardcoding logic:
• MCP enables tool-based architecture
• AI dynamically decides what to fetch and analyze
• system becomes flexible and extensible
💻 Example Output
{
"resource": "EC2",
"issue": "Underutilized",
"recommendation": "Downgrade instance",
"estimated_savings": "30%"
}
*🧪 Try It Yourself
*
GitHub repo:
https://github.com/Moiz-Ali-Moomin/mcp-cloud-finops-ai-agent/
Steps:
- git clone https://github.com/Moiz-Ali-Moomin/mcp-cloud-finops-ai-agent
- pip install -r requirements.txt
- uvicorn main:app --reload
*🤝 Contributing
*
If this sounds interesting, contributions are welcome.
You can help by:
• adding support for more cloud services
• improving cost analysis logic
• building a frontend/dashboard
• adding auto-remediation features
Feel free to:
• open issues
• suggest improvements
• submit pull requests
👉 Even small contributions are appreciated.
*🚀 What’s Next
*
• real-time monitoring
• multi-cloud support
• auto-remediation (AI fixing issues automatically)
*💬 Final Thoughts
*
Before this, cloud cost optimization meant:
• dashboards
• manual effort
• guesswork
Now it’s:
👉 Ask AI → get exact fixes
If you're into DevOps, cloud, or AI agents, would love your feedback.








Top comments (0)