Direct HTTP fallback client for the European Parliament Open Data
Portal (https://data.europarl.europa.eu/api/v2/) โ specifically the
/decision endpoint that exposes roll-call voting records.
Why this exists (Defect D-02)
The EP MCP server tool get_voting_records relies on an EP feed that
publishes roll-call data with a 4โ6 week delay (documented limitation,
see .github/prompts/07-mcp-reference.md ยง11 item #6). That lag can
leave the most recent voting window empty in MCP even when the EP Open
Data Portal /api/v2/decision endpoint already exposes the underlying
roll-call records directly. This client therefore queries that endpoint
whenever the MCP layer returns an empty votes array, improving freshness
without limiting the fallback to older date ranges.
Uses the native Node 25 fetch() โ no extra runtime dependency.
Every call has an independent AbortController with a configurable
timeout (EP_OPEN_DATA_TIMEOUT_MS, default 30 s).
Errors (HTTP 4xx/5xx, network faults, JSON parse failures, abort) are
caught and converted to an empty-votes envelope matching the MCP fallback
shape, so consumers that already expect response.content[0]?.text to
hold a JSON blob keep working without change.
Attribution
All data returned by this client originates from the EP Open Data Portal
which is published under the CC BY 4.0 licence. Every fallback response
includes a _attribution field with the canonical citation string.
Environment variables:
EP_OPEN_DATA_BASE_URL โ override base URL (default
https://data.europarl.europa.eu/api/v2).
Description
Direct HTTP fallback client for the European Parliament Open Data Portal (
https://data.europarl.europa.eu/api/v2/) โ specifically the/decisionendpoint that exposes roll-call voting records.Why this exists (Defect D-02)
The EP MCP server tool
get_voting_recordsrelies on an EP feed that publishes roll-call data with a 4โ6 week delay (documented limitation, see.github/prompts/07-mcp-reference.mdยง11 item #6). That lag can leave the most recent voting window empty in MCP even when the EP Open Data Portal/api/v2/decisionendpoint already exposes the underlying roll-call records directly. This client therefore queries that endpoint whenever the MCP layer returns an empty votes array, improving freshness without limiting the fallback to older date ranges.Three-state fallback logic
Call getVotingRecordsWithFallback to execute the decision tree:
Transport
fetch()โ no extra runtime dependency.AbortControllerwith a configurable timeout (EP_OPEN_DATA_TIMEOUT_MS, default 30 s).response.content[0]?.textto hold a JSON blob keep working without change.Attribution
All data returned by this client originates from the EP Open Data Portal which is published under the CC BY 4.0 licence. Every fallback response includes a
_attributionfield with the canonical citation string.Environment variables:
EP_OPEN_DATA_BASE_URLโ override base URL (defaulthttps://data.europarl.europa.eu/api/v2).EP_OPEN_DATA_TIMEOUT_MSโ per-request timeout (default30000).