Skip to main content
Glama
hwc-calculator

hwc-calculator

by araujoviana

autocalc

CLI and MCP server for pricing, validating, and publishing verified quotes on the Huawei Cloud Pricing Calculator.

Installation & Update

Linux / macOS:

curl -fsSL https://raw.githubusercontent.com/araujoviana/autocalc/main/install.sh | sh

Windows (PowerShell):

irm https://raw.githubusercontent.com/araujoviana/autocalc/main/install.ps1 | iex

Update to the latest release at any time:

autocalc update

(From a local git clone, run ./install.sh directly).

Browser automation uses system Chrome/Edge by default. On headless servers without a browser: autocalc install-browser.


Related MCP server: Huawei MCP Server

Quick Reference

1. Catalog & Pricing (No auth required)

# Verify environment and calculator endpoint reachability
autocalc doctor

# Query available regions and flavors
autocalc regions ecs
autocalc search ecs "Sao Paulo" linux --vcpus 4 --mem 8 --billing monthly

# Price resources directly
autocalc quote Santiago 'ecs:c7n.large.2.linux*3' 'ecs:SSD*3@100' --billing monthly

2. Declarative Quotes (quote.yaml)

Preferred version: "1" syntax (legacy cards: manifests are also accepted):

version: "1"
metadata:
  id: web-tier-example
  customer: Example Corp
  title_prefix: "[autocalc] web-tier"
defaults:
  region: sa-brazil-1
  billing: monthly
resources:
  - id: web
    service: ecs
    quantity: 2
    needs: { vcpus: 4, memory: "8 GiB" }
    options: { os: ubuntu-22.04 }
# Validate schema, resolve SKUs, write quote.lock.yaml
autocalc plan quote.yaml

# One-time browser login (required only for saving/publishing quotes)
autocalc login

# Encode cards in headless browser, verify price integrity, and output share link
autocalc apply quote.yaml

3. Inspect & Export

# Verify stored vs. rated prices for an existing quote link
autocalc validate <shareListId_or_URL>

# Export shared lists to Excel
autocalc export --rows '[{"env":"prod","list":"<url_or_id>"}]' --path quotes.xlsx

MCP Server (autocalc-mcp)

Connect AI agents via stdio:

claude mcp add hwc-calculator -- autocalc-mcp

Or configure manually in mcp.json:

{
  "mcpServers": {
    "hwc-calculator": {
      "command": "autocalc-mcp"
    }
  }
}

CLI Commands

Command

Description

Auth Required

autocalc services [query]

List calculator services, optionally filtered by keyword

No

autocalc regions [service]

List all regions or regions where a service is sold

No

autocalc describe <service>

Show available billing modes and catalog groups

No

autocalc search <service> <region> [terms...]

Search SKUs with filters (--billing, --vcpus, --mem)

No

autocalc quote <region> <items...>

Price items directly in USD (--currency for FX)

No

autocalc compare-modes --items <json|@file>

Compare on-demand, monthly, and yearly pricing

No

autocalc compare-regions --items <json|@file>

Compare item pricing across multiple regions

No

autocalc plan [file]

Validate quote YAML against schemas and write lockfile

No

autocalc apply [file]

Encode cards, verify publish gate, and return share link

Yes

autocalc export --rows <json|@file>

Generate .xlsx summary workbook from shared lists

No

autocalc validate <url_or_id>

Check shared list for arithmetic or schema discrepancies

No

autocalc edit-check <url_or_id>

Compare stored card prices against headless Edit view

No

autocalc login / logout / auth status

Manage browser authentication profiles

—

autocalc lists / rename / delete

Manage saved price lists in your account

Yes

autocalc doctor

Check endpoints, version drift, browser, and cache

No

Full reference: CLI Reference.


Configuration

Variable

Default

Description

AUTOCALC_PROFILE

default

Named authentication profile for browser sessions

AUTOCALC_CONFIG

~/.config/autocalc

Directory for configuration and update-check state

AUTOCALC_DATA

~/.local/share/autocalc

Directory for drafts, run records, and browser auth profiles

AUTOCALC_CACHE

~/.cache/autocalc

Directory for 24h catalog cache

AUTOCALC_BROWSER

Auto-detected

Custom path to Chrome/Chromium binary

AUTOCALC_ENCODE_WORKERS

Auto (<= 3, 1–16)

Concurrency for headless browser encoding (apply / publish)

AUTOCALC_EDIT_WORKERS

Auto (<= 3, 1–16)

Concurrency for headless Edit-view verification

AUTOCALC_NO_UPDATE_CHECK

0

Set to 1 to disable daily update notices


Development

bun install --frozen-lockfile
bun run check            # Typecheck (tsc --noEmit)
bun run check:boundaries # Verify architecture layer boundaries
bun run test:offline     # Unit and integration tests (deterministic, offline)
bun run test:live        # Live tests against calculator endpoints
bun run bench            # Run offline loopback benchmark suite
bun run bench:report     # Generate self-contained bench/dashboard.html

Detailed documentation: Code Architecture · docs/ · CLI Reference · ADRs.

License

Apache 2.0

Available Tools

20 tools
auth_loginA

Open a browser window so the user can sign in once.

Waits up to wait_seconds. If the user is still signing in, returns waiting: true and the sign-in carries on for up to 5 minutes: tell the user to finish, then call auth_status. Use when a write tool returns AUTH_EXPIRED. Read-only tools (catalog, quote, read_price_list) never need this.

Inputs: wait_seconds.

auth_statusA

Whether the browser profile is signed in (account mask, browser, cookie names). Read-only tools never need it.

Inputs: no named parameters.

compare_modesB

Compare the same bill of materials across billing modes.

items are quote items ([{service, spec, quantity, size, usage_*}]). Returns the cost per mode and the saving vs on-demand. Modes: ondemand, monthly, yearly.

Inputs: items (required), modes, region, currency.

compare_regionsC

Price the same bill of materials in several regions. Friendly names accepted.

Inputs: items (required), regions (required), billing.

convert_currencyA

Convert a USD amount using Huawei Cloud's own published exchange rate (e.g. BRL, EUR).

Inputs: currency (required), amount_usd (required).

delete_price_listA

Delete a saved price list by url or id. Needs a login. Confirm with the user before calling; this cannot be undone.

Inputs: url_or_id (required).

describe_serviceA

What a service supports in a region: modes, groups and a sample of specs.

Use before building a list, so the agent knows the valid options for that region.

Inputs: service (required), region.

draft_quoteA

Start a quote. Each requirement: {"id","service","region","billing":"ondemand|monthly|yearly", "quantity"?,"needs"?:{"vcpus":4,"memory_gb":16},"spec"?, "options"?:{the service's options, listed by supported_services}}.

Exact matches are confirmed automatically; for the others show the candidates to the user and call revise_quote. Nothing is saved on the website. Sizes in GB, bandwidth in Mbit/s.

Inputs: customer (required), requirements (required). Returns: object

duplicate_price_listB

Copy a saved price list (optionally with a new name). Needs a login.

Inputs: url_or_id (required), new_name.

export_quotes_xlsxA

Write a workbook of price lists, one row per environment, on four sheets: Quotes (environment, list name, total USD, link), Decisions (what was chosen and why), Resources (every priced resource) and Totals (instances, vCPUs, RAM, storage).

rows: [{"env": "prod", "list": share url or id, "draft_id"?: id}], kept in this order. A list saved by publish_quote finds its decisions by itself; "draft_id" is for any other. Reads the lists anonymously. path must end in .xlsx and is overwritten. Nothing is written if any list cannot be read.

Inputs: rows (required), path.

list_my_price_listsA

List the saved price lists on the user's calculator account (name, id, url, total). Needs a login.

Inputs: no named parameters.

list_regionsA

Region ids -> display names. With service, only regions where it is sold.

Other tools take friendly names ('Santiago') directly, so there is nothing to resolve here.

Inputs: service.

list_servicesA

List Huawei Cloud services that have a price calculator (service id, name, category).

Use the returned service id (e.g. 'ecs', 'rds', 'obs', 'cce') in the other tools. query filters by substring on id/name/category.

Inputs: query. Returns: result

publish_quoteA

Publish a fully decided draft: builds the cards, saves the list, verifies it on the website and returns the link.

Needs a login (auth_login). Confirm the totals with the user first. A failed check deletes the list.

Inputs: name (required), draft_id (required), currency, settlement. Returns: object

quoteA

Price a bill of materials with Huawei Cloud's official rating engine (USD).

items: [{service, spec, quantity=1, size=None, usage_factor=None, usage_value=None}]

  • spec comes from search_skus; size is capacity in GB for disks/volumes.

  • usage_value for usage-billed items (OBS storage GB, traffic GB, requests). billing='ondemand' prices hours (730 = one month); 'monthly'/'yearly' price periods months/years and include the official yearly discount.

Inputs: items (required), region (required), hours, billing, +1 more.

read_price_listA

Read any shared price list by url or id (anonymous; works for links others send).

Returns a normalized summary: one row per item (service, spec, mode, quantity, price).

Inputs: url_or_id (required).

rename_price_listC

Rename a saved price list. Needs a login.

Inputs: new_name (required), url_or_id (required).

revise_quoteC

Record the user's choices: decisions = [{"requirement_id","spec","justification"}]. Returns what is still pending.

Inputs: draft_id (required), decisions (required). Returns: object

search_skusB

Search the official price list of a service in a region. Sorted cheapest first.

region accepts a friendly name ('Sao Paulo'). query terms must all appear in spec/description. Returns spec codes with the list price per billing mode (USD; ondemand per hour, monthly per month, yearly per year).

Inputs: region (required), service (required), limit, query, +3 more.

supported_servicesB

The capability matrix: which services autocalc can build a saved list for, and their modes.

Inputs: no named parameters. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 20 tools

    Disambiguation4/5

    Catalog-related tools (list_services, supported_services, describe_service, search_skus) all touch service discovery but at different levels, while quote/compare_modes/compare_regions and draft_quote/revise_quote/publish_quote are stage-specific. The boundaries are mostly clear, though an agent must rely on descriptions to choose between the catalog and capability tools.

    Naming Consistency4/5

    All names use snake_case with mostly verb_noun patterns such as list_services, create-style stage names, and delete_price_list. A few noun-only or status-style names (quote, supported_services, auth_status) are minor deviations, but the set is predictable overall.

    Tool Count3/5

    At 20 tools this is in the heavy borderline range. The broad workflow includes auth, catalog, quoting, saved lists, comparisons, currency conversion, and export, so most tools earn their place, but the surface feels large and some operations could potentially be consolidated.

    Completeness5/5

    The set covers service/region discovery, SKU search, pricing, draft/revise/publish quote lifecycle, saved list creation and management, anonymous shared list reading, billing/region comparisons, currency conversion, and Excel export. No major dead ends are apparent for the stated pricing calculator purpose.

    Maintenance

    ActivityActive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Provides AI assistants with real-time access to Azure retail pricing information, enabling price searches, regional cost comparisons, monthly bill estimates, and SKU discovery through natural language queries.
      13
      56
      MIT
    • A
      license
      Not graded
      quality
      F
      maintenance
      Enables AI assistants to operate Huawei Cloud resources (ECS, OBS, GaussDB, etc.) through conversational workflows via the Model Context Protocol.
      36 PyPI
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to parse multi-cloud infrastructure-as-code files, query real-time pricing from AWS, Azure, and GCP, and generate cost estimates and comparison reports.
      46 npm
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Provides Oracle Cloud Infrastructure pricing data to AI assistants, enabling cost estimation, shape comparison, and real-time pricing queries.
      45
      71 npm
      5
      Apache 2.0