Skip to main content

MCP server exposing the Ratebook tariff database and rate engine to agents.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ratebook_mcp-0.1.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ratebook_mcp-0.1.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file ratebook_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: ratebook_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for ratebook_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 36f29d1339ec0d8219203fdfe829ea2bf19996ee2c4fa0a6fbe9cd2e70bc9a96
MD5 e24b655a1f0c213b38ec470dec3f2a96
BLAKE2b-256 72d6202fd5f7342317b65b75ad9062c02501b7c4db4921db0bec1be7efafd176

See more details on using hashes here.

File details

Details for the file ratebook_mcp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ratebook_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 53229d512bf274b2f69032fdb5e0aac2bf23ad1bb1960208980f29a799dc8fab
MD5 827a0666a3279297ca409dac2f6b4da6
BLAKE2b-256 2f874a817b5dad15bd3f53ee1a579dc99f502c6830eb3b97b9eb0bc71630802f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page