About wattprice
wattprice fetches Spain's regulated PVPC electricity prices from the ESIOS API. It is for querying prices by date range and geographical area, with optional time and area aggregation settings.
Key features
- 01Fetch PVPC prices as JSON
- 02Set date range and locale
- 03Choose time aggregation and truncation
- 04Select geographical areas and aggregation
Use cases
- 01Retrieve today's PVPC prices
- 02Query prices for a chosen date range
- 03Compare prices across Spanish electricity areas
- 04Request aggregated prices by hour or day
MCP support
Its MCP server provides a fetch_prices tool for retrieving PVPC prices by date range and geographical area. The ESIOS_API_KEY is required.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
Tools
1Saved tool list · updated 1w ago
| Parameter | Type | Required | Description |
|---|---|---|---|
| locale | enum | No | Translations for sources. Accepted values: es, en. Defaults to es.es | en |
| endDate | string | No | End of the date range, ISO 8601. Defaults to the end of today. |
| startDate | string | No | Beginning of the date range, ISO 8601 (e.g. 2025-06-29T00:00:00.000+02:00). Defaults to the start of today. |
| timeTruncation | enum | No | How to truncate data time series. Accepted values: hour, day, month, year.hour | day | month | year |
| geographicalIds | array | No | Geographical IDs to filter by. Accepted values: 3 (España), 8741 (Península), 8742 (Canarias), 8743 (Baleares), 8744 (Ceuta), 8745 (Melilla). Defaults to 8741, 8742, 8743, 8744, 8745. |
| timeAggregation | enum | No | How to aggregate indicator values when grouping by time. Accepted values: sum, average. Defaults to sum.sum | average |
| geographicalTruncation | enum | No | How to group data at geographical level when the geographical aggregation is informed. Accepted values: country, electric_system.country | electric_system |
| geographicalAggregation | enum | No | How to aggregate indicator values when grouping by geographical ID. Accepted values: sum, average. Defaults to sum.sum | average |
Details
From the project READMEwattprice
What does electricity cost right now under Spain's regulated PVPC tariff? wattprice asks the ESIOS API — the data service run by Red Eléctrica de España — for the PVPC (Voluntary Price for the Small Consumer) indicator and returns the prices payload as JSON, for a date range and geographical area you choose.
Everything except the API key itself is optional, with the defaults the upstream documents:
locale—es(default) orenstartDate/endDate— ISO 8601 bounds; an absent range means today, start to end of daytimeAggregation—sum(default) oraveragetimeTruncation—hour,day,month, oryeargeographicalAggregation—sum(default) oraveragegeographicalIds— string IDs:3España,8741Península,8742Canarias,8743Baleares,8744Ceuta,8745Melilla; defaults to the five system IDs 8741–8745geographicalTruncation—countryorelectric_system
Configuration
You bring your own ESIOS API key (free registration at esios.ree.es):
export ESIOS_API_KEY="your key"
Without it, wattprice does not guess: the call fails with an
error naming ESIOS_API_KEY, and no prices are invented.
ESIOS_API_BASE overrides the API base URL
(https://api.esios.ree.es by default).
CLI
ESIOS_API_KEY=... npx @reneturcios/wattprice prices
ESIOS_API_KEY=... npx @reneturcios/wattprice prices --locale en --time-truncation day --geographical-ids 8741
npx @reneturcios/wattprice --version
Output is the ESIOS prices payload as JSON. Exit codes: 0 on
success, 1 on a runtime error (including a missing key or a
non-200 upstream response), 2 on a usage error.
MCP server
npx -y @reneturcios/wattprice mcp
MCP client config:
{
"mcpServers": {
"wattprice": {
"command": "npx",
"args": ["-y", "@reneturcios/wattprice", "mcp"],
"env": { "ESIOS_API_KEY": "your key" }
}
}
}
Tools
fetch_prices— Fetch PVPC prices for a given date range and geographical area. All arguments are optional; see the defaults list above.
Docker
docker run -i -e ESIOS_API_KEY="your key" ghcr.io/cloudcorprecords/wattprice
docker run --rm -e ESIOS_API_KEY="your key" ghcr.io/cloudcorprecords/wattprice prices --locale en
Development
npm install
npm run build # tsc -> dist/
npm test # tsx --test test/*.test.ts (fake fetch, no network)
npm run dev # run the CLI from source
License
MIT — Copyright (c) 2026 Rene Turcios
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.