Skip to main content
Glama
README.md
# wattbudget

Nineteen everyday calculators for Korea, Taiwan, the Philippines and Japan, reachable from your MCP client without opening nineteen web pages. wattbudget is a small forwarding client for the hosted kwhmate MCP service: the tool list is answered from your own machine using captured definitions, and each call travels upstream, with the service's estimate handed back exactly as it arrived — source citation and page URL included.

Every tool is a compute-only estimator over figures you supply. Household electricity bills under the KEPCO, Taipower, Meralco and TEPCO tariffs, and what swapping bulbs for LEDs saves under each of them. Seoul and Busan taxi meter estimates. A Korean tourist VAT refund estimate from your receipt amounts. Study conversions: CSAT standard scores and grades, high-school class rank to naesin grade, and GPA scale conversion between 4.5, 4.3 and 4.0. Money estimates: a student loan repayment schedule (standard or income-contingent — an estimate of a schedule, not a loan application; nothing is submitted or originated), an education expense tax credit, the cash actually needed for a Korean "gap" investment (an acquisition-tax and brokerage arithmetic estimate, not a trade), a statutory report-reward estimate, and a Korea domestic travel budget across transport, stay, food and admissions.

## The tools

Electricity and LED savings:

- **`kr_electricity`** — Korea household bill under KEPCO residential low-voltage progressive tiers, from monthly `kwh`, with a summer tier option.
- **`kr_led_savings`** — Korea LED replacement savings, priced either by the household progressive tiers or by a shop unit price. All inputs optional.
- **`tw_electricity`** — Taiwan bill under Taipower residential progressive rates, with summer and bimonthly options.
- **`tw_led_savings`** — Taiwan LED savings under the non-summer monthly brackets. All inputs optional.
- **`ph_meralco`** — Philippines Meralco residential bill for this month's rate, from monthly `kwh`.
- **`ph_led_savings`** — Philippines LED savings at Meralco rates. All inputs optional.
- **`jp_electricity`** — Japan bill under TEPCO Juryo Dento B, with contract amperage and fuel-cost adjustment.
- **`jp_led_savings`** — Japan LED savings under TEPCO Juryo Dento B at 30 A. All inputs optional.

Taxis, refunds and rewards:

- **`seoul_taxi`** — Seoul regular mid-size taxi meter estimate from distance `km`, slow-traffic minutes and departure hour.
- **`busan_taxi`** — Busan regular mid-size taxi meter estimate, same shape.
- **`korea_tax_refund`** — Korean tourist VAT refund estimate from an `amounts` array of per-receipt KRW totals.
- **`report_reward`** — Korean report / whistleblower reward estimate (tax evasion, hidden assets, card refusal, public interest, corruption) from a base `amount`.

Study:

- **`suneung_score`** — CSAT (수능) standard score and grade from raw score, mean, standard deviation or percentile. All inputs optional.
- **`naesin_grade`** — Korean high-school class rank to grade (내신 등급) in the 5- or 9-grade system, from `rank` and `students`.
- **`gpa_converter`** — GPA proportional conversion between the 4.5, 4.3 and 4.0 scales, from a `score`.
- **`student_loan`** — Korean student loan repayment estimate, standard or income-contingent (ICL). All inputs optional.
- **`education_tax_credit`** — Korean education expense tax credit estimate from an `items` array of `{kind, spend}` entries.

Property and travel:

- **`gap_investment`** — Cash needed for a Korean "gap" investment: purchase `price` minus the jeonse deposit, plus acquisition tax and brokerage.
- **`travel_budget`** — Korea domestic trip budget ranges for transport, stay, food and admissions between Korean cities. All inputs optional.

Several tools take no required arguments at all — the LED savings calculators, `suneung_score`, `student_loan` and `travel_budget` carry an explicit empty `required: []` in the captured surface, and wattbudget serves that verbatim.

## Install and run

As an MCP server via npm:

```bash
npx -y @reneturcios/wattbudget mcp
```

MCP client configuration:

```json
{
  "mcpServers": {
    "wattbudget": {
      "command": "npx",
      "args": ["-y", "@reneturcios/wattbudget", "mcp"]
    }
  }
}
```

As a container:

```bash
docker run -i ghcr.io/cloudcorprecords/wattbudget
docker run --rm ghcr.io/cloudcorprecords/wattbudget kr_electricity '{"kwh":300}'
```

## CLI

A single binary covers both the command line and the MCP server. Every tool is a subcommand whose one argument is a JSON string of that tool's inputs:

```bash
wattbudget kr_electricity '{"kwh":300,"season":"summer"}'
wattbudget seoul_taxi '{"km":12.5,"hour":23}'
wattbudget korea_tax_refund '{"amounts":[150000,80000]}'
wattbudget travel_budget '{}'
wattbudget --version
```

Exit codes: `0` for a successful forwarded call, `1` when the result that comes back is an error, and `2` for usage mistakes like an unknown subcommand or a JSON argument that does not parse.

## Configuration

- `KWHMATE_MCP_URL` — Replaces the upstream endpoint. Defaults to the pinned hosted endpoint, `https://kwhmate.com/api/mcp`. (This override variable is a reconstruction introduced by this rebuild.)

The kwhmate registry record lists no headers for its remote, so wattbudget never attaches an authentication header — every call goes upstream keyless.

When the upstream cannot answer — it returns a JSON-RPC error, answers with a non-2xx status, sends a body that cannot be read, or the request itself fails — the caller receives an error result whose text begins with `wattbudget error:`.

## How forwarding works

The first call of a process opens a session against the upstream: an `initialize` request (protocol version `2025-03-26`), a `notifications/initialized` notification, and then the `tools/call`. If the service issues an `Mcp-Session-Id` header during initialize, wattbudget repeats it on subsequent requests and keeps reusing that one session until the process ends. Replies are understood in both plain JSON and server-sent-events framing. Successful results are passed through untouched, `isError` flag and any extra fields included.

## Development

```bash
npm install
npm run build   # tsc -> dist/ (dist/cli.js is the bin)
npm test        # tsx --test test/*.test.ts — stubbed upstream, no network
npm run dev     # run the CLI from source
```

The suite compares the served tool list against the captured surface tool for tool (including the explicit empty `required: []` arrays), walks the session handshake and its reuse, proves no `Authorization` header is sent under any environment, and confirms that arguments travel upstream unchanged and results return unchanged.

## License

MIT — see `LICENSE`. Copyright (c) 2026 Rene Turcios.