uk-parliament-mcp 1.0.0__tar.gz → 1.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- uk_parliament_mcp-1.0.1/CLAUDE.md +294 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/IMPLEMENTATION_PLAN.md +1 -1
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/PKG-INFO +23 -54
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/README.md +22 -53
- uk_parliament_mcp-1.0.1/specs/agent-guidance-spec.md +164 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/__init__.py +1 -1
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/__main__.py +1 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/http_client.py +1 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/server.py +8 -1
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/tools/bills.py +1 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/tools/committees.py +1 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/tools/commons_votes.py +1 -0
- uk_parliament_mcp-1.0.1/src/uk_parliament_mcp/tools/composite.py +292 -0
- uk_parliament_mcp-1.0.1/src/uk_parliament_mcp/tools/core.py +880 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/tools/erskine_may.py +1 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/tools/hansard.py +1 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/tools/interests.py +1 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/tools/lords_votes.py +1 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/tools/members.py +1 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/tools/now.py +1 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/tools/oral_questions.py +1 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/tools/statutory_instruments.py +1 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/tools/treaties.py +1 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/tools/whatson.py +1 -0
- uk_parliament_mcp-1.0.1/tests/test_tools/test_composite.py +217 -0
- uk_parliament_mcp-1.0.1/tests/test_tools/test_core.py +413 -0
- uk_parliament_mcp-1.0.0/CLAUDE.md +0 -160
- uk_parliament_mcp-1.0.0/src/uk_parliament_mcp/tools/core.py +0 -28
- uk_parliament_mcp-1.0.0/tests/test_tools/test_core.py +0 -87
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/.github/workflows/ci.yml +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/.github/workflows/publish.yml +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/.gitignore +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/.python-version +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/AGENTS.md +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/PROMPT_build.md +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/PROMPT_plan.md +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/config/claude_desktop_config.json.example +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/config/vscode_mcp_config.json.example +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/context/bills-api.json +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/context/committees-api.json +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/context/commonsvotes-api.json +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/context/erskinemay-api.json +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/context/hansard-api.json +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/context/interests-api.json +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/context/lordsvotes-api.json +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/context/members-api.json +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/context/oralquestions-api.json +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/context/parliamentnow-api.json +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/context/readme.md +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/context/statutoryinstruments-api.json +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/context/treaties-api.json +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/context/whatson-api.json +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/context/writtenquestions-api.json +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/loop.sh +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/pyproject.toml +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/specs/python-migration-spec.md +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/src/uk_parliament_mcp/tools/__init__.py +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/tests/__init__.py +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/tests/conftest.py +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/tests/test_http_client.py +0 -0
- {uk_parliament_mcp-1.0.0 → uk_parliament_mcp-1.0.1}/tests/test_tools/__init__.py +0 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
UK Parliament MCP Server - A Model Context Protocol server that bridges AI assistants with official UK Parliament data APIs. Built with Python 3.11+, it provides 94 tools covering MPs/Lords, bills, votes, committees, Hansard, and more.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# From PyPI (recommended)
|
|
13
|
+
pip install uk-parliament-mcp
|
|
14
|
+
|
|
15
|
+
# Or run without installing
|
|
16
|
+
uvx uk-parliament-mcp
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Development Setup
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Create virtual environment and install dependencies
|
|
23
|
+
python -m venv .venv
|
|
24
|
+
source .venv/bin/activate # Linux/Mac
|
|
25
|
+
# .venv\Scripts\activate # Windows
|
|
26
|
+
|
|
27
|
+
pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
# Run the MCP server (stdio transport)
|
|
30
|
+
python -m uk_parliament_mcp
|
|
31
|
+
|
|
32
|
+
# Run tests
|
|
33
|
+
pytest
|
|
34
|
+
|
|
35
|
+
# Type checking
|
|
36
|
+
mypy src/
|
|
37
|
+
|
|
38
|
+
# Linting
|
|
39
|
+
ruff check src/
|
|
40
|
+
ruff format src/
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## CI/CD
|
|
44
|
+
|
|
45
|
+
GitHub Actions workflows in `.github/workflows/`:
|
|
46
|
+
|
|
47
|
+
- **ci.yml**: Runs on push/PR - linting (ruff), type checking (mypy), tests (pytest)
|
|
48
|
+
- **publish.yml**: Runs on GitHub Release - builds and publishes to PyPI via Trusted Publishing
|
|
49
|
+
|
|
50
|
+
**Release process:**
|
|
51
|
+
1. Update version in `src/uk_parliament_mcp/__init__.py`
|
|
52
|
+
2. Commit and push
|
|
53
|
+
3. Create GitHub Release with tag (e.g., `v1.0.1`)
|
|
54
|
+
4. Package auto-publishes to PyPI
|
|
55
|
+
|
|
56
|
+
## Architecture
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
AI Assistant ──(MCP/stdio)──> uk_parliament_mcp ──(HTTP)──> UK Parliament APIs
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Key Components:**
|
|
63
|
+
|
|
64
|
+
- **`__main__.py`**: Entry point. Configures logging to stderr (stdout reserved for MCP protocol), creates and runs the FastMCP server.
|
|
65
|
+
|
|
66
|
+
- **`server.py`**: FastMCP server setup. Creates the MCP server with server-level instructions and registers all tool modules.
|
|
67
|
+
|
|
68
|
+
- **`http_client.py`**: HTTP client with retry logic. Provides:
|
|
69
|
+
- HTTP request handling with 3-retry exponential backoff
|
|
70
|
+
- 30-second timeout protection
|
|
71
|
+
- URL building with parameter filtering (`build_url`)
|
|
72
|
+
- Consistent response format: `{url, data}` or `{url, error, statusCode}`
|
|
73
|
+
|
|
74
|
+
- **`tools/*.py`**: 15 tool modules (94 total tools) each targeting a specific Parliament API:
|
|
75
|
+
| Module | API Domain | Purpose |
|
|
76
|
+
|--------|------------|---------|
|
|
77
|
+
| composite.py | Multiple APIs | High-level tools combining multiple API calls |
|
|
78
|
+
| members.py | members-api.parliament.uk | MPs, Lords, constituencies, parties |
|
|
79
|
+
| bills.py | bills-api.parliament.uk | Legislation, amendments, stages |
|
|
80
|
+
| commons_votes.py | commonsvotes-api.parliament.uk | Commons divisions |
|
|
81
|
+
| lords_votes.py | lordsvotes-api.parliament.uk | Lords divisions |
|
|
82
|
+
| committees.py | committees-api.parliament.uk | Committee info, evidence |
|
|
83
|
+
| hansard.py | hansard-api.parliament.uk | Parliamentary record |
|
|
84
|
+
| oral_questions.py | oralquestionsandmotions-api.parliament.uk | EDMs, questions |
|
|
85
|
+
| interests.py | interests-api.parliament.uk | Register of interests |
|
|
86
|
+
| now.py | now-api.parliament.uk | Live chamber activity |
|
|
87
|
+
| whatson.py | whatson-api.parliament.uk | Calendar, sessions |
|
|
88
|
+
| statutory_instruments.py | statutoryinstruments-api.parliament.uk | Acts, SIs |
|
|
89
|
+
| treaties.py | treaties-api.parliament.uk | International treaties |
|
|
90
|
+
| erskine_may.py | erskinemay-api.parliament.uk | Procedure rules |
|
|
91
|
+
| core.py | N/A | Session management & agent guidance |
|
|
92
|
+
|
|
93
|
+
- **`context/`**: OpenAPI spec JSON files for each Parliament API (reference documentation)
|
|
94
|
+
|
|
95
|
+
## Adding New Tools
|
|
96
|
+
|
|
97
|
+
Follow the established pattern in any `tools/*.py` file:
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
"""New API tools for [description]."""
|
|
101
|
+
from urllib.parse import quote
|
|
102
|
+
|
|
103
|
+
from mcp.server.fastmcp import FastMCP
|
|
104
|
+
|
|
105
|
+
from uk_parliament_mcp.http_client import build_url, get_result
|
|
106
|
+
|
|
107
|
+
NEW_API_BASE = "https://api.parliament.uk"
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def register_tools(mcp: FastMCP) -> None:
|
|
111
|
+
"""Register new tools with the MCP server."""
|
|
112
|
+
|
|
113
|
+
@mcp.tool()
|
|
114
|
+
async def get_something(param: str) -> str:
|
|
115
|
+
"""Action | keywords, synonyms | Use case | Returns format
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
param: Description of the parameter.
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
Description of what is returned.
|
|
122
|
+
"""
|
|
123
|
+
url = f"{NEW_API_BASE}/endpoint?param={quote(param)}"
|
|
124
|
+
return await get_result(url)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Tool descriptions use a 4-part semantic format: `Action | Keywords | Use case | Returns`
|
|
128
|
+
|
|
129
|
+
Then register in `server.py`:
|
|
130
|
+
```python
|
|
131
|
+
from uk_parliament_mcp.tools import new_api
|
|
132
|
+
# ...
|
|
133
|
+
new_api.register_tools(mcp)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Key Conventions
|
|
137
|
+
|
|
138
|
+
- **House IDs**: 1 = Commons, 2 = Lords
|
|
139
|
+
- **Date format**: YYYY-MM-DD throughout
|
|
140
|
+
- **Pagination**: `skip`/`take` parameters where supported
|
|
141
|
+
- All tools are read-only and idempotent
|
|
142
|
+
- Raw JSON responses from Parliament APIs are passed through (not transformed)
|
|
143
|
+
- Use `build_url(base, params)` for URL construction with parameter filtering
|
|
144
|
+
- Use `await get_result(url)` for HTTP requests with retry logic
|
|
145
|
+
|
|
146
|
+
## Server Instructions (Automatic Context)
|
|
147
|
+
|
|
148
|
+
The server provides automatic context to MCP clients via the `instructions` parameter in FastMCP. This means:
|
|
149
|
+
|
|
150
|
+
- **No initialization required**: Clients receive guidance during MCP handshake without needing to call `hello_parliament()` or `/parliament` first
|
|
151
|
+
- **Automatic behavior**: Per MCP spec, clients may add these instructions to the system prompt
|
|
152
|
+
- **Consistent sessions**: Every session starts with proper guidance about data sources and citation requirements
|
|
153
|
+
|
|
154
|
+
The instructions use the same `SYSTEM_PROMPT` from `core.py`, ensuring consistency across all initialization methods.
|
|
155
|
+
|
|
156
|
+
**How clients receive context:**
|
|
157
|
+
1. Client connects to MCP server
|
|
158
|
+
2. Server responds with `instructions` in initialize response
|
|
159
|
+
3. Client incorporates instructions (implementation varies by client)
|
|
160
|
+
4. Assistant automatically knows to use Parliament tools and cite sources
|
|
161
|
+
|
|
162
|
+
## Agent Skill (MCP Prompt)
|
|
163
|
+
|
|
164
|
+
The server also provides a `/parliament` agent skill that appears in the "/" command menu in MCP clients like Claude Desktop:
|
|
165
|
+
|
|
166
|
+
### `/parliament` (or `parliament` prompt)
|
|
167
|
+
Initialize a UK Parliament research session. Invocable as a slash command in Claude Desktop.
|
|
168
|
+
|
|
169
|
+
**Parameters:**
|
|
170
|
+
- `topic` (optional) - Jump directly to detailed guidance for a specific domain
|
|
171
|
+
|
|
172
|
+
**Example usage in Claude Desktop:**
|
|
173
|
+
```
|
|
174
|
+
/parliament # Start session with quick reference
|
|
175
|
+
/parliament members # Start session + detailed members guidance
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
This prompt is separate from the guidance **tools** below - prompts appear in the "/" menu and provide session context, while tools are called explicitly during research.
|
|
179
|
+
|
|
180
|
+
## Composite Tools
|
|
181
|
+
|
|
182
|
+
High-level tools that combine multiple API calls for common research tasks. Use these first for efficiency:
|
|
183
|
+
|
|
184
|
+
### `get_mp_profile(name)`
|
|
185
|
+
Get comprehensive MP/Lord profile in one call. Combines member search + biography + interests + voting.
|
|
186
|
+
- Returns: Basic info, biography, registered interests, recent votes
|
|
187
|
+
- Example: `get_mp_profile("Keir Starmer")`
|
|
188
|
+
|
|
189
|
+
### `check_mp_vote(mp_name, topic)`
|
|
190
|
+
Check how an MP voted on a specific topic. Combines member search + division lookup.
|
|
191
|
+
- Returns: MP info and divisions on the topic where they voted
|
|
192
|
+
- Example: `check_mp_vote("Boris Johnson", "climate")`
|
|
193
|
+
|
|
194
|
+
### `get_bill_overview(search_term)`
|
|
195
|
+
Get comprehensive bill overview. Combines bill search + details + stages + publications.
|
|
196
|
+
- Returns: Bill details, legislative stages, associated documents
|
|
197
|
+
- Example: `get_bill_overview("Online Safety")`
|
|
198
|
+
|
|
199
|
+
### `get_committee_summary(topic)`
|
|
200
|
+
Get comprehensive committee summary. Combines committee search + details + evidence + publications.
|
|
201
|
+
- Returns: Committee info, witness testimonies, written submissions, reports
|
|
202
|
+
- Example: `get_committee_summary("Treasury")`
|
|
203
|
+
|
|
204
|
+
## Agent Guidance Tools
|
|
205
|
+
|
|
206
|
+
The server also includes guidance **tools** to help AI assistants navigate the 94 available tools:
|
|
207
|
+
|
|
208
|
+
### `hello_parliament()`
|
|
209
|
+
Initialize a parliamentary research session (optional with server instructions). Returns:
|
|
210
|
+
- System prompt with data source transparency requirements
|
|
211
|
+
- Quick reference of all tool categories with entry points
|
|
212
|
+
- Key conventions (house IDs, date formats, pagination)
|
|
213
|
+
|
|
214
|
+
### `goodbye_parliament()`
|
|
215
|
+
End the parliamentary session and restore normal assistant behavior.
|
|
216
|
+
|
|
217
|
+
### `parliament_guide(topic)`
|
|
218
|
+
Get detailed guidance for a specific domain. Available topics:
|
|
219
|
+
- `composite` - 4 high-level tools combining multiple API calls
|
|
220
|
+
- `members` - 26 tools for MPs, Lords, constituencies, parties
|
|
221
|
+
- `bills` - 21 tools for legislation, amendments, stages
|
|
222
|
+
- `votes` - 10 tools for Commons and Lords divisions
|
|
223
|
+
- `committees` - 12 tools for committee info, meetings, evidence
|
|
224
|
+
- `hansard` - Parliamentary record search
|
|
225
|
+
- `questions` - EDMs, oral questions
|
|
226
|
+
- `interests` - Register of Interests
|
|
227
|
+
- `live` - Current activity, calendar (now + whatson)
|
|
228
|
+
- `legislation` - SIs, treaties
|
|
229
|
+
- `procedures` - Erskine May, bill types, stage definitions
|
|
230
|
+
- `all` - Condensed reference of all 94 tools
|
|
231
|
+
- `conventions` - Date formats, house IDs, pagination
|
|
232
|
+
- `workflows` - Overview of common research patterns
|
|
233
|
+
|
|
234
|
+
### `parliament_workflow(query)`
|
|
235
|
+
Get step-by-step workflow for a research task. Matches queries to predefined patterns:
|
|
236
|
+
- "How did my MP vote on X?" → MP voting workflow
|
|
237
|
+
- "Track bill progress" → Bill tracking workflow
|
|
238
|
+
- "What committee examined X?" → Committee research workflow
|
|
239
|
+
- "Does MP have conflicts of interest?" → Interests workflow
|
|
240
|
+
- "What's happening now?" → Live activity workflow
|
|
241
|
+
- And more (backgrounds, Hansard, elections, EDMs, treaties)
|
|
242
|
+
|
|
243
|
+
Example usage:
|
|
244
|
+
```
|
|
245
|
+
# Start session
|
|
246
|
+
hello_parliament()
|
|
247
|
+
|
|
248
|
+
# Get detailed guidance
|
|
249
|
+
parliament_guide("members")
|
|
250
|
+
|
|
251
|
+
# Plan a research task
|
|
252
|
+
parliament_workflow("How did my MP vote on climate?")
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Dependencies
|
|
256
|
+
|
|
257
|
+
- mcp (>=1.0.0) - Anthropic's official MCP library
|
|
258
|
+
- httpx (>=0.27.0) - Async HTTP client
|
|
259
|
+
- tenacity (>=8.2.0) - Retry logic (available but manual retry used)
|
|
260
|
+
|
|
261
|
+
### Dev Dependencies
|
|
262
|
+
|
|
263
|
+
- pytest (>=8.0.0) - Testing
|
|
264
|
+
- pytest-asyncio (>=0.23.0) - Async test support
|
|
265
|
+
- pytest-httpx (>=0.30.0) - HTTP mocking
|
|
266
|
+
- ruff (>=0.3.0) - Linting and formatting
|
|
267
|
+
- mypy (>=1.8.0) - Type checking
|
|
268
|
+
|
|
269
|
+
## Project Structure
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
src/uk_parliament_mcp/
|
|
273
|
+
├── __init__.py
|
|
274
|
+
├── __main__.py # Entry point
|
|
275
|
+
├── server.py # FastMCP server setup
|
|
276
|
+
├── http_client.py # HTTP client with retry
|
|
277
|
+
└── tools/
|
|
278
|
+
├── __init__.py
|
|
279
|
+
├── core.py # Session management & guidance (4 tools)
|
|
280
|
+
├── composite.py # High-level composite tools (4 tools)
|
|
281
|
+
├── members.py # Member tools (26 tools)
|
|
282
|
+
├── bills.py # Bills tools (21 tools)
|
|
283
|
+
├── committees.py # Committees tools (12 tools)
|
|
284
|
+
├── commons_votes.py # Commons votes (5 tools)
|
|
285
|
+
├── lords_votes.py # Lords votes (5 tools)
|
|
286
|
+
├── hansard.py # Hansard (1 tool)
|
|
287
|
+
├── oral_questions.py # Questions (3 tools)
|
|
288
|
+
├── interests.py # Interests (3 tools)
|
|
289
|
+
├── now.py # Live activity (2 tools)
|
|
290
|
+
├── whatson.py # Calendar (3 tools)
|
|
291
|
+
├── statutory_instruments.py # SIs (2 tools)
|
|
292
|
+
├── treaties.py # Treaties (1 tool)
|
|
293
|
+
└── erskine_may.py # Procedure (1 tool)
|
|
294
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: uk-parliament-mcp
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: UK Parliament MCP Server - bridges AI assistants with UK Parliament APIs
|
|
5
5
|
Author: Chris Brooksbank
|
|
6
6
|
License: MIT
|
|
@@ -24,35 +24,29 @@ Description-Content-Type: text/markdown
|
|
|
24
24
|
|
|
25
25
|
# UK Parliament AI Assistant
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Access official UK Parliament data through AI assistants. Query MPs, Lords, bills, votes, committees, debates, and more.
|
|
28
28
|
|
|
29
|
-
##
|
|
29
|
+
## Quick Install
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Or you can copy and past the following instead :
|
|
36
|
-
|
|
37
|
-
```plaintext
|
|
38
|
-
You are a helpful assistant that answers questions using only data from UK Parliament MCP servers.
|
|
39
|
-
|
|
40
|
-
When the session begins, introduce yourself with a brief message such as:
|
|
41
|
-
|
|
42
|
-
"Hello! I’m a parliamentary data assistant. I can help answer questions using official data from the UK Parliament MCP APIs. Just ask me something, and I’ll fetch what I can — and I’ll always show you which sources I used."
|
|
31
|
+
```bash
|
|
32
|
+
# Install from PyPI (recommended)
|
|
33
|
+
pip install uk-parliament-mcp
|
|
43
34
|
|
|
44
|
-
|
|
35
|
+
# Or run without installing
|
|
36
|
+
uvx uk-parliament-mcp
|
|
37
|
+
```
|
|
45
38
|
|
|
46
|
-
|
|
39
|
+
## Getting Started
|
|
47
40
|
|
|
48
|
-
|
|
41
|
+
**Step 1:** Install the package (see Quick Install above)
|
|
49
42
|
|
|
50
|
-
|
|
43
|
+
**Step 2:** Configure your AI assistant (see [Claude Desktop](#add-mcp-server-in-claude-desktop-application) or [VS Code](#add-mcp-server-in-vs-code) setup below)
|
|
51
44
|
|
|
52
|
-
|
|
45
|
+
**Step 3:** Start a parliamentary research session:
|
|
46
|
+
- Use the `/parliament` slash command (in Claude Desktop or compatible MCP clients)
|
|
47
|
+
- Or say "Hello Parliament" to initialize the session
|
|
53
48
|
|
|
54
|
-
|
|
55
|
-
```
|
|
49
|
+
This gives your AI assistant the context it needs to effectively use the 94 available tools.
|
|
56
50
|
|
|
57
51
|
## What Can I Ask?
|
|
58
52
|
|
|
@@ -68,42 +62,17 @@ You can ask questions about virtually all aspects of UK Parliament data. Here ar
|
|
|
68
62
|
* **Official Documents:** "Are there any statutory instruments about housing?" or "What treaties involve trade agreements?"
|
|
69
63
|
* **Transparency Data:** "Show register of interests for Treasury ministers" or "What are the declared interests categories?"
|
|
70
64
|
|
|
71
|
-
## Disconnecting from
|
|
72
|
-
|
|
73
|
-
Start a new chat session, or to keep context but disconnect from Parliament MCP servers prompt : "Goodbye Parliament"
|
|
74
|
-
|
|
75
|
-
## How Does It Work?
|
|
76
|
-
|
|
77
|
-
When you ask a question to an AI assistant connected to this tool, it doesn't just guess the answer. Instead, the assistant uses this project to query the official UK Parliament database and provides a response based on the data it finds.
|
|
65
|
+
## Disconnecting from Parliament
|
|
78
66
|
|
|
79
|
-
|
|
67
|
+
Start a new chat session, or say "Goodbye Parliament" to end the parliamentary session while keeping context.
|
|
80
68
|
|
|
81
69
|
---
|
|
82
70
|
|
|
83
|
-
## Installation
|
|
71
|
+
## Full Installation Guide
|
|
84
72
|
|
|
85
|
-
This project
|
|
73
|
+
This project uses the [Model Context Protocol (MCP)](https://www.anthropic.com/news/model-context-protocol) to make UK Parliamentary data accessible to AI assistants like Claude Desktop and Microsoft Copilot.
|
|
86
74
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
> ✅ This project provides comprehensive coverage of UK Parliamentary data including members, bills, amendments, voting records, committees, debates, procedures, constituencies, and official documents.
|
|
90
|
-
> Additional data sources and endpoints are continuously being added.
|
|
91
|
-
|
|
92
|
-
Since AI is involved, some responses may be inaccurate. See **Prompting Tips** below to improve reliability.
|
|
93
|
-
|
|
94
|
-
### Quick Install (Recommended)
|
|
95
|
-
|
|
96
|
-
Install directly from PyPI:
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
pip install uk-parliament-mcp
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Or run without installing using uvx:
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
uvx uk-parliament-mcp
|
|
106
|
-
```
|
|
75
|
+
> **Note**: Since AI is involved, some responses may be inaccurate. See **Prompting Tips** below to improve reliability.
|
|
107
76
|
|
|
108
77
|
### Installation from Source
|
|
109
78
|
|
|
@@ -233,9 +202,9 @@ What is happening now in the House of Commons?
|
|
|
233
202
|
|
|
234
203
|
### Prompting Tips
|
|
235
204
|
|
|
236
|
-
#### ✅
|
|
205
|
+
#### ✅ Initialize Your Session
|
|
237
206
|
|
|
238
|
-
Always begin your session with
|
|
207
|
+
Always begin your session with `/parliament` or "Hello Parliament". This ensures the AI assistant uses the correct tools and cites its sources properly.
|
|
239
208
|
|
|
240
209
|
#### 🔄 Clear Context
|
|
241
210
|
|
|
@@ -1,34 +1,28 @@
|
|
|
1
1
|
# UK Parliament AI Assistant
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Access official UK Parliament data through AI assistants. Query MPs, Lords, bills, votes, committees, debates, and more.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Quick Install
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Or you can copy and past the following instead :
|
|
12
|
-
|
|
13
|
-
```plaintext
|
|
14
|
-
You are a helpful assistant that answers questions using only data from UK Parliament MCP servers.
|
|
15
|
-
|
|
16
|
-
When the session begins, introduce yourself with a brief message such as:
|
|
17
|
-
|
|
18
|
-
"Hello! I’m a parliamentary data assistant. I can help answer questions using official data from the UK Parliament MCP APIs. Just ask me something, and I’ll fetch what I can — and I’ll always show you which sources I used."
|
|
7
|
+
```bash
|
|
8
|
+
# Install from PyPI (recommended)
|
|
9
|
+
pip install uk-parliament-mcp
|
|
19
10
|
|
|
20
|
-
|
|
11
|
+
# Or run without installing
|
|
12
|
+
uvx uk-parliament-mcp
|
|
13
|
+
```
|
|
21
14
|
|
|
22
|
-
|
|
15
|
+
## Getting Started
|
|
23
16
|
|
|
24
|
-
|
|
17
|
+
**Step 1:** Install the package (see Quick Install above)
|
|
25
18
|
|
|
26
|
-
|
|
19
|
+
**Step 2:** Configure your AI assistant (see [Claude Desktop](#add-mcp-server-in-claude-desktop-application) or [VS Code](#add-mcp-server-in-vs-code) setup below)
|
|
27
20
|
|
|
28
|
-
|
|
21
|
+
**Step 3:** Start a parliamentary research session:
|
|
22
|
+
- Use the `/parliament` slash command (in Claude Desktop or compatible MCP clients)
|
|
23
|
+
- Or say "Hello Parliament" to initialize the session
|
|
29
24
|
|
|
30
|
-
|
|
31
|
-
```
|
|
25
|
+
This gives your AI assistant the context it needs to effectively use the 94 available tools.
|
|
32
26
|
|
|
33
27
|
## What Can I Ask?
|
|
34
28
|
|
|
@@ -44,42 +38,17 @@ You can ask questions about virtually all aspects of UK Parliament data. Here ar
|
|
|
44
38
|
* **Official Documents:** "Are there any statutory instruments about housing?" or "What treaties involve trade agreements?"
|
|
45
39
|
* **Transparency Data:** "Show register of interests for Treasury ministers" or "What are the declared interests categories?"
|
|
46
40
|
|
|
47
|
-
## Disconnecting from
|
|
48
|
-
|
|
49
|
-
Start a new chat session, or to keep context but disconnect from Parliament MCP servers prompt : "Goodbye Parliament"
|
|
50
|
-
|
|
51
|
-
## How Does It Work?
|
|
52
|
-
|
|
53
|
-
When you ask a question to an AI assistant connected to this tool, it doesn't just guess the answer. Instead, the assistant uses this project to query the official UK Parliament database and provides a response based on the data it finds.
|
|
41
|
+
## Disconnecting from Parliament
|
|
54
42
|
|
|
55
|
-
|
|
43
|
+
Start a new chat session, or say "Goodbye Parliament" to end the parliamentary session while keeping context.
|
|
56
44
|
|
|
57
45
|
---
|
|
58
46
|
|
|
59
|
-
## Installation
|
|
47
|
+
## Full Installation Guide
|
|
60
48
|
|
|
61
|
-
This project
|
|
49
|
+
This project uses the [Model Context Protocol (MCP)](https://www.anthropic.com/news/model-context-protocol) to make UK Parliamentary data accessible to AI assistants like Claude Desktop and Microsoft Copilot.
|
|
62
50
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
> ✅ This project provides comprehensive coverage of UK Parliamentary data including members, bills, amendments, voting records, committees, debates, procedures, constituencies, and official documents.
|
|
66
|
-
> Additional data sources and endpoints are continuously being added.
|
|
67
|
-
|
|
68
|
-
Since AI is involved, some responses may be inaccurate. See **Prompting Tips** below to improve reliability.
|
|
69
|
-
|
|
70
|
-
### Quick Install (Recommended)
|
|
71
|
-
|
|
72
|
-
Install directly from PyPI:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
pip install uk-parliament-mcp
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Or run without installing using uvx:
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
uvx uk-parliament-mcp
|
|
82
|
-
```
|
|
51
|
+
> **Note**: Since AI is involved, some responses may be inaccurate. See **Prompting Tips** below to improve reliability.
|
|
83
52
|
|
|
84
53
|
### Installation from Source
|
|
85
54
|
|
|
@@ -209,9 +178,9 @@ What is happening now in the House of Commons?
|
|
|
209
178
|
|
|
210
179
|
### Prompting Tips
|
|
211
180
|
|
|
212
|
-
#### ✅
|
|
181
|
+
#### ✅ Initialize Your Session
|
|
213
182
|
|
|
214
|
-
Always begin your session with
|
|
183
|
+
Always begin your session with `/parliament` or "Hello Parliament". This ensures the AI assistant uses the correct tools and cites its sources properly.
|
|
215
184
|
|
|
216
185
|
#### 🔄 Clear Context
|
|
217
186
|
|