Skip to main content
Glama
kupad95

UK Parliament MCP Server

by kupad95

UK Parliament MCP Server

npm version License: MIT GitHub

https://github.com/user-attachments/assets/eec2a7bc-1ddf-4b25-8553-8d5b33a57ff6

A Model Context Protocol (MCP) server for live UK Parliament data. Query bills, votes, MP profiles, financial interests, and petitions straight from your MCP‑compatible assistant, no API key required.


Features

  • No authentication – open data under the Open Parliament Licence

  • Rebellion tracking – detect MPs voting against their party whip

  • Cross-dataset queries – match vote records against financial interests

  • Pattern detection – close votes, government defeats, party rebellion rates

  • Bill & petition search – by keyword, stage, or status


Related MCP server: UK Parliament MCP Server

Installation

# One‑off run
npx uk-parliament-mcp

# Global install
npm install -g uk-parliament-mcp

Usage

Claude Desktop — add to claude_desktop_config.json:

{
  "mcpServers": {
    "uk-parliament": {
      "command": "npx",
      "args": ["-y", "uk-parliament-mcp"]
    }
  }
}

Claude Code:

claude mcp add uk-parliament -- npx -y uk-parliament-mcp

Available Tools

Tool

Purpose

rank_entities

Rank MPs by rebellion count across divisions

get_events

Recent divisions, rebellions, or bills

analyze_patterns

Close votes, government defeats, party rebellion rates

find_entities

Find MPs, bills, petitions, or declared interests

query_entities

Cross-reference vote records with financial interests


What You Can Ask

Question

Tool

Which Labour MPs have rebelled most this parliament?

rank_entities

What votes happened in the Commons this week?

get_events

Which Conservative MPs rebelled last month?

get_events

Bills currently about welfare reform?

find_entities

Show me knife-edge votes (10 votes margin or fewer) this year

analyze_patterns

Which government bills were defeated in the Lords?

analyze_patterns

MPs with declared defence company interests

find_entities

Labour MPs who voted No on a Renters Reform Bill with property interests

query_entities

What are the most-signed open petitions right now?

find_entities


Data Sources

API

What it covers

bills-api.parliament.uk

Bills, stages, sponsors

commonsvotes-api.parliament.uk

Commons division records

lordsvotes-api.parliament.uk

Lords division records

members-api.parliament.uk

MP and Lord profiles

interests-api.parliament.uk

Register of Members' Financial Interests

petition.parliament.uk

Petitions and signature counts


Development

git clone https://github.com/YOUR_USERNAME/uk-parliament-mcp-server.git
cd uk-parliament-mcp-server
npm install
npm run build   # compile TypeScript
npm start       # production
npm run dev     # watch & reload

Contributing

  1. Fork → branch → commit

  2. git push and open a PR

  3. Follow the coding style in src/


License

MIT – see LICENSE.


Disclaimer This project is unofficial and not endorsed by UK Parliament. Data usage is subject to the Open Parliament Licence.

Available Tools

5 tools
analyze_patternsA

Detect patterns across many parliamentary votes: 'close_votes' finds divisions with a small margin (near-misses or knife-edge votes), 'government_defeats' finds votes the government lost, 'party_rebellion_rate' shows which parties rebel most by percentage of votes cast. Use for trend analysis across many divisions.

ParametersJSON Schema
NameRequiredDescriptionDefault
pattern_typeYesThe pattern to detect.
houseNoWhich house to analyse. Defaults to Commons.
daysNoHow many days back to scan. Default 365.
thresholdNoFor close_votes: maximum majority to count as close. Default 10.
max_divisionsNoMaximum divisions to scan. Default 100.
limitNoMaximum results to return. Default 20.

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so the description carries full burden. It explains pattern types but does not disclose potential behavioral traits like read-only nature, rate limits, or error handling. Basic transparency is achieved.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence followed by a list of pattern types, front-loading the main purpose. It is fairly concise, though the pattern explanations could be slightly more streamlined.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 6 parameters and no output schema, the description does not explain return values or behavior for edge cases. It covers pattern selection but omits output details, leaving some gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% with descriptions for all parameters. The description adds value by elaborating on the pattern_type enum values, explaining what each pattern means beyond the schema's simple description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool detects patterns across many parliamentary votes and enumerates three specific pattern types with brief explanations. It distinguishes itself from siblings which focus on entities, events, querying, and ranking.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description states 'Use for trend analysis across many divisions,' providing clear context. However, it does not explicitly mention when not to use or direct to alternative tools, though siblings imply different use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

find_entitiesA

Find MPs, bills, petitions, or declared financial interests. entity_type='mp': search members by name/party/constituency/house/status. entity_type='bill': search legislation by title keyword/stage/house. entity_type='petition': find petitions by keyword. entity_type='interest': fetch an MP's declared financial interests. Pass name='John McDonnell' OR mp_id=178 (member ID from a prior MP lookup). Optionally add keyword to filter by topic (e.g. keyword='property'). To find ALL MPs with a given interest topic, omit name/mp_id and pass only keyword='defence'.

ParametersJSON Schema
NameRequiredDescriptionDefault
entity_typeYesWhat to search for.
nameNoMP or Lord name. For entity_type='mp': filter by name. For entity_type='interest': fetch this specific MP's declared interests.
mp_idNoMP member ID (integer). For entity_type='interest': fetch declared interests for the MP with this ID. Use this when you already have the member ID from a prior find_entities mp lookup.
partyNoFilter MPs by party.
constituencyNoFilter MPs by constituency.
houseNoFilter by house.
statusNoFilter MPs by active or inactive status.
stageNoBill stage filter.
keywordNoBill title search, petition text search, or financial interest topic filter.
petition_stateNoPetition state filter. Default 'all'.
limitNoMaximum results. Default 20.

TDQS

A4.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It clearly describes the search/fetch behavior, including filtering and parameter combinations. However, it does not mention pagination behavior, rate limits, or authentication requirements, which could be relevant for agent planning.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense and informative, front-loading the main purpose. However, the structure is a single prose paragraph; a more structured format (e.g., bullet points or separate sections) could improve scanability. Nevertheless, every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 11 parameters, 4 entity types, and no output schema, the description is remarkably complete. It covers all entity_type behaviors, parameter combinations, and special use cases (e.g., interest topic queries). The agent can confidently select and invoke the tool without needing external documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Despite 100% schema coverage, the description adds significant value beyond the schema. It explains how entity_type changes the semantics of other parameters, provides concrete examples (e.g., name='John McDonnell', mp_id=178, keyword='property'), and details special usage patterns (e.g., finding all MPs with a topic). This goes well beyond the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description starts with a clear verb+resource statement: 'Find MPs, bills, petitions, or declared financial interests.' It then provides specific breakdown per entity_type, distinguishing each use case. The tool's purpose is explicit and distinct from sibling tools like analyze_patterns or query_entities.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description offers extensive guidance: when to use name vs mp_id, how to combine parameters per entity_type, and special cases like fetching all MPs with an interest topic by omitting name/mp_id. It effectively tells the agent when and how to invoke the tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_eventsA

Get recent parliamentary events: votes/divisions, party rebellions, bill stage changes, or a specific MP's voting record. event_type='division': recent votes with pass/fail results. event_type='rebellion': divisions with party rebels, optionally filtered by party. event_type='bill': bills filtered by stage or keyword. event_type='member_votes': full voting history for a specific MP — pass name='Nigel Farage' (or mp_id if already known). Shows each division, how the MP voted (Aye/No), and the result.

ParametersJSON Schema
NameRequiredDescriptionDefault
event_typeYesThe type of event to retrieve.
houseNoWhich house. Defaults to Commons for votes.
partyNoFor event_type='rebellion', filter to this party's rebels.
nameNoFor event_type='member_votes': the MP's name (e.g. 'Nigel Farage').
mp_idNoFor event_type='member_votes': the MP's member ID if already known.
daysNoHow many days back to search. Default 30.
limitNoMaximum number of results. Default 20.
stageNoFor event_type='bill': firstreading, secondreading, committee, report, thirdreading, royalassent.
keywordNoFor event_type='bill', search bill titles by keyword.

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden and explains what each event_type returns (e.g., pass/fail results, rebellions, bill stages, MP voting history). It does not cover performance, rate limits, side effects, or error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single paragraph but well-organized by event_type, each with a brief explanation. It is concise yet informative, though some repetition could be trimmed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 9 parameters and no output schema, the description adequately covers the main use cases for each event_type. However, it lacks details on error handling, pagination, or rate limits.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage, but the description adds context beyond schema by explaining how to use parameters for each event_type, clarifying defaults (days=30, limit=20, house='Commons'), and providing usage examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it retrieves recent parliamentary events and lists four specific event types (divisions, rebellions, bills, member votes) with examples, distinguishing between them effectively.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear guidance on when to use each event_type, including example parameters like 'name='Nigel Farage'' for member_votes. However, it does not mention when not to use this tool or suggest alternative tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

query_entitiesA

Cross-dataset query: find MPs matching multiple conditions spanning vote records AND financial interests. Examples: 'Labour MPs who voted No on division 1234', 'MPs who rebelled in division 5678 AND have defence interests', 'MPs with fossil fuel interests who voted Aye'. Specify division_id with voted='aye'/'no' or rebellion_only=true for vote filter. Specify has_interest keyword for interest filter. Results are the intersection of all conditions.

ParametersJSON Schema
NameRequiredDescriptionDefault
division_idNoDivision to filter votes by.
votedNoFilter to only Aye or No voters in the division.
rebellion_onlyNoIf true, only include MPs who rebelled in the specified division.
houseNoWhich house. Defaults to Commons.
has_interestNoFilter to MPs with a declared interest matching this keyword.
partyNoFilter to a specific party.
limitNoMaximum results. Default 50.

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It explains the filtering logic (intersection) and provides examples. However, it does not disclose pagination behavior, default limits (though schema notes limit), error responses, or any side effects. The description is adequate but not exhaustive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, with a clear front-loaded statement of purpose followed by examples and usage details. Every sentence adds value, and there is no redundancy or unnecessary text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool complexity (7 parameters, no required, cross-dataset) and absence of output schema, the description covers the main functionality well. It explains the intersection logic and key filters. However, it omits mention of parameters like house, party, and limit, which are in the schema but not reinforced in the description. Additionally, no return format is specified, which could be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the description adds value by explaining how to combine parameters (e.g., division_id with voted or rebellion_only, and has_interest for interest filter). It also provides examples that illustrate parameter usage, exceeding the schema documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as a cross-dataset query to find MPs matching multiple conditions across vote records and financial interests. It provides concrete examples and distinguishes itself from sibling tools like find_entities and analyze_patterns by emphasizing the intersection of conditions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on how to use the tool, including specifying division_id with voted or rebellion_only for vote filtering, and has_interest for interest filtering. It also explains that results are the intersection of all conditions. However, it does not explicitly contrast with sibling tools or specify when not to use this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

rank_entitiesA

Rank MPs by rebellion count — how many times they voted against their party whip. Use this for any question about 'most rebellious MPs', 'rebel count', 'which Labour/Conservative MPs rebelled most', or rebellion frequency rankings. Scans all divisions in the date range internally and returns a sorted leaderboard in a single call. Filter by party='Labour' for Labour-specific results.

ParametersJSON Schema
NameRequiredDescriptionDefault
entity_typeYesThe type of entity to rank.
metricYesThe metric to rank by.
partyNoFilter to a specific party (e.g. 'Labour').
houseNoWhich house to scan. Defaults to Commons.
date_fromNoStart date in YYYY-MM-DD format. Defaults to 2024-07-05 (current parliament).
max_divisionsNoMaximum number of divisions to scan. Default 100, max 500.
min_rebellionsNoMinimum rebellions to appear in the leaderboard. Default 1.
limitNoMaximum number of MPs to return. Default 20.

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the full burden. It discloses that the tool scans all divisions internally and returns a sorted leaderboard, and mentions default date range. It lacks details on potential side effects or permissions, but for a read-like ranking operation, this is adequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, with four sentences that front-load the core action and provide necessary details. Every sentence adds information without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the absence of an output schema, the description covers the tool's behavior well: internal scanning, defaults, and filtering. It lacks explicit mention of the return structure (e.g., 'returns list of MPs with rebellion counts'), but for a leaderboard tool, the context is largely sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema coverage, the baseline is 3. The description adds value by providing examples (e.g., 'filter by party='Labour'') and clarifying that metrics and entity types are fixed, which reinforces the schema's enum constraints. This lifts the score to 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool ranks MPs by rebellion count, specifies the metric (rebellions), and gives concrete usage examples. It distinguishes itself from siblings by promising a sorted leaderboard in a single call, making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly lists example queries ('most rebellious MPs', 'rebel count', etc.) and provides filter guidance (party='Labour'). However, it does not mention when to avoid this tool or suggest alternative tools, which would have made it a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv0.1.0
    • First observedanalyze_patterns
    • First observedfind_entities
    • First observedget_events
    • First observedquery_entities
    • First observedrank_entities

TDQS

A4.4/5.0

Scored across 5 tools

Disambiguation5/5

Each tool targets a distinct operation: aggregate pattern analysis, entity search, recent events, cross-dataset queries, and rebellion rankings. The purposes are clearly separated with no ambiguity.

Naming Consistency5/5

All tool names follow a consistent verb_entity pattern (analyze_patterns, find_entities, get_events, query_entities, rank_entities) using snake_case, making the set highly predictable.

Tool Count5/5

With 5 tools covering MPs, bills, petitions, interests, votes, and rebellions, the scope is well-balanced. Each tool serves a clear purpose without redundancy or overload.

Completeness4/5

The toolset covers core query capabilities for UK Parliament data, but lacks a direct tool for retrieving detailed information about a specific division by ID. Minor gap, but overall surface is solid for typical use cases.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers