@jadenrazo/cloudcost-mcp 0.5.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,128 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [1.0.1] - 2026-04-18
8
+
9
+ ### Security
10
+
11
+ Hardened the MCP tool surface against the attack classes catalogued in the OWASP MCP Top 10 (2025) and recent SDK advisories. No breaking API changes.
12
+
13
+ - **Path traversal in module resolution (HIGH)**: A `module { source = "../../../etc" }` declaration in user-supplied HCL previously resolved without any containment check, turning any file-accepting tool into an arbitrary `*.tf` read primitive. All resolved paths are now confined to `process.cwd()` by default (configurable), symlinks are rejected, and `modules.json` entries are re-validated against the boundary. Added `src/parsers/path-safety.ts`.
14
+ - **MCP SDK floor (MED)**: Bumped `@modelcontextprotocol/sdk` minimum from `^1.12.1` to `^1.25.2` so fresh installs cannot resolve a version affected by CVE-2025-66414 (DNS rebinding, `< 1.24.0`) or CVE-2026-0621 (UriTemplate ReDoS, `< 1.25.2`).
15
+ - **Prototype pollution in `plan_json` / `state_json` (MED)**: Raw `JSON.parse` on user input followed by deep-merge was vulnerable to `__proto__` / `constructor` / `prototype` payloads. Added `safeJsonParse` with a reviver that strips these keys, applied to the Terraform plan and state parsers and to the HCL-JSON merge in `module-resolver`.
16
+ - **Output-channel prompt injection ("Poison Everywhere", MED)**: User-supplied filenames, module names, and error strings were echoed verbatim into error responses and warnings. Added `sanitizeForMessage` which strips ASCII control characters, zero-width / bidi-override characters, and caps length; applied at every point where tool results flow back to the MCP client.
17
+ - **Input-size DoS (LOW-MED)**: Tool inputs had no size limits. Added Zod `.max()` on every accepting schema — 5 MiB per file, 20 MiB per plan/state payload, 1 KiB per path, max 2000 files per request.
18
+
19
+ ### Tests
20
+
21
+ - Added `test/unit/security/mcp-hardening.test.ts` with 19 regression tests covering sanitisation, prototype-pollution guards, path-boundary enforcement, symlink rejection, and every new Zod size limit.
22
+
23
+ ## [1.0.0] - 2026-04-15
24
+
25
+ First stable release. No breaking API changes from 0.5 — this version ratifies the existing surface as SemVer-locked. See [`MIGRATION.md`](./MIGRATION.md) for details.
26
+
27
+ ### Added
28
+ - **`STABILITY.md`**: Formal stability contract defining the SemVer-locked public surface (11 MCP tools, CLI binaries, package entry points) and the change-classification policy.
29
+ - **`MIGRATION.md`**: 0.x → 1.0 migration guide and forward-looking support policy.
30
+ - **Smoke integration tests**: Live-API smoke coverage for AWS Bulk Pricing, Azure Retail Prices, and GCP Cloud Billing Catalog, gated behind `RUN_INTEGRATION=1`. New `integration-smoke` CI job runs on manual dispatch and weekly schedule (Mondays 12:00 UTC).
31
+ - **Publish workflow gates**: `npm audit --audit-level=high` and `npm test` now run before `npm publish`, preventing broken or vulnerable releases.
32
+
33
+ ### Security
34
+ - Resolved transitive advisories via npm `overrides`:
35
+ - `hono` → `^4.12.12` (GHSA-26pp-8wgv-hjvm, GHSA-r5rp-j6wh-rvv4, GHSA-xf4j-xp2r-rqqx, GHSA-wmmm-f939-6g9c, GHSA-xpcf-pg52-r92g)
36
+ - `@hono/node-server` → `^1.19.13` (GHSA-92pp-h63x-v22m)
37
+ - `path-to-regexp` → `^8.4.0` (GHSA-j3q9-mxjg-w52f, GHSA-27v5-c462-wpq7)
38
+ - `vite` → `^7.3.2` (GHSA-4w7w-66w2-5vf9, GHSA-v2wj-q39q-566r)
39
+ - `npm audit --audit-level=high` now reports zero vulnerabilities.
40
+
41
+ ### Packaging
42
+ - `STABILITY.md`, `MIGRATION.md`, and `CHANGELOG.md` are now included in the published npm tarball.
43
+
44
+ ## [0.4.0] - 2026-03-28
45
+
46
+ ### Added
47
+ - **Multi-IaC support**: CloudFormation (JSON/YAML), Pulumi (stack export), and Bicep/ARM template parsing via unified `IaCParser` interface with auto-format detection
48
+ - **`analyze_plan` tool**: Parse `terraform plan -json` output for precise before/after cost-of-change analysis
49
+ - **`compare_actual` tool**: Parse `.tfstate` files to compare actual infrastructure costs against estimates
50
+ - **`price_trends` tool**: Historical pricing with SQLite-backed price snapshots, change tracking, and trend queries
51
+ - **`detect_anomalies` tool**: Cost anomaly detection with budget checks, price change alerts, concentration risk, and right-sizing hints
52
+ - **API Gateway pricing**: AWS REST/HTTP/WebSocket, Azure API Management, GCP API Gateway
53
+ - **WAF pricing**: AWS WAFv2, Azure WAF Policy
54
+ - **OpenSearch pricing**: AWS OpenSearch Domain with per-instance-type tables
55
+ - **Messaging pricing**: AWS SNS/MQ Broker, Azure Service Bus/Event Hubs, GCP Pub/Sub
56
+ - **ML/AI pricing**: AWS SageMaker endpoints (40+ instance types), GCP Vertex AI (confidence: low)
57
+ - **Expanded Redis**: Full Azure Redis Cache and GCP Redis Instance support
58
+ - **ESLint + Prettier**: Flat config ESLint with TypeScript rules, Prettier formatting enforced
59
+ - **Coverage thresholds**: 70%+ statement/branch/function/line coverage enforced via vitest
60
+ - **Performance benchmarks**: Parsing, pricing cache, and calculator benchmarks via `vitest bench`
61
+ - **CI hardening**: Security audit job, Prettier format check, concurrency groups, job timeouts
62
+ - **SECURITY.md**: Vulnerability reporting policy and security design documentation
63
+ - **ARCHITECTURE.md**: Layered architecture documentation with extension guides
64
+
65
+ ### Changed
66
+ - Refactored `bulk-loader.ts` (929 -> 708 lines) into focused modules: csv-parser, fallback-data
67
+ - Refactored `resource-extractor.ts` (778 -> 299 lines) into per-provider extractors
68
+ - Refactored `retail-client.ts` (614 -> 499 lines) with extracted fallback-data
69
+ - Replaced ~40 `any` types in pricing modules with proper TypeScript interfaces
70
+ - Updated CI pipeline with security audit job and format checking
71
+
72
+ ### Fixed
73
+ - picomatch HIGH severity vulnerability (ReDoS + method injection)
74
+ - Unused imports and variables across codebase (ESLint cleanup)
75
+
76
+ ### Security
77
+ - Resolved picomatch 4.0.0-4.0.3 vulnerability via npm audit fix
78
+ - Added `npm audit --audit-level=high` to CI pipeline
79
+
80
+ ## [0.3.0] - 2026-03-14
81
+
82
+ ### Added
83
+
84
+ - `what_if` MCP tool for hypothetical pricing scenarios (change instance types, regions, commitment levels; see cost delta without modifying Terraform)
85
+ - Multi-currency support on `estimate_cost`, `compare_providers`, `what_if`: USD, EUR, GBP, JPY, CAD, AUD, INR, BRL
86
+ - Spot/preemptible instance pricing model via `CLOUDCOST_PRICING_MODEL` or per-scenario in `what_if`
87
+ - Cost projections over 3/6/12/36-month horizons with reserved instance comparisons (`src/calculator/projection.ts`)
88
+ - Tag-based cost attribution and `group_by` report option for grouping by team, environment, or any resource tag
89
+ - Budget alerts via `CLOUDCOST_BUDGET_MONTHLY`, `CLOUDCOST_BUDGET_PER_RESOURCE`, `CLOUDCOST_BUDGET_WARN_PCT`
90
+ - Terraform module expansion: referenced modules (`source = "..."`) resolved during parsing; controlled by `CLOUDCOST_RESOLVE_MODULES`
91
+ - Resource dependency graph via `include_dependencies` option on `analyze_terraform`
92
+ - OpenTofu `.tofu` file support alongside `.tf` files
93
+ - Data transfer cost integration (inter-region and internet egress) via `CLOUDCOST_INCLUDE_DATA_TRANSFER`
94
+ - FOCUS-compliant export format. Pass `format: "focus"` to `compare_providers`
95
+ - Live GCP Cloud Billing Catalog API client with automatic fallback to bundled data
96
+ - Container Registries, Secrets Management, and DNS resource types across all three providers
97
+ - GitHub Actions composite action for posting cost estimates as PR comments
98
+ - `currency` input on the GitHub Actions composite action
99
+
100
+ ### Changed
101
+
102
+ - GCP pricing now attempts the live Cloud Billing Catalog API first and falls back to bundled data; `pricing_source` reflects `"live"` or `"bundled"` accordingly
103
+ - `compare_providers` `format` parameter now accepts `focus` in addition to `markdown`, `json`, and `csv`
104
+ - `analyze_terraform` `include_dependencies` option now returns a full dependency adjacency list alongside the resource inventory
105
+
106
+ ### Fixed
107
+
108
+ - Variable references that were not resolved when a `terraform.tfvars` file contained complex expressions are now handled with a safe fallback rather than surfacing a parse error
109
+ - Concurrent pricing fetches for the same AWS region no longer trigger duplicate CSV downloads; a single in-flight request is now shared across callers
110
+
111
+ ## [0.1.0] - 2026-03-09
112
+
113
+ ### Added
114
+
115
+ - Six MCP tools exposed over stdio: `analyze_terraform`, `estimate_cost`, `compare_providers`, `get_equivalents`, `get_pricing`, and `optimize_cost`
116
+ - Multi-cloud cost analysis across AWS, Azure, and GCP from a single Terraform codebase
117
+ - HCL/Terraform parsing via `@cdktf/hcl2json` with full variable resolution, including `terraform.tfvars` support
118
+ - Real-time pricing from public APIs with no API keys or cloud credentials required (AWS Bulk Pricing CSV/JSON, Azure Retail Prices REST API)
119
+ - Streaming ingestion of the AWS EC2 bulk pricing CSV (~267 MB) line-by-line to avoid loading the full file into memory; all on-demand prices for a region are extracted in one pass
120
+ - Bundled GCP pricing data covering Compute Engine, Cloud SQL, Cloud Storage, Persistent Disk, and infrastructure services across all major regions
121
+ - Graceful fallback to built-in pricing tables with size-interpolation when live sources are unavailable; every price includes a `pricing_source` field (`live`, `fallback`, or `bundled`) for transparency
122
+ - SQLite-backed pricing cache (`better-sqlite3`) at `~/.cloudcost/cache.db` with a configurable TTL (default 24 hours), shared across all tools per server lifetime
123
+ - Cross-provider resource and instance type mapping covering 70+ AWS instance types (including Graviton/ARM families), 40+ Azure VM sizes, and 20+ GCP machine types with full bidirectional lookup
124
+ - Support for five resource categories: compute, database, storage, networking, and Kubernetes, across all three providers
125
+ - Reserved instance and savings plan pricing analysis within the `optimize_cost` tool alongside right-sizing and cross-provider switching recommendations
126
+ - Cost reports in Markdown, JSON, and CSV formats with per-resource monthly and yearly breakdowns and confidence scores
127
+ - Three-layer configuration system: built-in defaults → `~/.cloudcost/config.json` → `CLOUDCOST_*` environment variables
128
+ - ESM-only package targeting Node.js 20+, built with `tsup` and tested with `vitest`
package/MIGRATION.md ADDED
@@ -0,0 +1,40 @@
1
+ # Migration Guide
2
+
3
+ ## 0.x → 1.0
4
+
5
+ **There are no breaking API changes.** v1.0 ratifies the existing v0.5 surface as stable under [Semantic Versioning](https://semver.org/). If your integration works on v0.5.x it will work on v1.0.0 without modification.
6
+
7
+ ### What's new in 1.0
8
+
9
+ - Formal stability contract — see [`STABILITY.md`](./STABILITY.md).
10
+ - Security advisories in transitive dependencies (hono, `@hono/node-server`, path-to-regexp, vite) resolved via npm overrides.
11
+ - Smoke integration tests against live provider pricing APIs, runnable via `RUN_INTEGRATION=1` and scheduled weekly in CI.
12
+ - Hardened npm publish workflow (tests + audit gate releases).
13
+
14
+ ### Locked-in public surface
15
+
16
+ The following are now SemVer-locked. Any breaking change to them requires a 2.0.
17
+
18
+ - MCP tools: `analyze_terraform`, `estimate_cost`, `compare_providers`, `get_equivalents`, `get_pricing`, `optimize_cost`, `what_if`, `analyze_plan`, `compare_actual`, `price_trends`, `detect_anomalies`
19
+ - CLI binaries: `cloudcost-mcp`, `cloudcost`
20
+ - Node engines: `>=20.0.0`
21
+
22
+ ### Node.js
23
+
24
+ Node 20 remains the minimum. No change from v0.5.
25
+
26
+ ### Support policy going forward
27
+
28
+ - Latest minor: security + bug fixes.
29
+ - Previous minor: security fixes only, 6 months after a new minor ships.
30
+ - Deprecations: a tool or input field marked deprecated in a minor must stay for at least one more minor before removal in the next major.
31
+
32
+ ### Pinning
33
+
34
+ Once on v1.0 you can safely pin with a caret range:
35
+
36
+ ```json
37
+ "@jadenrazo/cloudcost-mcp": "^1.0.0"
38
+ ```
39
+
40
+ This accepts bugfixes, pricing refreshes, and additive features, and will not pull in breaking changes.
package/STABILITY.md ADDED
@@ -0,0 +1,71 @@
1
+ # Stability Policy
2
+
3
+ Starting with v1.0.0, CloudCostMCP follows [Semantic Versioning](https://semver.org/). This document defines the **stable public surface** covered by that guarantee — changes to anything listed here are breaking and require a major version bump.
4
+
5
+ ## Stable surface (SemVer-locked)
6
+
7
+ ### MCP tools
8
+
9
+ The following 11 tools and their input schemas are locked. Their names, required fields, and the type shape of their output are stable. See `src/tools/*.ts` for the Zod schemas.
10
+
11
+ | Tool | Purpose |
12
+ | ------------------- | ------------------------------------------------------------------------- |
13
+ | `analyze_terraform` | Parse Terraform HCL and extract a resource inventory |
14
+ | `estimate_cost` | Estimate monthly/yearly cost for a Terraform resource set on one provider |
15
+ | `compare_providers` | Full multi-cloud cost comparison with savings analysis |
16
+ | `get_equivalents` | Map Terraform resource types and instance sizes across providers |
17
+ | `get_pricing` | Direct pricing lookup for a service/resource/region |
18
+ | `optimize_cost` | Right-sizing and reserved-pricing recommendations |
19
+ | `what_if` | Scenario cost modeling without modifying source files |
20
+ | `analyze_plan` | Cost-of-change analysis from a Terraform plan JSON |
21
+ | `compare_actual` | `.tfstate` vs planned cost drift detection |
22
+ | `price_trends` | Historical pricing trend query |
23
+ | `detect_anomalies` | Budget and concentration-risk anomaly detection |
24
+
25
+ ### CLI
26
+
27
+ The `cloudcost-mcp` and `cloudcost` binaries and their documented flags in the README are stable.
28
+
29
+ ### Package entry points
30
+
31
+ - `main`: `dist/index.js`
32
+ - `types`: `dist/index.d.ts`
33
+ - `bin`: `cloudcost-mcp`, `cloudcost`
34
+ - Node engine: `>=20.0.0`
35
+
36
+ ## Not stable (may change in any release)
37
+
38
+ - Internal parser implementations under `src/parsers/`
39
+ - Pricing adapter internals under `src/pricing/aws`, `src/pricing/azure`, `src/pricing/gcp`
40
+ - The on-disk SQLite cache schema (cache is rebuilt on upgrade)
41
+ - Bundled fallback pricing tables under `data/`
42
+ - Log line format and log levels
43
+ - Exit codes beyond `0` (success) and `1` (failure)
44
+ - Benchmark scripts and unreleased helper modules
45
+
46
+ ## Change classification
47
+
48
+ | Change | Bump |
49
+ | ------------------------------------------------ | ----- |
50
+ | Remove or rename a tool | Major |
51
+ | Remove a required input field from a tool schema | Major |
52
+ | Change the type of an existing output field | Major |
53
+ | Raise the minimum Node.js version | Major |
54
+ | Add a new tool | Minor |
55
+ | Add an optional input field | Minor |
56
+ | Add a new output field | Minor |
57
+ | Add a new provider/region/resource | Minor |
58
+ | Bugfix | Patch |
59
+ | Performance improvement | Patch |
60
+ | Pricing data refresh | Patch |
61
+ | Dependency bump without API change | Patch |
62
+
63
+ ## Deprecation
64
+
65
+ Before a tool or field is removed in a future major, it will be marked deprecated in its description for at least one minor release, with the replacement documented in `CHANGELOG.md`.
66
+
67
+ ## Support policy
68
+
69
+ - The latest minor line receives security and bug fixes.
70
+ - The previous minor line receives security fixes only, for 6 months after the next minor is released.
71
+ - CVE reports: see `SECURITY.md`.
@@ -0,0 +1,8 @@
1
+ {
2
+ "last_updated": "2026-04-15",
3
+ "source": "https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws",
4
+ "sku_count": 142,
5
+ "refresh_script_version": "2.0.0",
6
+ "currency": "USD",
7
+ "notes": "Written by scripts/refresh-pricing.ts --write"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "last_updated": "2026-04-15",
3
+ "source": "https://prices.azure.com/api/retail/prices",
4
+ "sku_count": 70,
5
+ "refresh_script_version": "2.0.0",
6
+ "currency": "USD",
7
+ "notes": "Written by scripts/refresh-pricing.ts --write"
8
+ }
@@ -1,6 +1,8 @@
1
1
  {
2
- "last_updated": "2026-04-11",
2
+ "last_updated": "2026-04-15",
3
3
  "source": "Google Cloud Pricing Calculator",
4
4
  "currency": "USD",
5
- "notes": "Bundled pricing data for offline/zero-auth usage"
5
+ "notes": "Bundled pricing data for offline/zero-auth usage",
6
+ "refresh_script_version": "2.0.0",
7
+ "sku_count": 1197
6
8
  }