A Model Context Protocol server for UK Freedom of Information research. Connects AI assistants to WhatDoTheyKnow — the UK's largest FOI request platform — to search requests, read responses, look up public authorities, and draft new requests.
Fork note: This fork adds six new tools that expose Resources and scrape HTML correspondence:
get_request_detail,get_user_requests,get_authority_detailexpose existing MCP Resources as callable tools (essential for Claude.ai connectors)get_request_v2,get_request_messagesattempt v2 API endpoints (may not be available on all Alaveteli instances)get_request_correspondencescrapes and parses actual message bodies from HTML pages using browser impersonationThis is essential for MCP clients that can only invoke tools, not access Resources directly. Upstream: paulieb89/whatdotheyknow-mcp
| Tool | Description |
|---|---|
search_request_events |
Full-text search of FOI requests and responses via WhatDoTheyKnow's Atom feed. Supports structured expressions (status:successful, body:"Liverpool City Council"). |
search_authorities |
Search UK public authorities by name. Returns slug for use with other tools. |
get_request_feed_items |
Fetch the event timeline (sent, response, clarification) for a specific FOI request. |
get_request_detail |
NEW — Fetch the full JSON detail for an FOI request, including all correspondence text, status, dates, and attachments. |
get_request_v2 |
NEW — Attempt to fetch full request via Alaveteli v2 API (may not be available on all instances). |
get_request_messages |
NEW — Attempt to fetch dedicated message list via v2 API (may not be available on all instances). |
get_request_correspondence |
NEW — Scrape and parse actual message bodies from HTML request pages using browser impersonation + BeautifulSoup. This provides the actual text that the JSON API omits. |
get_user_requests |
NEW — Fetch a user's profile and list of all their FOI requests with titles, slugs, statuses, and authorities. |
get_authority_detail |
NEW — Fetch full detail for a public authority, including contact info, description, and recent requests. |
build_request_url |
Build a prefilled WhatDoTheyKnow request URL for a given authority and topic. |
create_request_record |
Create a request via the write API (requires WDTK_API_KEY). |
update_request_state |
Update user-assessed state of a request (requires WDTK_API_KEY). |
| URI template | Returns |
|---|---|
wdtk://authorities/{authority_slug} |
Authority profile JSON |
wdtk://requests/{request_slug} |
FOI request detail JSON |
wdtk://users/{user_slug} |
User profile JSON |
wdtk://requests/{request_slug}/feed |
Request event Atom feed |
wdtk://users/{user_slug}/feed |
User activity Atom feed |
wdtk://authorities/all.csv |
Full CSV of all UK public authorities |
| Prompt | Description |
|---|---|
draft_foi_request |
Draft a narrow, specific FOI request for a given authority and topic. |
The upstream MCP server defines Resources for reading request detail, user profiles, and authority info — but many MCP clients (including Claude.ai's connector system) can only call tools, not access Resources. This fork adds three tools that wrap those Resources:
Returns the complete JSON for an FOI request, including:
- Original request text and all response correspondence
- Current status and described state
- Dates (created, updated)
- Public body info
- Full
info_request_eventsarray with every message
Example: get_request_detail("payroll_system_synchronization_f_2")
Returns a user's profile and all their FOI requests, including:
- Display name and about text
- Array of
info_requestswith titles, slugs, statuses, and authorities
Example: get_user_requests("g_spinks")
Returns full authority profile, including:
- Name, description, home page
- Request email and tag string
- Recent requests made to this authority
Example: get_authority_detail("essex_police")
Attempt to fetch request data via the Alaveteli v2 API. These endpoints may not be available on all Alaveteli instances (including WhatDoTheyKnow). The request_id is the numeric ID found in v1 API responses.
Caveat: WhatDoTheyKnow currently returns errors on these endpoints (they may be admin-only or not implemented on this instance).
Scrapes and parses the actual message bodies from the HTML request page. This solves the original problem — the JSON API truncates or omits message text, but this tool fetches the HTML page using browser impersonation (curl-cffi with Safari 17 user agent) and parses it with BeautifulSoup to extract the complete correspondence.
Returns:
title: request titlestatus: current statusmessages: list of message objects withtype,date,from, andbodyurl: link to the original requestnote: clarification that this is HTML-scraped data
Example: get_request_correspondence("payroll_system_synchronization_f_2")
Note: This tool performs real HTTP requests and HTML parsing, so it's slightly slower than JSON API calls. It respects rate limits and uses browser impersonation to avoid blocks.
{
"mcpServers": {
"whatdotheyknow": {
"type": "http",
"url": "https://whatdotheyknow-mcp.fly.dev/mcp"
}
}
}{
"mcpServers": {
"whatdotheyknow": {
"type": "stdio",
"command": "uvx",
"args": ["whatdotheyknow-mcp"]
}
}
}| Variable | Required | Description |
|---|---|---|
WDTK_API_KEY |
Optional | Enables create_request_record and update_request_state write tools |
| Source | API | Licence | Auth |
|---|---|---|---|
| WhatDoTheyKnow | www.whatdotheyknow.com |
OGL v3 | None (read) / API key (write) |
Data is sourced directly from the WhatDoTheyKnow public API. The platform is operated by mySociety.