mcp-aws-finops
A read-only MCP server that lets an AI agent (Claude, Cursor, Hermes…) answer AWS cost / FinOps questions directly in plain language: "how much did EKS cost this month?", "what went up since last month?", "which resources are idle?".
Built on the FinOps Foundation's open FOCUS billing format, so it works
fully offline, with no AWS account or credentials, using bundled synthetic
sample data. An AWS Cost Explorer backend (--source aws) is also
available (see AWS mode) — it has been tested against
mocked AWS APIs (botocore Stubber + moto) but not yet validated against
a live AWS account.
Features
| Tool | What it does |
|---|---|
get_cost_summary |
Cost for a date range, grouped by service, account, region, or a tag |
compare_periods |
Delta between two periods and the top drivers of the change |
top_cost_drivers |
Rank the N most expensive services over a period |
cost_by_tag |
Showback by tag (e.g. team, project) incl. % untagged |
find_idle_resources |
Unattached EBS, idle Elastic IPs, old snapshots, low-CPU instances |
forecast_month_end |
Simple run-rate projection of month-end spend |
explain_anomaly |
What changed on a given day vs. a trailing baseline |
Also exposes one MCP Resource (finops://reports/weekly, a markdown
weekly cost report) and one MCP Prompt (weekly_cost_review).
All tools are read-only and return typed, validated (pydantic) output.
Invalid inputs (bad dates, out-of-range n, unknown group_by) raise
clear, descriptive errors instead of silently doing the wrong thing.
Quickstart
# Once published to PyPI:
uvx mcp-aws-finops --demo
# or pip:
pip install mcp-aws-finops
mcp-aws-finops --demo
# From a checkout (works today, no PyPI release needed):
git clone https://github.com/thomm-011/mcp-aws-finops
cd mcp-aws-finops
uv run mcp-aws-finops --demo
Docker
docker run -i --rm ghcr.io/thomm-011/mcp-aws-finops --demo
# AWS mode: mount read-only AWS credentials and pick a profile
docker run -i --rm \
-v ~/.aws:/home/app/.aws:ro -e AWS_PROFILE=my-profile \
ghcr.io/thomm-011/mcp-aws-finops --source aws --region us-east-1
--demo uses the bundled synthetic sample dataset (~3 months of AWS
billing data, see Sample data). To point it at your own
FOCUS-format export instead:
uv run mcp-aws-finops --data /path/to/focus.parquet
# or a directory of FOCUS CSV/Parquet files
uv run mcp-aws-finops --data /path/to/focus-exports/
The server speaks MCP over stdio by default.
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"aws-finops": {
"command": "uvx",
"args": ["mcp-aws-finops", "--demo"]
}
}
}
Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"aws-finops": {
"command": "uvx",
"args": ["mcp-aws-finops", "--demo"]
}
}
}
Hermes
{
"mcpServers": {
"aws-finops": {
"command": "uv",
"args": ["run", "--directory", "/path/to/mcp-aws-finops", "mcp-aws-finops", "--demo"]
}
}
}
Use with your agent
Ready-to-copy configs for Claude Desktop, Cursor, Claude Code, and Hermes
live in examples/ — including the zero-install
uvx --from git+https://github.com/thomm-011/mcp-aws-finops command (no
PyPI release yet) and a local uv --directory variant. See
docs/demo.tape for the VHS source behind the GIF above.
AWS mode
--source aws swaps the bundled sample data for live AWS Cost Explorer /
EC2 / CloudWatch data, via CostExplorerSource (same CostSource
interface as FocusFileSource, so every tool behaves identically):
uv run mcp-aws-finops --source aws --region us-east-1 --profile my-profile
Flags: --profile (named AWS CLI profile; default credential chain if
omitted), --region (for ec2/cloudwatch calls — Cost Explorer itself
is a single global endpoint), --metric (UnblendedCost default, or
AmortizedCost to spread RI/Savings-Plan costs over time), and
--cache-ttl-seconds (default 300; 0 disables caching).
Credentials come from the normal boto3 chain: --profile, environment
variables (AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN),
or an attached IAM role (EC2 instance profile, ECS task role, EKS IRSA).
IAM permissions: grant the identity running the server the read-only
policy in iam/policy.json — ce:GetCostAndUsage,
ce:GetCostForecast, ce:GetAnomalies, ec2:Describe{Volumes,Addresses, Snapshots,Instances}, cloudwatch:GetMetricData/GetMetricStatistics.
No write/mutate action is ever granted or called; see
iam/README.md for the action-by-tool mapping and
terraform/ for a module that provisions an assumable role
with this exact policy (including an OIDC/IRSA trust variant). On
AccessDenied/missing-credentials, the server raises a CostExplorerError
pointing back at this policy file.
Cost of Cost Explorer calls: ce:GetCostAndUsage/GetCostForecast
cost ~US$0.01 per request. CostExplorerSource caches responses in-memory
for --cache-ttl-seconds (default 300s) to avoid repeat charges for the
same query window within a short span; set it to 0 to disable caching,
or raise it for a long-running server with infrequent, repeated questions.
ec2:Describe* and cloudwatch:GetMetricData calls are free.
Status: CostExplorerSource is implemented and covered by unit and
in-process MCP integration tests against botocore.stub.Stubber (Cost
Explorer — moto's CE support is too partial to rely on) and moto.mock_aws
(EC2/CloudWatch, which moto supports well). It has not yet been run
against a live AWS account — treat it as implemented-and-mock-tested,
not production-validated, until that happens.
Architecture
flowchart LR
agent["AI agent (Claude / Cursor / Hermes)"] <-->|MCP stdio| server["mcp-aws-finops\n(FastMCP server)"]
server --> tools["Tools: get_cost_summary, compare_periods,\ntop_cost_drivers, cost_by_tag,\nfind_idle_resources, forecast_month_end,\nexplain_anomaly"]
tools --> iface["CostSource interface"]
iface --> focus["FocusFileSource\n(DuckDB over FOCUS CSV/Parquet)"]
iface --> ce["CostExplorerSource\n(boto3: Cost Explorer, EC2, CloudWatch)"]
focus --> data[("sample_focus.parquet\nor your FOCUS export")]
ce --> aws[("AWS account\n(read-only IAM role, see iam/ + terraform/)")]
A single CostSource abstract interface (src/mcp_aws_finops/sources/base.py)
decouples the MCP tool layer from where the data comes from.
FocusFileSource loads a local FOCUS CSV/Parquet file (or directory of
files) into an in-memory DuckDB view and runs SQL aggregations for every
tool. CostExplorerSource implements the same interface against live
ce/ec2/cloudwatch AWS APIs (--source aws) — tested with mocks, see
AWS mode for its current validation status. Both backends
feed the exact same 7 tools unmodified.
Sample data
The bundled dataset (src/mcp_aws_finops/data/sample_focus.parquet, ~47 KB)
is synthetic, generated deterministically by
scripts/generate_sample.py (fixed seed,
random.Random(42)).
We evaluated the FinOps Foundation's public FOCUS-Sample-Data repository first, but at the time of writing its samples are small, multi-provider, generic examples (and have open issues about not fully passing the FOCUS validator) rather than AWS-specific data with the resource-level detail (unattached volumes, idle EIPs, old snapshots, per-instance CPU) the idle-resource heuristics and anomaly tooling need. A seeded generator gave full control over that, with a license-free, byte- reproducible result.
It models ~3 months (92 days) of AWS billing across EC2, EKS, RDS, S3,
Lambda, CloudWatch, NAT Gateway, EBS volumes (20% deliberately unattached),
EBS snapshots (some older than 90 days), and Elastic IPs (30% idle). Tags
team/project/env are present on most resources, with 10-30% of
resources deliberately left untagged per service to exercise the
cost_by_tag untagged-% metric. Day 56 (2025-08-25) has a deliberate ~2.3x
EC2 cost spike for explain_anomaly to detect.
FOCUS is the open, vendor-neutral billing schema from the
FinOps Foundation; see the
spec.
FocusFileSource uses the standard FOCUS columns (BilledCost,
ServiceName, ChargePeriodStart, Tags, ...) plus a few x_-prefixed
extension columns the spec reserves for provider/implementation-specific
data (x_Attached, x_AvgCpuUtilization, ...) — documented in
focus_file.py.
Security
- Every tool is read-only: it only ever runs
SELECTqueries against a local file, or read-only AWS API calls (ce:Get*,ec2:Describe*,cloudwatch:GetMetric*). No tool deletes, creates, or modifies anything — enforced by a server-level test that rejects any registered tool whose name contains a mutating verb, plus a unit test (tests/test_iam_policy.py) that assertsiam/policy.jsongrants only actions the code actually calls and never a write action. - No AWS credentials are required or used in offline mode (
--demo/--data). - AWS mode (
--source aws) requires only the read-only IAM policy iniam/policy.json— no*:Create*,*:Delete*, or*:Put*permissions.terraform/provisions an assumable role with that exact policy, including an OIDC/IRSA trust option. - Cost Explorer API calls cost ~US$0.01 each;
CostExplorerSourcecaches results in-memory (configurable TTL, default 300s) to avoid repeat charges for the same query window.
Roadmap
- M1 — Skeleton ✅ repo,
uv,src/layout, FastMCP server with tools, CI (ruff/mypy/pytest), README. - M2 — Offline mode ✅
FocusFileSourceover DuckDB, all 7 tools + resource + prompt on sample data, ≥80% test coverage. - M3 — Agent integration ✅ ready-to-paste configs for Claude Desktop/Cursor/Claude Code/Hermes (see
examples/), demo GIF of an agent (Hermes) answering real questions against the sample data. - M4 — AWS backend ✅
CostExplorerSource(Cost Explorer + EC2/CloudWatch) implemented and tested withbotocore.stub.Stubber/moto(95%+ coverage incl. an in-process MCP tool call against a stubbed AWS source);iam/policy.jsonleast-privilege policy +terraform/role module (terraform fmt/validate/testall green against a mocked provider). Not yet validated against a live AWS account. - M5 — Polish ✅ packaging metadata +
py.typed, multi-stage Dockerfile (non-root, published to GHCR),release.yml(PyPI Trusted Publishing + multi-arch Docker + GitHub Release onv*tags), badges, README/examples updated. SeeRELEASING.mdfor the one-time PyPI setup and how to cut a release.
Development
uv sync --all-groups
uv run ruff check . && uv run ruff format --check .
uv run mypy src
uv run pytest --cov --cov-report=term-missing
uv run pre-commit install # optional, runs the same checks on commit
Regenerate the sample dataset after changing the generator:
uv run python scripts/generate_sample.py
License
MIT — see LICENSE.
Metadata
Release files for mcp-aws-finops 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcp_aws_finops-0.2.0.tar.gz | 64.4 kB | With provenance | Details for mcp_aws_finops-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp_aws_finops-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for mcp_aws_finops-0.2.0-py3-none-any.whl |
Total release size: 121.3 kB
Release files / mcp_aws_finops-0.2.0.tar.gz
| Download URL | mcp_aws_finops-0.2.0.tar.gz |
|---|---|
| Size | 64.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a31f372929a5a9df56ff85cc7b36291919db31cf630a5f9e545c005fc86ce8a
|
|
BLAKE2b-256 checksum How to use checksums |
a512ea7c2248df0348d897850d7a161f5084ca23dd1addbfdb7ca7239474b877
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logRelease files / mcp_aws_finops-0.2.0-py3-none-any.whl
| Download URL | mcp_aws_finops-0.2.0-py3-none-any.whl |
|---|---|
| Size | 56.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04528e1740f0edc808b4eba14b35d79e46bafe745ec94b18dd5cd3c11730cca9
|
|
BLAKE2b-256 checksum How to use checksums |
559e27ef04fb59972ab53d11e820f446c089e8ea7eccdaae3b7af77582dbc890
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logSecurity for mcp-aws-finops 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mcp_aws_finops-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.