UK Parliament MCP Server - bridges AI assistants with UK Parliament APIs
Project description
UK Parliament AI Assistant
Access official UK Parliament data through AI assistants. Query MPs, Lords, bills, votes, committees, debates, and more.
Table of Contents
- Getting Started
- Claude Desktop Setup
- VS Code Setup
- What Can I Ask?
- Power Tools
- Prompting Tips
- Example Prompts
- Alternative Installation Methods
- Final Thoughts
Getting Started
Step 1: Configure your AI assistant (see Claude Desktop or VS Code below)
Step 2: Start a parliamentary research session:
- Use the
/parliamentslash command (in Claude Desktop or compatible MCP clients) - Or say "Hello Parliament" to initialize the session
This gives your AI assistant the context it needs to effectively use the 105 available tools.
Claude Desktop Setup
- Open Claude Desktop
- Click Settings → Developer → Edit Config
- Add the following configuration and save with UTF-8 encoding:
{
"mcpServers": {
"uk-parliament": {
"command": "uvx",
"args": ["uk-parliament-mcp"]
}
}
}
- Restart Claude Desktop
- Open the Developer tab to verify the server is running
Note: This uses
uvxwhich runs the package directly without installation. It automatically uses the latest version from PyPI.Don't have uvx? Install it with:
pip install uvor see uv installation docs
VS Code Setup
- Press
Ctrl+Shift+Pto open the Command Palette - Select MCP: Add Server
- Choose Command: Stdio
- Enter:
uvx uk-parliament-mcp - Press Enter
Start the Server
- Press
Ctrl+Shift+Pagain - Select MCP: List Servers
- Click the server you just added and choose Start server
First Interaction
- Open Copilot Chat in VS Code
- Set Agent mode using the dropdown in the bottom-left
- Select your preferred model (e.g., Claude Sonnet 4)
- Click Configure Tools, and select all tools from the newly added MCP server
- Try a prompt such as: "What is happening now in the House of Commons?"
- Accept any permission request to allow the MCP call
What Can I Ask?
You can ask questions about virtually all aspects of UK Parliament data. Here are some key areas:
- Live Parliamentary Activity: "What's happening in the House of Commons right now?" or "What's currently being debated in the Lords?"
- Members of Parliament: "Tell me everything you know about Boris Johnson," "What are Sir Keir Starmer's registered interests?" or "Show me the voting record of member 4129"
- Bills & Legislation: "Show me details of bill 425," "What amendments were proposed for bill 425?" or "What publications exist for the Environment Bill?"
- Voting Records: "How did MPs vote on the climate change motion?" or "Show me Lords divisions on healthcare policy"
- Committees & Inquiries: "Which committees are investigating economic issues?" or "Show me evidence submitted to the Treasury Committee"
- Parliamentary Procedures: "Search Erskine May for references to Speaker's rulings" or "What are the oral question times this week?"
- Constituencies & Elections: "Show me election results for Birmingham constituencies" or "List all constituencies in Scotland"
- Official Documents: "Are there any statutory instruments about housing?" or "What treaties involve trade agreements?"
- Transparency Data: "Show register of interests for Treasury ministers" or "What are the declared interests categories?"
Power Tools
These high-level tools combine multiple API calls for common research tasks:
| Tool | What it does |
|---|---|
get_mp_profile(name) |
Complete MP/Lord profile: bio, interests, voting record |
check_mp_vote(mp_name, topic) |
How an MP voted on a specific topic |
get_bill_overview(search_term) |
Full bill info: details, stages, publications |
get_committee_summary(topic) |
Committee overview: evidence, publications |
Example:
Tell me everything about Keir Starmer
The AI will use get_mp_profile to fetch biography, registered interests, and voting history in a single efficient call.
Disconnecting from Parliament
Start a new chat session, or say "Goodbye Parliament" to end the parliamentary session while keeping context.
Prompting Tips
Note: Since AI is involved, some responses may be inaccurate. These tips help improve reliability.
✅ Initialize Your Session
Always begin your session with /parliament or "Hello Parliament". This ensures the AI assistant uses the correct tools and cites its sources properly.
🔄 Clear Context
Use the + icon (new chat) if:
- The AI seems stuck in a loop
- You want to reset the conversation context
🔗 Re-Display the API URL
While the AI is instructed to list source URLs automatically, you can ask for them again at any time. This is useful for troubleshooting or if you simply want to re-confirm the source for the last response.
You can ask:
Show me the API URL you just used.
Example response:
The API URL just used to retrieve information about Boris Johnson is:
https://members-api.parliament.uk/api/Members/Search?Name=Boris%20Johnson
🧠 Combine Data from Multiple Sources
Example:
Has Chelmsford been mentioned in either the Commons or Lords?
The AI may:
- Query both Commons and Lords Hansard
- Combine the results
- Offer more detail if requested
🧾 See the Raw JSON
For debugging or to inspect the raw data structure, you can ask the assistant to show you the full JSON response from its last API call. This is particularly useful for developers who want to understand exactly what information the AI is working with before it is summarized.
Example prompt:
Show me the JSON returned from the last MCP call.
Example Prompts
Live Parliamentary Activity (3 examples)
- What is happening now in both Houses?
- What's currently happening in the House of Commons?
- What's currently happening in the House of Lords?
Members of Parliament (14 examples)
- Show me the interests of Sir Keir Starmer
- Tell me about Boris Johnson's parliamentary career
- Look up the MP with ID 1471
- Show me the biography for member 172
- Show me contact details for member 4129
- What are the registered interests of member 3743?
- What speeches has member 172 made recently?
- Show me how member 4129 has voted in the Commons
- Show me how member 3743 has voted in the Lords
- What was member 1471's career before Parliament?
- What policy areas does member 172 focus on?
- What early day motions has member 1471 signed?
- Get the constituency election results for member 4129
- Show me photos of member 172
Bills and Legislation (14 examples)
- What bills about fishing are currently before Parliament?
- What bills were updated recently?
- Show me details of bill 425
- What stages has bill 425 been through?
- What amendments were proposed for bill 425 at stage 15?
- Show me amendment 1234 for bill 425 stage 15
- What publications exist for bill 425?
- What news articles are there about bill 425?
- Show me all bill types available
- What are the different stages a bill can go through?
- Find bills related to the environment
- Get the RSS feed to track all bills
- Get the RSS feed for public bills
- Get the RSS feed for bill 425
Voting and Divisions (6 examples)
- How have MPs voted on refugee-related issues?
- Show details of Commons division 1234
- Show details of Lords division 5678
- Show how parties voted on climate issues in the Commons
- How did Lords vote by party on issues involving member 3743?
- How many votes have there been on Brexit?
Written Questions & Statements (8 examples)
- What written questions have MPs asked about climate change?
- Show me unanswered written questions to the Home Office
- Find written questions about the NHS from the last month
- Get details of written question 12345
- What written ministerial statements were made about the budget?
- Search for written statements about housing policy
- Show me the daily report of written questions for this week
- Has any MP asked written questions about artificial intelligence?
Committees and Inquiries (9 examples)
- Which committees are focused on women's issues?
- What committee meetings are scheduled this month?
- Show me details of committee 789
- What hearings has committee 789 held?
- Who are the members of committee 789?
- Find committee reports on healthcare
- What written evidence was submitted to committee 789?
- What oral evidence was given to committee 789?
- What are all the committee types?
Hansard (Official Record) (8 examples)
- Search Hansard for recent debates on Brexit
- What was said about immigration in the Commons last month?
- Show me the full transcript of debate abc123-def456
- What did Keir Starmer say during the debate on the economy?
- Were there any votes during the NHS funding debate?
- What debates happened in the Commons on March 15th 2024?
- Which days in January 2024 had Commons sittings?
- Show me all speeches by member 4514 in debate xyz789
Parliamentary Procedures (9 examples)
- Search Erskine May for references to the Mace
- What oral question times are coming up?
- What government departments exist?
- What are the answering bodies in Parliament?
- What parties are represented in the House of Commons?
- What parties are represented in the House of Lords?
- What's on the Commons calendar this month?
- When are the upcoming parliamentary recesses?
- What are the procedural rules for bill amendments?
Constituencies and Elections (3 examples)
- List all UK constituencies
- Show the election results for constituency 4359
- Search for constituencies containing "london"
Transparency and Interests (4 examples)
- List all categories of members' interests
- Get published registers of interests
- Show staff interests declared by Lords members
- Search the register of interests for member 1471
Official Documents and Publications (5 examples)
- Are there any statutory instruments about harbours?
- Search Acts of Parliament that mention roads
- What treaties involve Spain?
- What publication types are available for bills?
- Show me document 123 from publication 456
Advanced Queries (5 examples)
- Show the full data from this pasted API result: {PasteApiResultHere}
- Show me the JSON returned from the last MCP call
- Show me the API URL you just used
- Search for bills sponsored by member 172 from the Environment department
- Find committee meetings about climate change in the last few months
Alternative Installation Methods
The uvx method shown above is recommended for most users. For specific use cases, here are alternative approaches:
Which Method Should I Use?
| Method | Best For | Pros | Cons |
|---|---|---|---|
uvx uk-parliament-mcp |
Most users | No install needed, always latest version | Requires uvx installed |
pip install uk-parliament-mcp |
Production use | Stable, version locked | Requires pip, manual updates |
| Local development install | Contributors | Full source access, can modify | More complex setup |
Using pip install
Install the package globally:
pip install uk-parliament-mcp
Then configure your AI client:
Claude Desktop:
{
"mcpServers": {
"uk-parliament": {
"command": "uk-parliament-mcp"
}
}
}
VS Code: Use uk-parliament-mcp as the command when adding the MCP server.
Installation from Source
For development or to get the latest unreleased changes:
Prerequisites
Clone and Install
git clone https://github.com/ChrisBrooksbank/uk-parliament-mcp-lab.git
cd uk-parliament-mcp-lab
# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate # Linux/Mac
# .venv\Scripts\activate # Windows
# Install the package
pip install -e .
Configure for Local Development
Claude Desktop:
{
"mcpServers": {
"uk-parliament": {
"command": "C:\\code\\uk-parliament-mcp-lab\\.venv\\Scripts\\python.exe",
"args": ["-m", "uk_parliament_mcp"],
"cwd": "C:\\code\\uk-parliament-mcp-lab"
}
}
}
VS Code: Use the full path to the virtual environment Python:
C:\code\uk-parliament-mcp-lab\.venv\Scripts\python.exe -m uk_parliament_mcp
Final Thoughts
The project is under active development, with plans to increase data coverage and improve interaction quality. Contributions and feedback are welcome.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uk_parliament_mcp-1.2.1.tar.gz.
File metadata
- Download URL: uk_parliament_mcp-1.2.1.tar.gz
- Upload date:
- Size: 154.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
598342cc3ec5590ab5ff24f9633694474b72b357a1e1e0ebf3550d19344fb615
|
|
| MD5 |
2edce887bc71e4d2d98a62d7b9134bb1
|
|
| BLAKE2b-256 |
134ffc78718b57e30a19615c44685191320293c1420f4e39f76afb1b609f63cd
|
Provenance
The following attestation bundles were made for uk_parliament_mcp-1.2.1.tar.gz:
Publisher:
publish.yml on ChrisBrooksbank/uk-parliament-mcp-lab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
uk_parliament_mcp-1.2.1.tar.gz -
Subject digest:
598342cc3ec5590ab5ff24f9633694474b72b357a1e1e0ebf3550d19344fb615 - Sigstore transparency entry: 909132546
- Sigstore integration time:
-
Permalink:
ChrisBrooksbank/uk-parliament-mcp-lab@a2d41449b5db8341b29c6ba11ca00b352010d5ef -
Branch / Tag:
refs/tags/v1.2.1 - Owner: https://github.com/ChrisBrooksbank
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a2d41449b5db8341b29c6ba11ca00b352010d5ef -
Trigger Event:
release
-
Statement type:
File details
Details for the file uk_parliament_mcp-1.2.1-py3-none-any.whl.
File metadata
- Download URL: uk_parliament_mcp-1.2.1-py3-none-any.whl
- Upload date:
- Size: 48.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c294a49010ecc92137bd5d1e4de9c270157be387f5dcf214b0a526f6a34d44bf
|
|
| MD5 |
54edaf016e221989084b3ae9620f9615
|
|
| BLAKE2b-256 |
c00e32d2addb6fae5a212dc6b14333bc7ee38d73e441e44aa4d7aaf1c68ce801
|
Provenance
The following attestation bundles were made for uk_parliament_mcp-1.2.1-py3-none-any.whl:
Publisher:
publish.yml on ChrisBrooksbank/uk-parliament-mcp-lab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
uk_parliament_mcp-1.2.1-py3-none-any.whl -
Subject digest:
c294a49010ecc92137bd5d1e4de9c270157be387f5dcf214b0a526f6a34d44bf - Sigstore transparency entry: 909132604
- Sigstore integration time:
-
Permalink:
ChrisBrooksbank/uk-parliament-mcp-lab@a2d41449b5db8341b29c6ba11ca00b352010d5ef -
Branch / Tag:
refs/tags/v1.2.1 - Owner: https://github.com/ChrisBrooksbank
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a2d41449b5db8341b29c6ba11ca00b352010d5ef -
Trigger Event:
release
-
Statement type: