get_ec2_spend_last_dayLABSCO SUMMARY
Four read-only cost tools; the remote deployment is your job.
The tool surface is small and pointed — yesterday's EC2 bill, a day-by-day split by region, service and instance type, and Bedrock usage lifted from your model invocation log group — which is enough to answer most "why did this month jump" questions without opening a dashboard. Running it anywhere but your own machine is the part to plan: SSE mode listens on port 8000 and MCP's JSON-RPC wire format carries no authentication of its own, so the README's own instruction is to terminate HTTPS at nginx with a real certificate before the port is reachable from anywhere.
What it is
A community MCP server that puts AWS Cost Explorer and Amazon Bedrock model invocation logs (stored in Amazon CloudWatch) in front of an assistant, so spend questions get answered in conversation instead of in a console. It runs two ways: locally over stdio with the client on the same machine, or on an Amazon EC2 instance over SSE with an nginx reverse proxy in front for HTTPS — the README carries the full nginx site config for that. Built with FastMCP; the repo also ships a Chainlit chatbot and a LangGraph agent client you can point at the server to check it works.
What you get
get_ec2_spend_last_day()— EC2 spending for the previous dayget_detailed_breakdown_by_day(days=7)— cost broken out by day, region, service and instance typeget_bedrock_daily_usage_stats(days=7, region='us-east-1', log_group_name='BedrockModelInvocationLogGroup')— per-day model usage by region and userget_bedrock_hourly_usage_stats(days=7, region='us-east-1', log_group_name='BedrockModelInvocationLogGroup')— the same breakdown down to the hour- Spend from other AWS accounts: set
CROSS_ACCOUNT_ROLE_NAMEwhen starting the server, then name an account id in the conversation — it works for every account whose role the server's IAM role can assume
Requirements
Python 3.12 and AWS credentials. The IAM user or role needs full read-only access to Cost Explorer and to CloudWatch — the README links AWS's own sample policies for both. Bedrock model invocation logging has to be turned on in CloudWatch first, and BEDROCK_LOG_GROUP_NAME tells the server which log group to read. MCP_TRANSPORT picks stdio or sse; in sse mode the server listens on TCP port 8000, so the EC2 security group needs an ingress rule for it. Installed from the repository with uv (package aws-cost-explorer-mcp, 0.1.0) or run as a Docker container. MIT licensed.
Setup effort
One command plus a key — uv venv --python 3.12 && source .venv/bin/activate && uv pip install --requirement pyproject.toml, then supply credentials
USE CASES
Explaining a month-over-month AWS bill jump
Pull the daily breakdown by region, service and instance type, then ask which services moved the most between the two periods.
Attributing Bedrock spend to models and users
Read the model invocation log group day by day, or drop to hourly when the spike is short enough that daily totals hide it.
Checking yesterday's EC2 cost before a standup
One call returns the previous day's EC2 spend, no console tab and no date-range picker.
Reviewing spend across a set of linked accounts
Start the server with a role name it can assume elsewhere, then name each account id in turn and get the same breakdowns back for each.
4 tools
Listed in project docs. Your client may show a different list.
get_detailed_breakdown_by_dayget_bedrock_daily_usage_statsget_bedrock_hourly_usage_statsBEFORE YOU INSTALL
What to know first
Tools you get
4 tools named in the project's documentation.
Requires
- docker on PATH
- Python 3.12
- AWS_ACCESS_KEY_ID in your environment
- AWS_SECRET_ACCESS_KEY in your environment
Where it runs
Both documented setups run the server on your machine.
INSTALLATION
Connect your client
Server setup
uv venv --python 3.12 && source .venv/bin/activate && uv pip install --requirement pyproject.tomlMCP Clients
Claude Desktop — uv
{
"mcpServers": {
"aws_cost_explorer": {
"command": "uv",
"args": [
"--directory",
"<YOUR_PATH_TO_AWS_COST_EXPLORER_MCP>",
"run",
"server.py"
],
"env": {
"AWS_ACCESS_KEY_ID": "<YOUR_AWS_ACCESS_KEY_ID>",
"AWS_SECRET_ACCESS_KEY": "<YOUR_AWS_SECRET_ACCESS_KEY>",
"AWS_REGION": "us-east-1",
"BEDROCK_LOG_GROUP_NAME": "<YOUR_BEDROCK_LOG_GROUP_NAME>",
"CROSS_ACCOUNT_ROLE_NAME": "ROLE_NAME_FOR_THE_ROLE_TO_ASSUME_IN_OTHER_ACCOUNTS",
"MCP_TRANSPORT": "stdio"
}
}
}
}Claude Desktop — Docker
{
"mcpServers": {
"aws-cost-explorer": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"AWS_ACCESS_KEY_ID",
"-e",
"AWS_SECRET_ACCESS_KEY",
"-e",
"AWS_REGION",
"-e",
"BEDROCK_LOG_GROUP_NAME",
"-e",
"MCP_TRANSPORT",
"-e",
"CROSS_ACCOUNT_ROLE_NAME",
"aws-cost-explorer-mcp:latest"
],
"env": {
"AWS_ACCESS_KEY_ID": "<YOUR_AWS_ACCESS_KEY_ID>",
"AWS_SECRET_ACCESS_KEY": "<YOUR_AWS_SECRET_ACCESS_KEY>",
"AWS_REGION": "us-east-1",
"BEDROCK_LOG_GROUP_NAME": "<YOUR_BEDROCK_LOG_GROUP_NAME>",
"CROSS_ACCOUNT_ROLE_NAME": "ROLE_NAME_FOR_THE_ROLE_TO_ASSUME_IN_OTHER_ACCOUNTS",
"MCP_TRANSPORT": "stdio"
}
}
}
}