← Back to Blog

How to Find AWS Waste from Claude Code with an MCP Server

Add the free, read-only cloudcostwise MCP server to Claude Code, try it on sample data, then scan your AWS account. Codex, Cursor, Kiro and Gemini CLI too.

Rick Wise9 min read
How to Find AWS Waste from Claude Code with an MCP Server

You can find AWS waste from Claude Code by adding an MCP server that scans your account with your own read-only credentials, then asking Claude what it found. The one below is cloudcostwise, which I build. It is free, Apache-2.0, and runs on your machine. By the end of this post you will have it installed, have seen a sample scan without touching AWS, and know what a real scan needs.

Install the MCP server in Claude Code

The server starts with uvx, so install uv first (brew install uv or pipx install uv). Then:

claude mcp add -s user cloudcostwise -- uvx cloudcostwise mcp

To pin an AWS profile, add an environment variable:

claude mcp add -s user cloudcostwise -e AWS_PROFILE=my-profile -- uvx cloudcostwise mcp

Leave AWS_PROFILE out to use the standard AWS credential chain. If you prefer a plugin that asks for your profile, run these inside Claude Code:

/plugin marketplace add cloudwise-app/cloudcostwise
/plugin install cloudcostwise@cloudcostwise

The server exposes four tools: scan, list_findings, explain_finding and fix_guidance. All four are read-only. fix_guidance returns the steps and the AWS CLI command as text for you to review. Nothing is executed.

Try it first with a demo scan

You do not need AWS credentials to see what it does. In a terminal:

uvx cloudcostwise scan --demo

Or in Claude Code, ask it to call the scan tool with demo set to true. After that, list_findings, explain_finding and fix_guidance work on the sample.

The demo is a recording of a CloudWise test account with every identifier replaced by a placeholder. It makes no AWS call and no network call, every result says it is sample data, and a demo is never shared. If you have run cloudcostwise with uvx before, uvx keeps using the version it cached the first time, which may not know --demo. Run uvx cloudcostwise@latest scan --demo instead (or pipx upgrade cloudcostwise if you installed it with pipx). In Claude Code, if you added the server before demo mode shipped, run uvx cloudcostwise@latest --version once and restart Claude Code so the server picks up the new release.

What a real scan needs

Three things.

Read-only AWS credentials. A profile in ~/.aws, SSO, or the usual environment variables. The minimal policy the checks use is docs/iam-policy.json in the repo.

It lists 71 read-only actions. AWS-managed ReadOnlyAccess also works, but it is much broader than the scan needs. If a check lacks a permission, the scan reports a data warning instead of failing.

Regions. By default it scans us-east-1 plus your profile's region. Ask for more with the regions argument (comma-separated, or all). Each region takes 30 to 60 seconds, and up to four run at once.

A small Cost Explorer charge. The RI and Savings Plans checks call Cost Explorer, which AWS bills per request. So do one read of the account's last 30 days of spend, used for the score, and, only when an S3 bucket-key finding appears, one read of KMS request spend.

That is $0.01 for each request, and a scan makes up to 10 of them, so up to about ten cents. The minimal policy above has no ce:GetCostAndUsage, so with it the two spend reads are refused and the score is shown without spend data. The server tells Claude to warn you before the first scan, and include_cost_explorer=false (or --no-cost-explorer on the CLI) skips those calls and the checks that depend on them.

What to ask after the scan

Start with the plain question:

Where am I wasting money on AWS? Scan the prod profile in us-east-1 and eu-west-1.

Then work the list:

List the findings over $20 a month, biggest first.
Explain the second one. What did you look at to decide it was waste?
Give me the fix guidance for that one. Do not run anything.

Treat the dollar figures as estimates and read the explanation before you act on one. Advisory findings, from checks that cannot be proven on a test resource, are listed but never added to the savings total.

What it does not do

  • It cannot change your AWS account. Every AWS call a scan makes is checked, and anything that is not a Describe, List, Get, Search or Lookup is refused before it is sent, whatever your credentials allow.
  • Nothing goes to CloudWise unless you choose. The MCP server never prompts and its scan tool has no sharing parameter. If you want to share a summary of a scan (version, finding count, estimated savings, checks run; never account IDs, resource names or regions), run cloudcostwise share --last in your own terminal. It shows exactly what would be sent and sends it only if you type y. If you have turned sharing on (cloudcostwise share --on or CLOUDCOSTWISE_SHARE=yes), each MCP scan sends that summary and says so in its result.
  • Your assistant sees the findings. Through MCP, the results, including your account ID and resource IDs, go to Claude like any other tool output. Treat them like the rest of your session.

It writes up to three small files under ~/.config/cloudcostwise/: your share answer, the summary numbers of your last scan, and an exclude list if you use cloudcostwise exclude.

The same server in Codex, Cursor, Kiro and Gemini CLI

It is the same command everywhere: uvx cloudcostwise mcp. Leave out AWS_PROFILE to use the standard credential chain, with two exceptions noted below: Codex and Gemini CLI do not pass every shell variable to MCP servers.

Codex (~/.codex/config.toml):

[mcp_servers.cloudcostwise]
command = "uvx"
args = ["cloudcostwise", "mcp"]
env = { AWS_PROFILE = "my-profile" }

Codex starts MCP servers with only a few basic variables (HOME, PATH and the like), so AWS_PROFILE, AWS_REGION or keys set in your shell do not reach the server. Set the profile in env as above, or forward the variables you use with env_vars = ["AWS_PROFILE", "AWS_REGION"] in the same table.

Cursor (~/.cursor/mcp.json, or .cursor/mcp.json in a project). There is also an Add to Cursor link that uses your default AWS credentials:

{
  "mcpServers": {
    "cloudcostwise": {
      "command": "uvx",
      "args": ["cloudcostwise", "mcp"],
      "env": { "AWS_PROFILE": "my-profile" }
    }
  }
}

Kiro (~/.kiro/settings/mcp.json, or .kiro/settings/mcp.json in a workspace), same shape:

{
  "mcpServers": {
    "cloudcostwise": { "command": "uvx", "args": ["cloudcostwise", "mcp"] }
  }
}

Gemini CLI:

gemini mcp add -s user cloudcostwise uvx cloudcostwise mcp
# a specific profile:
gemini mcp add -s user -e AWS_PROFILE=my-profile cloudcostwise uvx cloudcostwise mcp

Gemini CLI removes variables whose names contain words such as KEY, SECRET or TOKEN, and AWS_DEFAULT_REGION, from the environment it gives MCP servers, so credentials held only in AWS_ACCESS_KEY_ID-style variables are not seen, whether you add the server with gemini mcp add or as an extension. Use a profile in ~/.aws (a file or SSO profile) and pass it with -e AWS_PROFILE=...; give the profile a region in ~/.aws/config, or add -e AWS_REGION=....

How it differs from AWS's own tools

AWS has tools that cover a lot of this, and you should use them. Cost Optimization Hub and Compute Optimizer are free; Trusted Advisor's cost checks need a Business, Enterprise or Unified Operations support plan.

Cost Optimization Hub consolidates recommendations across accounts and Regions, including Savings Plans and Reserved Instances, and quantifies savings using your own pricing. Compute Optimizer does rightsizing and idle-resource recommendations for EC2, Auto Scaling groups, EBS, ECS on Fargate, RDS and Aurora, memory rightsizing for Lambda, and idle checks for NAT gateways, DynamoDB, ElastiCache and others. Both are the better source for rightsizing, and for a view across an AWS Organization. The AWS Billing and Cost Management MCP server from awslabs puts that side into your assistant: Cost Explorer, Budgets, Compute Optimizer and Cost Optimization Hub recommendations, Savings Plans and more. It answers questions about your bill and those recommendations. Check its page for the permissions it asks for: besides reads, the list includes Cost Explorer Start* actions and Athena, Glue and S3 create and put actions for its Storage Lens queries.

What cloudcostwise adds is a set of checks aimed at leftovers those tools either do not check or check from a different angle:

Of the checks it runs, 55 are proven: each fired on a real AWS resource built to trigger it and stayed silent on a healthy twin. Going by AWS's own lists of what Trusted Advisor, Cost Optimization Hub and Compute Optimizer cover (last checked 2026-10-11), 19 of those flag waste that none of the three flag, and 12 more go further than the closest AWS check. Examples from the repo's comparison table:

Not flagged by any of them:

  • Empty S3 buckets left behind for 30 days or more
  • EBS snapshots whose volume is gone or whose AMI was deregistered
  • Application Load Balancers carrying almost no traffic

Further than the closest AWS check:

  • Idle Application and Network Load Balancers (Trusted Advisor's idle load balancer check covers Classic Load Balancers only)
  • CloudWatch log groups set to never expire (Trusted Advisor flags retention that is too short, so these pass)
  • EFS file systems with no mount targets (Trusted Advisor checks mount targets for redundancy only)
  • Old and untagged ECR images still billed for storage (Trusted Advisor checks that a lifecycle policy exists, not the images already stored)
  • Incomplete multipart uploads whose parts keep billing (Trusted Advisor checks for an abort rule, not the uploads already stored)

For idle EC2, RDS and NAT gateways, rightsizing and Savings Plans, AWS's tools cover the same ground. It also scans one profile at a time, so it is not a replacement for an organization-wide view. Run both. The full table, with the closest AWS check for each row and the reasoning, is in the README.

The free scanner runs a subset of CloudWise's checks, listed at cloudcostwise.io/waste-checks. The hosted product has the rest, plus history and alerts, but you do not need it for anything in this post.

Try it

Run the demo, then run it on a non-production account first. If a finding is wrong, I want to hear about it: post it in issue #1 or email cloudwise@cloudcostwise.io, leaving out account IDs and resource names.

More on the scanner and the install options: cloudcostwise.io/cli. You can also look at a sample scan in the browser. Or start at cloudcostwise.io for a free, read-only scan of your own account.

Find this waste in your own account

Run the free scanner on your own machine. Read-only, no signup, and nothing is sent to CloudWise unless you choose to share a summary at the end.

$ pipx install cloudcostwise

What it checksPrefer a dashboard? Start a free hosted scan →