Skip to main content

ratebook-mcp

MCP server exposing the Ratebook tariff database and rate engine to apps, devices, and agents. It answers "what will this kWh cost me, and when should I charge?" over the loaded corpus (data/ratebook.duckdb) and the deterministic ratebook engine.

mcp-name: io.github.cbetz/ratebook

Tools

Tool What it does
lookup_tariff(query, sector, active_only, limit) Find tariffs by utility name, EIA id, or label — freshest first, with provenance (source URL, effective date, last update) and whether the engine can fully price each.
estimate_bill(label, start_date, days, total_kwh | hourly_kwh) Price one tariff over a billing window. total_kwh suffices for flat/tiered/seasonal plans; time-of-use plans need hourly_kwh (length days*24). Returns the full result, with a typed refusal when it can't be priced.
compare_plans(labels, start_date, days, total_kwh | hourly_kwh) Price several tariffs over the same usage and rank cheapest-first; unpriceable plans are listed with their refusal.
best_charge_window(label, start_date, days, charge_hours, kwh_to_add) The cheapest contiguous block to add load (e.g. EV charging), using the tariff's time-of-use marginal price signal.

Every Decimal is returned as a string (the engine's canonical wire form), so responses are directly JSON-serializable. "Unknown" is a first-class answer: an unpriceable plan returns a typed refusal, never a wrong number.

Run

uv run ratebook-data urdb     # build data/ratebook.duckdb first (once)
uv run ratebook-mcp           # stdio MCP server

Set RATEBOOK_DB to point at a corpus elsewhere. Register with an MCP client (e.g. Claude Desktop / Code) as a stdio server running ratebook-mcp from a directory containing the DB:

{
  "mcpServers": {
    "ratebook": { "command": "uv", "args": ["run", "ratebook-mcp"], "cwd": "/path/to/ratebook" }
  }
}

The logic lives in ratebook_mcp.service (unit-testable without a running server); server.py is the thin FastMCP binding.

Metadata

Release files for ratebook-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ratebook-mcp 0.1.0
File Size Uploaded
ratebook_mcp-0.1.0.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ratebook-mcp 0.1.0
File Interpreter ABI Platform
ratebook_mcp-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.3 kB

Release files / ratebook_mcp-0.1.0.tar.gz

Download URL ratebook_mcp-0.1.0.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
36f29d1339ec0d8219203fdfe829ea2bf19996ee2c4fa0a6fbe9cd2e70bc9a96
BLAKE2b-256 checksum
How to use checksums
72d6202fd5f7342317b65b75ad9062c02501b7c4db4921db0bec1be7efafd176
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release files / ratebook_mcp-0.1.0-py3-none-any.whl

Download URL ratebook_mcp-0.1.0-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53229d512bf274b2f69032fdb5e0aac2bf23ad1bb1960208980f29a799dc8fab
BLAKE2b-256 checksum
How to use checksums
2f874a817b5dad15bd3f53ee1a579dc99f502c6830eb3b97b9eb0bc71630802f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page