A Model Context Protocol (MCP) server for accessing the UK Office for National Statistics (ONS) Beta API.
Fetch official UK government statistics—demographics, economics, social data—straight from your MCP‑compatible assistant, no API key required.
- Direct ONS access – no authentication, no tokens
- Browse & search every published dataset
- Flexible queries – filter observations by geography, time, etc.
- Popular dataset shortcuts for CPIH, regional GDP, wellbeing & more
- Time‑series & regional comparisons built in
- 100 % MCP‑SDK TypeScript with robust error handling
# Global install
npm install -g uk_ons_mcp_server
# Or one‑off run
npx uk_ons_mcp_server{
"mcpServers": {
"uk-ons": {
"command": "npx",
"args": ["-y", "uk_ons_mcp_server"]
}
}
}| Tool | Purpose |
|---|---|
list_datasets |
Paginated list of all datasets |
get_dataset |
Metadata for a single dataset |
search_datasets |
Search by keyword |
get_observation |
Pull observations with dimension filters |
get_latest_data |
Convenience wrapper for the newest figures |
| ID | What it is |
|---|---|
cpih01 |
CPIH (UK inflation) |
regional-gdp-by-year |
Regional GDP |
wellbeing-local-authority |
Personal wellbeing |
trade |
UK trade stats |
weekly-deaths-region |
Weekly deaths |
git clone https://github.com/dwain-barnes/uk_ons_mcp_server.git
cd uk_ons_mcp_server
npm install
npm run build # compile TypeScript
npm start # production
npm run dev # watch & reloadTests and linting:
npm test
npm run lint- Fork → branch → commit
git pushand open a PR- Kindly follow the coding style in src/
MIT – see LICENSE.
Disclaimer
This project is unofficial and not endorsed by the UK Office for National Statistics. Data usage remains subject to ONS terms.