Retrieves AWS spending data broken down by service for a specified time period
Retrieves AWS spending data broken down by day for a specified time period
Retrieves AWS spending data broken down by region for a specified time period
Retrieves EC2 spending data broken down by instance type
Retrieves Amazon Bedrock spending data broken down by model
Retrieves Amazon Bedrock spending data broken down by user
Retrieves Amazon Bedrock spending data broken down by region
AWS Cost Explorer provides a convenient way to analyze and visualize AWS cloud spending data using natural language queries. It connects to AWS Cost Explorer API and Amazon CloudWatch to retrieve detailed cost information about your AWS services, with particular focus on EC2 instances and Amazon Bedrock usage. This tool allows you to get granular cost breakdowns by day, region, service, and instance type, making it easy to understand your cloud spending patterns. It can also access AWS spend information from multiple accounts when properly configured with cross-account roles.
AWS Cost Explorer MCP Server connects to AWS services to provide detailed cost analysis capabilities through natural language. It allows you to query your AWS spending data, analyze trends, and get insights about your cloud costs without having to navigate the AWS console or write complex queries.
uv
package manager:# On macOS and Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# On Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
git clone https://github.com/aarora79/aws-cost-explorer-mcp-server.git
cd aws-cost-explorer-mcp-server
uv venv --python 3.12
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install --requirement pyproject.toml
mkdir -p ~/.aws
# Set up your credentials in ~/.aws/credentials and ~/.aws/config
If you use AWS IAM Identity Center, follow the AWS documentation to configure your short-term credentials.
Ensure that the IAM user/role being used has:
To analyze Bedrock usage, set up model invocation logs in Amazon CloudWatch following the AWS documentation.
To access AWS spend information from other accounts:
CROSS_ACCOUNT_ROLE_NAME
parameter when starting the serverStart the server with:
export MCP_TRANSPORT=stdio
export BEDROCK_LOG_GROUP_NAME=YOUR_BEDROCK_CW_LOG_GROUP_NAME
export CROSS_ACCOUNT_ROLE_NAME=ROLE_NAME_FOR_THE_ROLE_TO_ASSUME_IN_OTHER_ACCOUNTS
python server.py
For a more secure setup, you can run the MCP server remotely:
export MCP_TRANSPORT=sse
export BEDROCK_LOG_GROUP_NAME=YOUR_BEDROCK_CW_LOG_GROUP_NAME
export CROSS_ACCOUNT_ROLE_NAME=ROLE_NAME_FOR_THE_ROLE_TO_ASSUME_IN_OTHER_ACCOUNTS
python server.py
Configure a reverse proxy with HTTPS (e.g., using Nginx)
Use the provided client scripts to connect to your remote server
There are two ways to configure this tool with Claude Desktop:
Add the following to your Claude Desktop configuration file (located at ~/Library/Application Support/Claude/claude_desktop_config.json
on macOS or %APPDATA%\Claude\claude_desktop_config.js
on Windows):
{
"mcpServers": {
"aws-cost-explorer": {
"command": "docker",
"args": [
"run",
"--rm",
"-e",
"AWS_PROFILE=YOUR_AWS_PROFILE",
"-e",
"BEDROCK_LOG_GROUP_NAME=YOUR_BEDROCK_CW_LOG_GROUP_NAME",
"-e",
"MCP_TRANSPORT=stdio",
"-v",
"~/.aws:/root/.aws",
"aarora79/aws-cost-explorer-mcp-server:latest"
]
}
}
}
Add the following to your Claude Desktop configuration file:
{
"mcpServers": {
"aws-cost-explorer": {
"command": "python",
"args": [
"/path/to/aws-cost-explorer-mcp-server/server.py"
],
"env": {
"MCP_TRANSPORT": "stdio",
"BEDROCK_LOG_GROUP_NAME": "YOUR_BEDROCK_CW_LOG_GROUP_NAME"
}
}
}
}
Once configured, you can ask Claude questions like: