About uk-parliament-mcp-server
An MCP server for official UK Parliament Westminster records, spanning bills, members, votes, Hansard, written questions, and committees. It keeps each source’s identifier types distinct and supports stdio or Streamable HTTP.
Key features
- 01Search bills by subject, House, and stage
- 02Retrieve bill stages, amendments, and motions
- 03Look up member profiles, roles, and voting
- 04Search divisions and party vote totals
- 05Find Hansard contributions and source text
- 06Search questions, answers, and committee records
Use cases
- 01Track a bill’s stages and amendments
- 02Check a member’s affiliation on a given date
- 03Review votes in a specific House division
- 04Find debate contributions or written question answers
MCP support
Provides MCP clients with nine read-only tools for UK Parliament bills, members, votes, Hansard, questions, and committees. Supports stdio and Streamable HTTP.
Configuration
Remote servers need no local install. Pick your client, then copy the config or install in one click.
https://uk-parliament.caseyjhand.com/mcpclaude mcp add --transport http cyanheads-uk-parliament https://uk-parliament.caseyjhand.com/mcp{"mcpServers":{"cyanheads-uk-parliament":{"type":"http","url":"https://uk-parliament.caseyjhand.com/mcp"}}}Open in Cursor{"servers":{"cyanheads-uk-parliament":{"type":"http","url":"https://uk-parliament.caseyjhand.com/mcp"}}}Open in VS Code{"mcpServers":{"cyanheads-uk-parliament":{"type":"http","url":"https://uk-parliament.caseyjhand.com/mcp"}}}{"mcpServers":{"cyanheads-uk-parliament":{"serverUrl":"https://uk-parliament.caseyjhand.com/mcp"}}}Run commands in a terminal; paste JSON into the client’s MCP config and restart. Servers that need sign-in will prompt on first connect.
Tools
9| Parameter | Type | Required | Description |
|---|---|---|---|
| house | enum | No | Commons or Lords; required for active parties.commons | lords |
| limit | integer | No | Requested whole reference rows; positive safe integer, default 10, effective cap 20. |
| topic | enum | Yes | Reference topic or static identifier/coverage guide.identifiers | coverage | bill_stages | bill_types | parties | departments | answering_bodies |
| cursor | string | No | Opaque collection cursor; repeat the same normalized filters. |
| nameContains | string | No | Case-insensitive AND tokens over the complete named reference set. |
| contentCursor | string | No | Opaque same-selection recursive content continuation. |
Details
From the project README@cyanheads/uk-parliament-mcp-server
Search UK Parliament bills, members, votes, Hansard, written questions, and committees via MCP. STDIO or Streamable HTTP.
Overview
Westminster records from the official UK Parliament Bills, Members, Commons and Lords Votes, Hansard, Written Questions, and Committees APIs. Search parliamentary business, retrieve selected records and source links, and trace members, bills, votes, answers, and committee evidence across their distinct identifiers. Runs as a stdio process or a local Streamable HTTP server; no API key is required.
Tools
| Tool | Description |
|---|---|
ukparl_lookup_reference | Resolve filter IDs, identifier namespaces, and historical coverage guidance |
ukparl_search_bills | Search bill summaries by title, House, session, sponsor, stage, and bill type |
ukparl_get_bill | Retrieve bill details, stages, publications, amendments, and ping-pong motions |
ukparl_search_members | Find current and former MPs and peers, including dated membership searches |
ukparl_get_member | Retrieve profiles, roles, committee seats, official contacts, interests, and voting history |
ukparl_search_divisions | Search House-scoped divisions and inspect metadata, voters, and party totals |
ukparl_search_hansard | Search spoken contributions with complete source text where supplied |
ukparl_search_questions | Search question and answer previews or retrieve complete question details |
ukparl_get_committee | Discover committees and retrieve memberships, business, and publication metadata |
Capability reference
ukparl_lookup_reference tool
topic:identifiers,coverage,bill_stages,bill_types,parties,departments, oranswering_bodies; live directories default to 10 rows, capped at 20, with optionalnameContainsAND-token filteringhouseis required only forparties; that directory covers active parties in the selected House, not every historical party. Static guides accept neither House nor name filters- Identifier guidance distinguishes reference
stageIdfrom bill-specificbillStageId, House-scoped division IDs, Questions API IDs from UINs, and committee person IDs from Members API IDs
ukparl_search_bills tool
- Optional
query,house,sessionId,memberId,stageIds, andbillTypeIds; each ID array accepts up to 20 entries. Defaults to 10 bills, capped at 20 - Results are
detailLevel: "summary"withbillId, provenance, and collection continuation; no current-session scope is inferred. Resolve reference filters withukparl_lookup_reference
ukparl_get_bill tool
- Required
billId;sectiondefaults tooverview, or selectsstages,stage,publications,amendments,amendment,motions, ormotion. Collections default to 20 records, capped at 50 - Stage, amendment, and motion selections require the bill-specific
billStageIdfromstages; singular amendment/motion retrieval also needsitemIdfrom the parent collection (amendmentIdfor amendments,motion.idfor motions). Amendment/motion lists are summaries; singular selectors retrieve complete text - Missing entities return
found: falsewithguidance.legislationHandoff.statusisauthoritative_link,not_enacted, orunavailable; only actual supplied legislation.gov.uk links establish a statute handoff
ukparl_search_members tool
- Optional
name,constituency(source location text),partyId, andhouse;currentOnlydefaults tofalse, including current and former members. Defaults to 10 rows, capped at 20 asOfselects membership on a realYYYY-MM-DDdate and accepts onlynameand pagination alongside it; returned latest profile fields are not a historical snapshot- Summary hits carry
memberIdforukparl_get_member,source, andpage; unknown source fields remain absent or null
ukparl_get_member tool
- Required
memberId;section:profile(default),roles,committee_seats,contact,interests, orvoting. Roles withoutcategoryreturns an availability outline; select a returned category for whole role periods houseis required for interests and voting, and omitted elsewhere. Local histories default to 20 rows, capped at 50; voting uses native 20-row pages regardless oflimitfoundandguidancedistinguish missing members and unavailable source collections. Interest trees and committee relationships retain source pointers; voting preserves recorded lobby and teller facts without inferring abstention or lifetime participation
ukparl_search_divisions tool
- Required
house:commonsorlords;mode:search(default),detail,voters, orparty_totals. Search acceptsquery,memberId, and inclusivestartDate/endDate; defaults to 5 divisions, capped at 10 - Other modes require a
divisionIdfrom the same House. Voters default to 20 rows, capped at 50, with exact sourcepartylabels andlobby: Commonsaye,no,not_recorded; Lordscontent,not_content - Detail preserves headline counts and teller identities;
partyTotalscounts listed non-tellers and tellers separately.not_recordedis the source list, never an abstention claim; member searches include teller participation
ukparl_search_hansard tool
- Optional
query,memberId,house, inclusivestartDate/endDate, and numericdebateSectionId; defaults to 5 contributions, capped at 20. Dates areYYYY-MM-DD, with no inferred window detailLevel: "complete"carries full source contribution text, including HTML;summarymeans the source supplied only a preview. Section filtering does not establish a complete debate transcriptcoveragereports historical limitations, including the 2004–2006 website warning; empty results do not prove no debate occurred. Narrow date windows after timeouts; useukparl_lookup_referencewithtopic: "coverage"for archive guidance
ukparl_search_questions tool
mode: "search"(default) acceptsquery,memberId,house, up to 20answeringBodyIds,answered, and inclusivetabledFrom/tabledTo/answeredFrom/answeredTodates (YYYY-MM-DD). Defaults to 10 previews, capped at 20- Search includes all sessions and withdrawn questions; omitted
answeredincludes either state.mode: "detail"takes a returnedquestionIdalone for complete question/answer HTML, corrections, and attachment metadata; a UIN is not aquestionId - Results distinguish
detailLevel: "summary"from"complete"; detail misses returnfound: falsewithguidance. Attachments are links and metadata, not downloaded files
ukparl_get_committee tool
mode: "search"(default) acceptsqueryandhouse(commons,lords,joint), default 10/cap 20.detail,members,inquiries, andpublicationsrequirecommitteeId; nested collections default to 20/cap 50inquiryrequiresbusinessId;publicationrequirespublicationId.businessIdcan also filter publications.membershipselectsall(default),current, orformerin members mode;queryin inquiries/publications requires at least two charactersinquiriesincludes all committee business types, labelled byisInquiry. Records retain typed entities andsourcePathrelationships; publications return evidence/report metadata and document links, without downloads or text extraction
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.
UK Parliament-specific:
- Keyless, read-only access to seven official Westminster API origins; devolved legislatures are outside scope
- Separate identifier namespaces and explicit source selections, with no inferred current session or date window
- Shared per-origin backpressure, bounded retries, and a 45-second call deadline across related requests
- Historical coverage remains source-specific: the Hansard archive starts on 22 November 1803, the Spoken API minimum date is unknown, and no automatic historical-archive fallback is performed
Agent-friendly output:
- Provenance — source API, request URL, retrieval timestamp, and licence link accompany source records;
appliedreports effective selections and limits - Whole-record pagination —
page.returned,hasMore, andnextCursordescribe actual emitted records, withtotalonly when known. Repeat the same filters and effective limit when following a cursor - Lossless large records —
delivery: "full" | "outline" | "fragment"separates complete payloads fromcontentPagecontinuations. Repeat the original tool inputs plus eachcontentCursor, follow all outline entries and continuations, concatenate consecutive fragments before JSON-decoding once, and reconstruct the selected record before advancingcollectionPage - Explicit recovery —
invalid_cursorrestarts a selection;source_changedrestarts content retrieval after an upstream revision. Search previews, missing records, and unavailable collections remain distinct
Getting started
Add the following to your MCP client configuration file.
{
"mcpServers": {
"uk-parliament-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/uk-parliament-mcp-server@latest"],
"env": { "MCP_TRANSPORT_TYPE": "stdio", "MCP_LOG_LEVEL": "info" }
}
}
}
Or with npx (no Bun required):
{
"mcpServers": {
"uk-parliament-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/uk-parliament-mcp-server@latest"],
"env": { "MCP_TRANSPORT_TYPE": "stdio", "MCP_LOG_LEVEL": "info" }
}
}
}
Or with Docker:
{
"mcpServers": {
"uk-parliament-mcp-server": {
"type": "stdio",
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "MCP_TRANSPORT_TYPE=stdio", "ghcr.io/cyanheads/uk-parliament-mcp-server:latest"]
}
}
}
For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcp
Prerequisites
- Bun v1.4.0 or higher (or Node.js v24+).
- Internet access to the official Parliament APIs; no API key is required.
Installation
- Clone the repository:
git clone https://github.com/cyanheads/uk-parliament-mcp-server.git
- Navigate into the directory:
cd uk-parliament-mcp-server
- Install dependencies:
bun install
- Configure environment:
cp .env.example .env
# edit .env for transport, logging, or authentication overrides as needed
Configuration
| Variable | Description | Default |
|---|---|---|
MCP_TRANSPORT_TYPE | Transport: stdio or http. | stdio |
MCP_HTTP_PORT | Initial HTTP server port; startup logs report the bound port after collision retries. | 3010 |
MCP_HTTP_HOST | HTTP bind address. | 127.0.0.1 |
MCP_HTTP_ENDPOINT_PATH | HTTP MCP endpoint. | /mcp |
MCP_SESSION_MODE | HTTP session mode: stateless, stateful, or auto. | stateless |
MCP_AUTH_MODE | Authentication: none, jwt, or oauth. | none |
MCP_LOG_LEVEL | Log level (debug, info, warning, error, etc.). | info |
LOGS_DIR | Directory for log files (Node.js only). | <app-root>/logs |
STORAGE_PROVIDER_TYPE | Storage backend: in-memory, filesystem, supabase, cloudflare-kv/r2/d1. | in-memory |
OTEL_ENABLED | Enable OpenTelemetry. | false |
See .env.example for the common framework overrides. There are no server-specific environment variables.
Running the server
Local development
-
Build and run the production version:
# One-time build bun run rebuild # Run the built server bun run start:http # or bun run start:stdio -
Run checks and tests:
bun run devcheck # Lints, formats, type-checks, and more bun run test # Runs the test suite
Project structure
| Directory | Purpose |
|---|---|
src/mcp-server/tools/definitions | Nine tool definitions (*.tool.ts). |
src/services/parliament-http | Fixed-origin transport, provenance, cursors, and lossless content delivery. |
src/services/bills | Bill search, scrutiny records, publications, and reference directories. |
src/services/members | Member discovery, profiles, biographies, interests, and voting history. |
src/services/divisions | Commons/Lords division metadata and recorded voter collections. |
src/services/hansard | Spoken contribution search and historical coverage metadata. |
src/services/questions | Written question previews and complete question/answer records. |
src/services/committees | Committee business, membership, publication metadata, and typed relationships. |
tests/ | Unit and integration tests, mirroring the src/ structure. |
Development guide
See CLAUDE.md for development guidelines and architectural rules. The short version:
- Handlers throw, framework catches — no
try/catchin tool logic - Use
ctx.logfor logging,ctx.statefor storage - Register new tools and resources in the
createApp()arrays insrc/index.ts - Wrap 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 test
License
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
Contains Parliamentary information licensed under the Open Parliament Licence v3.0 where applicable. Personal data, parliamentary marks, and third-party rights are excluded; preserve the source's notices and check rights before reusing excluded material. This software is independent and does not imply parliamentary endorsement.
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.