# UK Parliament Monitor: Bills, Votes & New Laws (MCP) (`amygraphics/uk-parliament-monitor`) Actor

Official UK Parliament APIs unified: bills with live stage + sponsors, Commons & Lords votes with counts, MP/peer lookup. Monitor a watchlist for new bills, stage changes and divisions since the last run. MCP-ready.

- **URL**: https://apify.com/amygraphics/uk-parliament-monitor.md
- **Developed by:** [Zakaria el bouami](https://apify.com/amygraphics) (community)
- **Categories:** Lead generation, Automation, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## UK Parliament Monitor: Bills, Votes & New Laws (MCP)

Every bill moving through the UK Parliament, every Commons and Lords vote with the count, every MP and peer — **straight from the official parliament.uk APIs**, no key, no login. Search mode for one-off lookups, monitor mode for daily "what changed in Westminster" diffs. MCP-compatible, agent-ready.

### Why this data is hard (and worth it)

- The official Parliament data sits behind **four separate APIs** (bills, Commons divisions via an OData endpoint most people never find, Lords divisions with a different schema, and the members API) — each with its own pagination, date formats, and structure. This actor unifies all of them into one clean row per record.
- Bills move constantly: 4,000+ bills live in the system, stages change (first reading → second reading → committee → royal assent), titles are renamed, bills are withdrawn or defeated. An LLM answering "where is the Workers' Rights Bill now?" is guessing; this returns the **live stage**.
- Votes are reported per division with full **Aye/No (Commons) and Content/Not Content (Lords) counts** — the answer to "did it pass?" with numbers, not vibes.

### What you get per record

**Bills** (`recordKind: "bill"`): `billId`, `shortTitle`, `currentHouse`, `originatingHouse`, **`currentStage` + abbreviation**, `lastUpdateISO`, `isAct/isDefeated/billWithdrawn`, and in search mode `longTitle`, `summary` and `sponsors` (member + party, up to 8).

**Votes** (`recordKind: "vote"`): `divisionId`, `house`, `title`, `dateISO`, **`ayeCount` / `noCount`**, `resultWon` (`aye`/`no` or `content`/`not-content` for the Lords).

**Members** (`recordKind: "member"`): `memberId`, `memberName`, `party`, `house`, `constituency`, `membershipSince`.

### Mode `search`

```json
{ "mode": "search", "query": "artificial intelligence", "searchIn": "all", "daysBack": 30, "maxResults": 10 }
```

- Bills: keyword in title (recently updated subset), enriched with long title + sponsors.
- Votes: divisions in the last N days (default 30) matching the keyword.
- Members: MP/peer by name ("Starmer", "May", "Sunak").
- Charged **$0.001 per row**.

### Mode `monitor` — Westminster diff radar

```json
{ "mode": "monitor", "watchlist": ["energy", "immigration", "artificial intelligence"], "maxResults": 20 }
```

- **Run 1 = free baseline** (info row only): cursor + stage snapshot of current bills.
- **Run 2+**: emits only what changed —
  - `new-bill`: a bill matching your watchlist appeared,
  - **`stage-changed`: a watched bill just moved stage** (previous stage included — the moment journalists and lobbyists care about),
  - `bill-updated`: procedural updates to a watched bill,
  - `vote-held`: new Commons/Lords divisions whose title matches.
- Schedule daily; a quiet day costs **$0.001**. Webhook to Slack/Sheets via Apify.

### Three ready recipes

1. **Policy-agent brief** — as an MCP tool, your agent answers "what did Parliament do about AI this week?" with dated bills, stages, sponsor parties, and vote counts — sourced, not hallucinated.
2. **Bill tracking for lobbyists/NGOs** — monitor a watchlist (`["employment rights", "data protection"]`), get alerts the moment a tracked bill changes stage.
3. **Vote research** — search today's divisions on a topic, get per-division counts and outcomes for both Houses.

### Data honesty & limits

- Bill search covers the **most recently updated** bills (top ~200 by update date); the full archive (4,000+) is not keyword-indexed client-side — for deep history use bills.parliament.uk directly.
- Lords divisions use member counts when available; aggregated teller counts otherwise (source may vary slightly vs the live ticker).
- Written Questions are **not** included (the official Q\&A endpoints are unstable — we ship only reliable sources).
- All fields come from the official APIs at run time; no derived scores are invented.

### Sources (official, anonymous, no key)

- Bills: `bills-api.parliament.uk` · Members: `members-api.parliament.uk` · Commons divisions: `commonsvotes-api.parliament.uk` · Lords divisions: `lordsvotes-api.parliament.uk`

### Price

| event | price |
|---|---|
| Actor start | $0.001 |
| Parliament record extracted (bill/vote/member row) | $0.001 / row |

Typical runs: enriched 10-row search ≈ **$0.011** · daily radar with 3 stage changes + 2 new votes ≈ **$0.006**.

### MCP / AI-agent usage

Add the actor to your agent's tools, or call:

```
https://api.apify.com/v2/acts/YOUR_HANDLE~uk-parliament-monitor/run-sync-get-dataset-items?token=YOUR_TOKEN
```

Input = the JSON examples above. Output = the dataset rows described in the table. Compatible with per-request agentic payments.

Questions / feedback: see the actor's **Issues** tab on Apify Store.

# Actor input Schema

## `mode` (type: `string`):

search = query bills/votes/members. monitor = NEW bills, stage changes, updates and votes since the last run (first run = free baseline).

## `query` (type: `string`):

Keyword matched in bill titles and vote titles (e.g. 'energy', 'immigration'), or a member name (e.g. 'Starmer').

## `searchIn` (type: `string`):

Restrict the search to bills, votes, or members (default: all three).

## `daysBack` (type: `integer`):

How far back to search Commons & Lords divisions.

## `watchlist` (type: `array`):

Keywords watched in bill titles and vote titles. Empty = watch EVERYTHING (bills + all votes, capped by maxResults).

## `maxResults` (type: `integer`):

Maximum rows returned/charged per run.

## `requestDelaySecs` (type: `number`):

Politeness pacing between calls to the official Parliament APIs.

## `proxyConfiguration` (type: `object`):

Optional. The official parliament.uk endpoints do not require proxies.

## Actor input object example

```json
{
  "mode": "search",
  "query": "energy",
  "searchIn": "all",
  "daysBack": 30,
  "watchlist": [
    "energy",
    "immigration",
    "artificial intelligence"
  ],
  "maxResults": 10,
  "requestDelaySecs": 0.4
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("amygraphics/uk-parliament-monitor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("amygraphics/uk-parliament-monitor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call amygraphics/uk-parliament-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,amygraphics/uk-parliament-monitor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/bQwsuPeI2rVkQNzZJ/builds/xBr3g6MwE4Sl57xRp/openapi.json
