canada-parliament-mcp-server
Public Hosted Server: https://canada-parliament.caseyjhand.com/mcp
Overview
Canadian federal parliamentary records from LEGISinfo, the House of Commons, and OpenParliament. Follow House and Senate bills through their stages and read each version's text, find current and former MPs, inspect recorded House divisions, and read indexed House Hansard speeches. Public sources require no API key.
Tools
Tool | Description |
| Search a session's official bills by title, number, chamber, type, status, or indexed MP sponsor |
| Read an official bill dossier: sponsor and chamber, stages, inter-chamber messages, Speaker's rulings and statements, bibliographic notices, reading milestones, divisions, publications, legislative summary, notes, web references, enacted statute citation, and links to earlier versions |
| Read one version of a bill as plain text from its official XML: introduction, headings, numbered sections, and schedules |
| Search the current House roster by name, riding, province, party, or postal code, a past Parliament's official roster, or OpenParliament's historical name index |
| Read a member profile, dated memberships, sponsored bills, and recent ballots with their division tallies |
| Search recorded House divisions by bill, result, document type, date, or subject |
| Read a division's official tally, party totals, and individual recorded ballots |
| Find indexed House speeches by speaker, bill debated or mentioned, date, and literal English or French text |
| Discover actual session coverage and source-specific filter vocabulary |
Related MCP server: @cyanheads/eu-parliament-mcp-server
Capability reference
canparl_search_bills tool
titleContains(matching ignores case, accents, dash and quote styles, and repeated whitespace),billCode,originatingChamber,billType,status, andsponsor, combined with AND;limit1–100 (default 10; values up to 10,000 clamp to 100 with a notice) with offset paginationBilingual titles, status, latest major stage, and royal assent date, with the exact filtered
totalandpagination.nextOffsetsponsortakes an OpenParliament slug,/politicians/path, or profile URL (member.slugfromcanparl_get_member, or anincludeFormersearch row), or a current MP'spersonId. A digit-only value equal to a currentpersonId, or its/politicians/<digits>/path or URL, resolves through the same verified crosswalk ascanparl_get_member;appliedFilters.sponsorNamenames the profile used. Any other digit-only value is an OpenParliament ID; when it is also a former MP'spersonId, a notice names both people and routes thatpersonIdtocanparl_get_memberSponsor results cover only OpenParliament's index (
sponsorCoverage: "openparliament_index"), which excludes Senators; a scan past ten 100-row pages fails assponsor_scan_incomplete
canparl_get_bill tool
billCodeand itssessionfromcanparl_search_bills; returns thesponsorwith affiliationtitleandchamber, House/Senate/royal-assent stages, House divisions (dateTimeis the LEGISinfo sitting date-time, not when the division was recorded), Senate vote records, publications, andstatute. Usesponsor.personIdforcanparl_get_memberwhensponsor.chamberisHouse.Also the Library of Parliament legislative
summaryand dossiernotesas plain text (each note link kept astext (href)), the six readingmilestonesas UTC instants converted from LEGISinfo's Ottawa-time clocks, and relatedwebReferences(press releases, background documents, costing notes) whose URLs are relayed as published, never fetchedinterChamberMessageslists the messages and amendment exchanges between the House and Senate, the record of whether the Senate amended the bill and how the House answered.similarBillslists earlier versions and related bills ascanparl_search_billsrows, newest session first, andreinstatementlinks the bill to the previous or next session's version when LEGISinfo records one (a bill reinstated by government motion carries no link;similarBillsstill lists its earlier version). Pass a returnedsessionandbillCodeback tocanparl_get_bill; eachpublicationsentry'sidis thepublicationIdforcanparl_get_bill_textspeakerRulingsandbibliographicNoticesreturn the rulings, statements, and bibliography indexed in LEGISinfo. Rulings include their chamber, sitting, Hansard number, Ottawa date-time, and any published links. Notices preserve the source citation, date wording, classification, and language ID.Above a 24,000-byte serialized size, returns
kind: "outline"withsponsor,statute,milestones, andreinstatementinline, listing the 19 sectionssponsor,stages.house,stages.senate,stages.royalAssent,interChamberMessages,divisions,senateVoteDetails,publications,statute,summary.en,summary.fr,notes.en,notes.fr,milestones,webReferences,reinstatement,similarBills,speakerRulings, andbibliographicNotices; re-call withsection, paging collections byoffsetandlimit(1–100, default 20; values up to 10,000 clamp to 100 with a notice) throughpagination.nextOffsetA selected page holds exactly
limitwhole records (or what remains);reinstatementand the other scalar sections take nooffsetorlimit, and null, empty, and past-end sections stay distinct
canparl_get_bill_text tool
Reads one version of a bill as plain text from its official XML: the
introduction(royal recommendation, summary, preamble, enacting clause),headings, numberedbodysections, andschedules.publicationIdis acanparl_get_billpublicationsentry'sidand defaults to the last-listed version;languageisen(default) orfr; an omittedsessionresolves from the current official bill feedA text of at most 24,000 bytes returns whole. A larger one returns
kind: "outline"with the segment counts and the outermost headings, each with the bodyoffsetandcountof the sections it spans and theircharacters; re-call withsegmentset tointroduction,headings,body, orschedules, paging the last three byoffsetandlimit(1–100; default 50 headings, 5 sections or schedules; values up to 10,000 clamp to 100 with a notice) throughpagination.nextOffsetPages hold whole sections, never a split one, so a single section can be very large: one section of 45-1 C-15 is 129,702 characters. Read a heading's
charactersbefore paging its sections, and request a smalllimitfor a large partExplanatory notes on existing text are kept in
explanatoryNotes, apart from the enactedtext. Table cells are joined by|A version exported only as a PDF or a table-of-contents cover, as in many sessions before 42-1, has no text here and fails as
bill_text_unavailable; read it on itspublicationsurlIf
bill_text_timeoutoccurs, retry shortly with the same publication and language. Parliament's viewer can take longer to prepare a version on the first request.
canparl_search_members tool
Current roster:
nameandridingsubstrings (matching ignores case, accents, dash and quote styles, and repeated whitespace),province(two-letter abbreviation such asON, or full name), andparty;limit1–100 (default 25; values up to 10,000 clamp to 100 with a notice) with the exact filteredtotalA name-only miss on the current roster includes up to three close names with their
personIdvalues in the notice when available. The result stays empty.postalCodefinds the sitting MPs who represent a complete Canadian postal code (K1A 0A6, any case, with or without one space or dash): every one when the code spans ridings, combined with the other filters by AND. A code with no sitting MP, whether unassigned or in a vacant riding, returns an empty page with a notice. It reads the current roster only and is rejected withincludeFormerorparliamentparliament(36th onward) searches that Parliament's official roster with the same filters: everyone who sat in it, one row each with the caucus and riding last held there, the membershipfromandtodates, andcurrent. An unoffered Parliament fails listing the ones offered; it is rejected withincludeFormerorpostalCodeincludeFormer: truesearches OpenParliament's historical name index instead: one token matches a surname, several match a full recorded name. Parliament, geographic, party, and postal code filters are rejected there, rows may carry only a name and slug, andtotalisnullPass
detailLookupunchanged tocanparl_get_member: official roster rows carry an officialpersonId, historical rows an OpenParliamentslug
canparl_get_member tool
Exactly one
personIdorslugfromdetailLookup; returns the profile and datedmemberships. A digit-onlyslugequal to a currentpersonId, or its/politicians/<digits>/path or URL, is read as thatpersonId. A former member'spersonId(36th Parliament onward, as oncanparl_get_voteballots) resolves on the all-Parliaments roster withcurrent: false, carrying their latest Parliament's caucus and riding; slug inputs stay current-roster only, so any other digit-onlyslugis an OpenParliament ID, and when it is also a former MP'spersonIda notice names both peoplepersonIdcrosswalks verify the official ID and a recorded name or published alias; a bounded surname lookup after an empty exact-name page accommodates accents and middle initials without guessing a slugsponsoredBills(0–5, default 5) andrecentVotes(default 10) page independently throughbillsOffsetandvotesOffset;0skips a section, and values up to 10,000 clamp to the cap with a notice.recentVotestakes 0–100 per call for official ballots and 0–10 for a member without one officialpersonIdSponsored bills come from the complete OpenParliament sponsor index, ordered by
introduceddate newest first, with undated bills last.sponsoredBills.totalgives the exact index count for an available section and is null when unavailable or unrequested. Only bills on the requested page have their details fetched.With one official
personId, ballots come newest first from the official member-votes feed in one request, for the member's latest session orvotesSession, optionally narrowed byvotesBillCode;recentVotes.totalis the exact count of the session's ballots aftervotesBillCode, before paging (nullfor OpenParliament ballots, whose pages carry no count). Each ballot carries its division'syeas,nays,paired, and, on official rows,documentType, eachnullwhen the source omits it.ballotreadsYes/No/Paired,officialBallotkeepsYea/Nay/Paired, andsourcenames the feed; other members keep OpenParliament ballotsEach activity section reports
available,unavailable, ornot_requested, withfailuremetadata; unavailable history is never reported as emptyProfile
linksare never fetched: an absolutehttporhttpsURL is relayed as published, and a relative value is resolved againsthttps://openparliament.ca
canparl_search_votes tool
billCode,result(Agreed To,Negatived,Tie),documentType, inclusive Ottawa-datedateFromanddateTo, andsubjectContains(matching ignores case, accents, dash and quote styles, and repeated whitespace);limit1–100 (default 25; values up to 10,000 clamp to 100 with a notice) with offset paginationNewest first, with official tallies and the exact filtered
total; passsessionandnumbertocanparl_get_vote
canparl_get_vote tool
numberand itssession;ballot(Yea,Nay,Paired;Yes/Noaccepted),personId,party, andprovincefilter only the ballot page;limit1–400 (default 30; values up to 10,000 clamp to 400 with a notice) with offset paginationtally,byParty, andballotsTotalcover the whole division andballotsMatchedthe filtered set;tallyMatchesBallotsflags a disagreement without changing either countBallots are
Yea,Nay, orPaired; nonvoters are not listed, so apersonIdwith no ballot returns an empty pageA page holds up to
limitballots, withtruncatedandnextOffsetwhile more match
canparl_search_speeches tool
Needs a scope:
politician,billDebatedormentionedBill({ session, code }),dateFrom, ordateTo;containsis a literal substring of the selectedlanguage(endefault, orfr; matching ignores case, accents, dash and quote styles, and repeated whitespace) and never a scope on its own.limit1–10 (default 5; values up to 10,000 clamp to 10 with a notice)politiciantakes the same slug, path, URL, or currentpersonIdvalues ascanparl_search_billssponsor, resolved the same way, including the notice for a digit-only value that is also a former MP'spersonId;appliedFilters.politicianNamenames the profile usedScans at most 100 candidates per call, in descending Ottawa timestamp then ascending speech URL. Follow
nextOffsetwith identical filters untilexhaustedbefore concluding there is no match. The result covers OpenParliament's index.Complete
content,speaker,h1, andh2in the selectedlanguage(nullwhere that language has none, never the other language's text; older records carry no French), with speech-date party and riding in English (nullwhen unavailable);substantiveOnly(defaulttrue) drops procedural remarks, and committee records are excluded and counted inexcludedCommittees
canparl_list_reference tool
topic:sessions,bill_types,bill_statuses,vote_results,vote_document_types, orparties; returns the complete set without paginationsessionstakes nosessionand reportsbasicorfullbill coverage and House division coverage per session; other topics take a session and mark each valueobservedin its feed;partiestakes only the current session
Features
Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
Canadian Parliament-specific:
Official bill coverage from session
35-1(1994), full dossiers from37-1(2001), and House divisions from38-1(2004); OpenParliament's historical name index reaches 1994Bills cover both chambers; member, division, and speech tools cover the House of Commons. Missing historical fields stay
nullSessions accept
"45-1"or{ "parliament": 45, "session": 1 }; an omitted session resolves from the current official bill feed, except in speech bill scopesShared source pacing, short-lived in-memory caches, retries, and one 50-second tool deadline. OpenParliament requests are serialized with a two-second start gap. A full sponsored-bill index, ballot hydration, or recovery of a tied speech group can require additional paced requests.
Official-source HTTP 403 refusals fail with
upstream_blocked, the source name, and guidance to retry that source later; response HTML is excluded, and official data is never replaced with another source
Agent-friendly output:
Provenance:
source,url, originalretrievedAt, andcachedon every successful retrievalExplicit coverage: normalized
appliedFilters, continuation fields, notices, and typed failure reasons separate no matches from unavailable or incomplete dataAdvertised input formats: dates, sessions, person IDs, bill codes, postal codes, bill sections, and bill-text segments carry a
patternin the tool schema that accepts what the tool accepts, padded values included. A value outside the format fails at argument validation (-32602,invalid_arguments) naming the field and the expected form; impossible dates, reversed bounds, out-of-range session numbers, and unknown vocabulary values keep their typed tool reasonsBoth surfaces: every
structuredContentvalue, complete source text included, also renders in Markdowncontent[]
The Canadian Parliament research guide connects bill, division, member, and Hansard records and explains the evidence needed for historical conclusions. It ships with plugin installs, npm, Docker, and the desktop bundle, and is available over MCP as skill://canada-parliament-guide/SKILL.md.
Getting started
Connect to the hosted server in Claude Code:
claude mcp add --transport http canada-parliament-mcp-server https://canada-parliament.caseyjhand.com/mcpOr run it locally:
claude mcp add canada-parliament-mcp-server -- npx -y @cyanheads/canada-parliament-mcp-serverFor other clients, add this to the MCP config file:
{
"mcpServers": {
"canada-parliament-mcp-server": {
"command": "npx",
"args": ["-y", "@cyanheads/canada-parliament-mcp-server"]
}
}
}No API key is required. Optionally set CANPARL_USER_AGENT to identify your deployment to the upstream sources. For Docker or a source build, see Running the server.
Configuration
Variable | Description | Default |
| HTTP User-Agent sent to the upstream sources. Blank uses the default; CR and LF are rejected. |
|
| Transport: |
|
| HTTP bind address. |
|
| HTTP server port. |
|
| HTTP session mode: |
|
| Authentication: |
|
| Log level ( |
|
| Directory for log files (Node.js only). Relative paths resolve against the server package directory. |
|
| Storage backend: |
|
| Enable OpenTelemetry. |
|
| Opt in to daily summaries of tool-call counts, failure types, and latency. Respects | unset (off) |
See .env.example for every server setting and the common framework overrides.
Usage reports
Usage reports are off by default. Set MCP_USAGE_REPORTING=true to opt in. Any DO_NOT_TRACK value other than 0, false, no, or off keeps reports off.
When enabled, the server sends a summary to https://telemetry.cyanheads.com/v1/reports once a day and at shutdown. It includes tool-call counts, failure types, latency, server and runtime versions, OS, and CPU architecture. Reports identify the installation by a keyed hash of a random ID and exclude argument values, results, error messages, environment values, and hostnames. Set MCP_USAGE_REPORTING_ENDPOINT to use your own receiver. Full report format.
Running the server
Local development
Requires Bun v1.4.4 or higher (or Node.js v24+), and Internet access to parl.ca, ourcommons.ca, and openparliament.ca.
git clone https://github.com/cyanheads/canada-parliament-mcp-server.git
cd canada-parliament-mcp-server
bun install
cp .env.example .envBuild and run the production version:
# One-time build bun run rebuild # Run the built server bun run start:http # or bun run start:stdioRun checks and tests:
bun run devcheck # Lints, formats, type-checks, and more bun run test # Runs the test suite
Docker
docker run --rm -p 3010:3010 ghcr.io/cyanheads/canada-parliament-mcp-server:latestThe image defaults to HTTP transport, stateless sessions, and logs in /var/log/canada-parliament-mcp-server. To run it over stdio from an MCP client, use "command": "docker" with "args": ["run", "-i", "--rm", "-e", "MCP_TRANSPORT_TYPE=stdio", "ghcr.io/cyanheads/canada-parliament-mcp-server:latest"]. Build locally with docker build -t canada-parliament-mcp-server .; OpenTelemetry peers are installed by default, or omitted with --build-arg OTEL_ENABLED=false.
Project structure
Directory | Purpose |
| Tool definitions ( |
| LEGISinfo service — session discovery, official bill lists, dossiers, and bill-version text. |
| House of Commons service — current and per-Parliament rosters, postal-code lookup, division, and member-vote XML. |
| OpenParliament service — historical identities, activity, speeches, and memberships. |
| Shared schemas, normalization, reference vocabulary, and request budgets. |
| Server-specific environment variable parsing and validation with Zod. |
| Published parliamentary research guide for agents calling the tools. |
| Parser, service, tool, and integration tests over synthetic upstream fixtures. |
See docs/tree.md for the full tree.
Development guide
See CLAUDE.md for development guidelines and architectural rules. The short version:
Handlers throw, framework catches; catch only to translate a known source failure or keep optional enrichment
Use
ctx.logfor logging andctx.enrichfor applied filters, totals, and noticesRegister new tools in the
createApp()arrays insrc/index.tsWrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
Contributing
Issues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run testLicense
Code is licensed under Apache 2.0. Parliamentary data is an unofficial reproduction credited to Parliament and, where used, OpenParliament; Parliament retains copyright. Reuse is governed separately by the Parliament notices, the Speaker's Permission, the Senate terms, and the OpenParliament API terms. This free, noncommercial relay does not imply government endorsement or an open-data licence.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Read and search Australian federal Hansard and recorded votes, and look up parliamentarians.
Canadian federal legislation: bills, the laws they change, committee study and votes.
Search MPs and Lords, fetch profiles, synopses, and Westminster constituencies
Trace Austrian Parliament bills through club votes and debates, read protocols, and look up members.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides access to Canadian parliamentary data including debates, bills, votes, politicians, and committees via the OpenParliament.ca civic-tech mirror.70 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables discovery and retrieval of European Parliament procedures, MEPs, plenary votes, documents, speeches, and questions from the Open Data API over STDIO or Streamable HTTP.353 npm1Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables searching and retrieving UK Parliament records — bills, members, Commons and Lords divisions, Hansard contributions, written questions, and committee business — from the official Parliament APIs. Runs over STDIO or Streamable HTTP with no API key, linking records across their distinct identifiers.316 npm1Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables searching and reading bills, recorded votes, member profiles, speeches, and parliamentary quota expenses from Brazil's Câmara dos Deputados and Senado Federal, with official source URLs and Portuguese-language records. Runs over STDIO or Streamable HTTP.956 npm1Apache 2.0