mcp-elections-canada
by pipeworx-io
README.md
# @pipeworx/elections-canada
Official poll-by-poll results for Canadian federal electoral districts in the 45th general election (28 April 2025): votes by candidate and party for every polling division, with district totals and the elected candidate.
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 2075+ live data sources. This is an independent, unofficial integration — not affiliated with, endorsed by, or published by the upstream provider.
## Tools
- `elections_canada_districts({ query, province? })` -- find a riding and its 5-digit district number by name fragment, optionally within a province or territory.
- `elections_canada_poll_results({ district, poll?, limit?, offset? })` -- per-polling-division valid votes by candidate (with party), rejected ballots and electors, plus district totals. Paged.
## Auth
Keyless.
## Data sources
- Elections Canada, Official Voting Results (raw data), 45th general election -- the agency's published poll-by-poll results, one file per electoral district. Human-facing page: the Elections Canada results section of its website.
## Gotchas
- Each call reads the district list and, for poll results, one district's results from the publisher live; nothing is stored, so a call needs the publisher to be reachable.
- Results are the official voting results as published by Elections Canada, dated 12 November 2025 on the publisher page. Other elections (2021 and earlier) and provincial or municipal elections are not covered.
- Polling division numbers are strings, not integers: "45A" and "48-3" occur. Advance and special polls appear as their own divisions.
- A poll can be flagged void, "no poll held", or combined with another poll's number; those flags are returned as-is and their votes may be zero by design.
- District names use dashes ("Ottawa-Vanier-Gloucester") and accents ("Beauport-Limoilou", "Quebec"); matching ignores accents and dashes. An ambiguous name returns `found: false` with candidates; pass the 5-digit number.
- The results file is UTF-8 with a byte-order mark and quoted fields containing commas; the parser strips the mark and handles quoting.
## Quick Start
Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
```json
{
"mcpServers": {
"elections-canada": {
"url": "https://gateway.pipeworx.io/elections-canada/mcp"
}
}
}
```
### What this endpoint actually serves
`tools/list` at `https://gateway.pipeworx.io/elections-canada/mcp` returns the tools in the table
above **plus five Pipeworx tools**: `ask_pipeworx`, `discover_tools`, `ask_pipeworx_grounded`, `company_register_search` and `company_facts`.
`ask_pipeworx` answers a question this pack does not cover by routing across the
whole catalog, without adding a second MCP server.
Add an option to the same URL:
- `https://gateway.pipeworx.io/elections-canada/mcp?meta=1` lists this pack's tools plus **up to 48 shared Pipeworx tools** (48 when this README was
generated; a connection without an account lists fewer, and its own `tools/list` is the
exact answer on any given day).
- `https://gateway.pipeworx.io/elections-canada/mcp?meta=0` lists this pack's tools alone.
Or connect to the full Pipeworx gateway to get every pack's tools listed
directly, instead of just this one's:
```json
{
"mcpServers": {
"pipeworx": {
"url": "https://gateway.pipeworx.io/mcp"
}
}
}
```
Both URLs reach the same gateway and the same 2075+ data sources. The
only difference is which pack's tools are listed **directly**; `ask_pipeworx`
reaches all of them from either one (it is not listed on a `?meta=0` connection).
## No MCP client? Call it over HTTP
```bash
curl -X POST https://gateway.pipeworx.io/v1/tools/elections_canada_districts \
-H 'Content-Type: application/json' \
-d '{"query":"Ottawa"}'
```
No account needed for the first calls. Inspect any tool: `GET https://gateway.pipeworx.io/v1/tools/elections_canada_districts`. Find one: `POST https://gateway.pipeworx.io/v1/tools/search_packs` with `{"query":"..."}`.
## Run it from npm
`@pipeworx/mcp-elections-canada` is a local stdio bridge to the Pipeworx gateway: your MCP client
starts it with `npx`, and it forwards every call to the same
`https://gateway.pipeworx.io/elections-canada/mcp` endpoint shown above. It needs network access;
there is no offline mode.
```json
{
"mcpServers": {
"elections-canada": {
"command": "npx",
"args": ["-y", "@pipeworx/mcp-elections-canada"]
}
}
}
```
Without a key it calls anonymously, capped at 50 calls a day. A free account
raises that to 200 a day: get a key at https://pipeworx.io/signup and add
`"env": { "PIPEWORX_API_KEY": "<your key>" }` to the server entry.
The key is sent as a Bearer token, the same way a hosted connection sends it,
so calls are metered and billed exactly as they are there.
It lists **only** this pack's tools by default. Set `PIPEWORX_META_TOOLS=1` to
also list `ask_pipeworx` and the other gateway-wide tools.
Behind an HTTPS proxy: Node's built-in `fetch` does not read `HTTPS_PROXY` by
default. Newer Node releases honour it when `NODE_USE_ENV_PROXY=1` is set; check
your Node version's documentation.
## Using with ask_pipeworx
Instead of calling tools directly, you can ask questions in plain English —
this works on the pack endpoint above as well as on the full gateway:
```
ask_pipeworx({ question: "your question about Elections Canada data" })
```
The gateway picks the right tool and fills the arguments automatically.
## More
- [Docs and guides](https://pipeworx.io/docs)
- [pipeworx.io](https://pipeworx.io)
## License
MIT
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues