AWS MCP Servers for Cost Management

Use AI agents with AWS Model Context Protocol servers to query and analyze AWS costs through natural language.

Why it matters

AWS Model Context Protocol (MCP) servers provide AI agents with real-time access to AWS cost and pricing data. Instead of navigating multiple AWS consoles or writing complex queries, you can ask questions in plain English and get instant answers about your spending patterns, pricing, and optimization opportunities.

MCP servers bridge the gap between AI assistants and AWS services, enabling natural language interactions for cost analysis, forecasting, and optimization recommendations.

AWS Cost Explorer MCP Server

The Cost Explorer MCP Server integrates with the AWS Cost Explorer API to provide detailed insights into your AWS spending patterns.

Key features

  • Cost Analysis: Break down AWS costs by service, region, and other dimensions to understand how costs are distributed
  • Time Period Comparisons: Compare costs between different periods to identify trends and changes, including AWS’s new Cost Comparison feature
  • Cost Driver Analysis: Identify the top 10 most significant cost change drivers automatically
  • Forecasting: Generate cost forecasts based on historical usage patterns with confidence intervals
  • Natural Language Queries: Ask questions about AWS costs in plain English and receive instant answers

Example queries

Show me my AWS costs for the last 3 months grouped by service in us-east-1 region
Compare my AWS costs between April and May 2025
Why did my AWS bill increase in June compared to May?
Forecast my AWS costs for next month

Cost considerations

Important: AWS Cost Explorer API charges $0.01 per request. Each query made through this MCP server will incur this charge.

More information

AWS Pricing MCP Server

The Pricing MCP Server provides real-time AWS pricing information for cost analysis and planning. All pricing API calls are free of charge.

Key features

  • Service Catalog Exploration: Discover all AWS services with available pricing information
  • Pricing Attribute Discovery: Identify filterable dimensions (instance types, regions, storage classes) for any AWS service
  • Real-Time Pricing Queries: Access current pricing data with advanced filtering capabilities
  • Multi-Region Comparisons: Compare pricing across different AWS regions in a single query
  • Bulk Data Access: Download complete pricing datasets in CSV/JSON formats for offline analysis
  • Infrastructure Analysis: Scan CDK and Terraform projects to automatically identify AWS services and their configurations
  • Cost Optimization Recommendations: Receive AWS Well-Architected Framework aligned suggestions

Example queries

What's the cost of an m5.large EC2 instance in us-east-1?
Compare S3 storage pricing across all US regions
Show me pricing for RDS PostgreSQL instances with 8 vCPUs
What are the cheapest compute options for my workload?

More information

AWS Billing and Cost Management MCP Server

The Billing and Cost Management MCP Server offers comprehensive access to AWS cost analysis, optimization, and monitoring capabilities.

Key features

  • Free Tier Monitoring: Track Free Tier usage to avoid unexpected charges
  • Cost and Usage Analysis: Analyze historical and forecasted AWS costs with flexible grouping and filtering
  • Budget Monitoring: Check existing budgets and their status against actual spending
  • Cost Anomaly Detection: Identify unusual spending patterns and their root causes
  • Cost Optimization Recommendations: Receive suggestions for right-sizing and cost-saving opportunities
  • Savings Plans and Reserved Instances: Analyze coverage and receive purchase recommendations
  • S3 Storage Lens Analysis: Run queries against Storage Lens metrics data and analyze storage costs
  • Cost Comparisons: Compare costs between time periods and across multiple accounts
  • Pricing Calculator: Query workload estimates to see projected usage costs

Example queries

Am I exceeding any Free Tier limits?
Show me all active cost anomalies and their root causes
What are my top cost optimization opportunities?
How is my Savings Plan coverage performing?
Analyze my S3 storage costs by bucket and storage class

More information

Getting started

Prerequisites

  1. Install uv package manager
  2. Install Python 3.10 or later
  3. Set up AWS credentials with appropriate IAM permissions
  4. Configure AWS credentials with aws configure or environment variables

Required IAM permissions

Different MCP servers require different permissions:

Cost Explorer MCP Server:

  • ce:GetCostAndUsage
  • ce:GetDimensionValues
  • ce:GetTags
  • ce:GetCostForecast
  • ce:GetCostAndUsageComparisons
  • ce:GetCostComparisonDrivers

Pricing MCP Server:

  • pricing:* (All pricing API calls are free)

Billing and Cost Management MCP Server:

  • Comprehensive billing and cost management permissions (see documentation for full list)

Installation

MCP servers can be installed in AI assistants like Cursor, VS Code with Claude, or Amazon Q Developer. Add the server configuration to your MCP settings file:

{
  "mcpServers": {
    "awslabs.cost-explorer-mcp-server": {
      "command": "uvx",
      "args": ["awslabs.cost-explorer-mcp-server@latest"],
      "env": {
        "AWS_PROFILE": "your-aws-profile",
        "AWS_REGION": "us-east-1",
        "FASTMCP_LOG_LEVEL": "ERROR"
      }
    }
  }
}

Best practices

  • Start with the Pricing MCP Server - It’s free and helps you understand AWS pricing structure
  • Monitor API costs - Cost Explorer API calls cost $0.01 each, so be mindful of query volume
  • Use appropriate permissions - Grant only the IAM permissions needed for each MCP server
  • Combine with other tools - MCP servers complement AWS Cost Explorer console and CLI tools
  • Document common queries - Build a library of useful natural language queries for your team
  • Test in non-production - Try queries in a sandbox environment before using in production workflows

Common use cases

  • Ad-hoc cost analysis - Quick answers to “What did X cost last month?” without opening the console
  • Cost spike investigation - Use natural language to drill into unexpected cost increases
  • Budget planning - Generate forecasts and compare pricing options for capacity planning
  • Multi-account analysis - Compare costs across accounts and organizational units
  • Infrastructure planning - Estimate costs for new projects by querying pricing data
  • Cost optimization - Get AI-assisted recommendations for right-sizing and savings opportunities

Resources