uk-ons-mcp-server

dwain-barnes/uk-ons-mcp-server

3.2

If you are the rightful owner of uk-ons-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The UK ONS MCP Server is a Model Context Protocol server designed to provide seamless access to the UK Office for National Statistics Beta API, allowing users to fetch official UK government statistics without the need for authentication.

Tools
  1. list_datasets

    Paginated list of all datasets

  2. get_dataset

    Metadata for a single dataset

  3. search_datasets

    Search by keyword

  4. get_observation

    Pull observations with dimension filters

  5. get_latest_data

    Convenience wrapper for the newest figures

UK ONS MCP Server 

npm version License: MIT GitHub

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.


Features

  • 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

Installation

# Global install
npm install -g uk_ons_mcp_server

# Or one‑off run
npx uk_ons_mcp_server

Usage (Claude Desktop)

{
  "mcpServers": {
    "uk-ons": {
      "command": "npx",
      "args": ["-y", "uk_ons_mcp_server"]
    }
  }
}

Available Tools

ToolPurpose
list_datasetsPaginated list of all datasets
get_datasetMetadata for a single dataset
search_datasetsSearch by keyword
get_observationPull observations with dimension filters
get_latest_dataConvenience wrapper for the newest figures

Popular Dataset IDs

IDWhat it is
cpih01CPIH (UK inflation)
regional-gdp-by-yearRegional GDP
wellbeing-local-authorityPersonal wellbeing
tradeUK trade stats
weekly-deaths-regionWeekly deaths

Development

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 & reload

Tests and linting:

npm test
npm run lint

Contributing

  1. Fork → branch → commit
  2. git push and open a PR
  3. Kindly follow the coding style in src/

License

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.