NHS MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@NHS MCP Server Search for paracetamol prescriptions in Jan 2024"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
NHS MCP Server
An MCP (Model Context Protocol) server that provides AI assistants with access to NHS public health datasets. Query prescribing data, explore datasets, and look up NHS organisations directly from Cursor, Claude Desktop, or any MCP-compatible host.
Quick Start
Prerequisites
Node.js 20+
npm
Install and Build
npm install
npm run buildConfigure Cursor
The project includes a .cursor/mcp.json that registers the server automatically. After building, restart Cursor to pick up the MCP server.
To configure manually in any MCP host, register a stdio server:
{
"mcpServers": {
"nhs": {
"command": "node",
"args": ["/path/to/nhs-mcp/dist/index.js"]
}
}
}Related MCP server: OpenFDA FastMCP Server
Available Tools
datasets_list
List all available datasets on the NHSBSA Open Data Portal.
Parameters:
search_query(optional) — Filter datasets by title or description
Example prompt: "List all NHS datasets related to prescribing"
datasets_metadata
Get detailed metadata for a specific dataset, including resource IDs needed for querying.
Parameters:
dataset_id(required) — Dataset name or ID
Example prompt: "Show me the metadata for the English Prescribing Dataset"
datasets_query
Query a specific dataset resource by its resource ID. Use datasets_metadata first to discover resource IDs.
Parameters:
resource_id(required) — The resource ID to queryfilters(optional) — Key-value pairs to filter recordslimit(optional) — Max records to return (default 20, max 100)offset(optional) — Records to skip for pagination
Example prompt: "Query resource abc-123 filtering by BNF_CODE 0407010H0"
prescriptions_search
Search NHS prescribing data from the English Prescribing Dataset (EPD).
Parameters:
bnf_code(optional) — BNF code (e.g.,0407010H0for Paracetamol)drug_name(optional) — Free-text drug name searchpractice_code(optional) — GP practice codeyear_month(optional) — Period in YYYYMM formatresource_id(optional) — Specific EPD resource IDlimit(optional) — Max records (default 20, max 100)
Example prompt: "Search for Paracetamol prescriptions in January 2024"
Data Sources
Source | API | Auth Required |
CKAN Action API | No |
Development
Project Structure
src/
├── mcp/ # MCP protocol layer (tools, server setup)
│ ├── server.ts
│ └── tools/
├── application/ # Business logic (use cases, formatters, types)
│ ├── use-cases/
│ ├── formatters/
│ └── types.ts
└── infrastructure/ # External concerns (API clients, cache, config)
├── clients/
├── cache/
├── config.ts
└── logger.tsCommands
npm run build # Compile TypeScript
npm run dev # Watch mode
npm test # Run tests
npm run test:watch # Watch mode tests
npm start # Start MCP server (stdio)Running Tests
npm testTests mock all external HTTP calls. No network access is required.
License
MIT
Available Tools
9 toolsdatasets_listList NHS DatasetsA
List all available datasets on the NHSBSA Open Data Portal. Returns dataset names, descriptions, and resource counts. Optionally filter by a search term matching title or description.
Inputs: search_query.
datasets_metadataGet Dataset MetadataA
Get detailed metadata for a specific NHS dataset, including its resources (data files) with their IDs. Use the resource ID with the datasets_query tool to query the actual data.
Inputs: dataset_id (required).
datasets_queryQuery DatasetA
Query a specific dataset resource on the NHSBSA Open Data Portal by resource ID. Use datasets_metadata first to find resource IDs for a dataset. Supports filtering by field values, pagination with limit and offset.
Inputs: resource_id (required), limit, offset, filters.
organisations_getGet Organisation DetailsA
Get full details for a specific NHS organisation by its ODS code. Returns name, address, roles, relationships, and succession history. Use organisations_search first to find the ODS code.
Inputs: ods_code (required).
organisations_relationshipsGet Organisation RelationshipsA
Get the relationships for a specific NHS organisation (e.g., which ICB commissions a GP practice, which region a trust belongs to). Returns relationship types, target organisations, and status.
Inputs: ods_code (required).
organisations_searchSearch NHS OrganisationsA
Search for NHS organisations (GP practices, trusts, ICBs, pharmacies, etc.) by name, role, or postcode using the ODS ORD directory. Returns ODS codes, names, statuses, and primary roles. At least one search parameter (name, role, or postcode) is required.
Inputs: name, role, limit, offset, +2 more.
prescriptions_cost_analysisPrescription Cost AnalysisA
Get prescription cost statistics from the national Prescription Cost Analysis (PCA) dataset. Shows aggregate costs and volumes at the national level (not by practice). Use prescriptions_search for practice-level data instead.
Inputs: limit, bnf_code, bnf_name, year_month, +1 more.
prescriptions_searchSearch PrescriptionsA
Search NHS prescribing data from the English Prescribing Dataset (EPD). Find prescription records by BNF code, drug name, practice code, or time period. Returns items dispensed, quantities, and costs. At least one search parameter should be provided.
Inputs: limit, bnf_code, drug_name, year_month, +2 more.
prescriptions_spending_trendsPrescribing Spending TrendsA
Analyse prescribing spending trends over time for a drug or BNF category. Data sourced from OpenPrescribing (last 5 years of monthly data). Returns monthly items, quantities, and costs. Can be filtered by organisation (Sub-ICB Location or practice).
Inputs: bnf_code (required), org, org_type.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool targets a distinct resource (prescriptions, datasets, organisations) and operation (trends, search, metadata, query, relationships). Even the prescribing tools are clearly differentiated by granularity: time-series trends, record-level search, and national aggregate statistics.
Tool names follow a consistent domain_suffix pattern in snake_case with a clear domain prefix. However, some suffixes are nouns (datasets_metadata, organisations_relationships) rather than verbs, introducing a minor inconsistency in the naming scheme.
Nine tools is an appropriate count, comfortably within the ideal range. Each tool serves a clear purpose, covering three distinct domains, with no redundancy.
The tool surface provides comprehensive coverage for the stated NHS data domains: prescribing data (search, trends, cost analysis), open data portal (list, metadata, query), and organisation directory (search, details, relationships). It enables complete discovery and access workflows.
Maintenance
Related MCP Connectors
Clinical trials, RxNorm drug lookups, FDA drug and device data, PubMed and NHS organisations.
UK NHS organisations (ODS) and Charity Commission register lookups
Query UK Parliament, elections, crime stats, ONS census data, and national archives
Official UK, US and Australia public datasets as filtered CSV, REST API and MCP for AI agents.
Related MCP Servers
- AlicenseAqualityAmaintenanceEnables AI assistants to search, explore, and query any CKAN open data portal through natural language, making public datasets accessible without requiring knowledge of the portal's API.202,334 npm61MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to query and analyze FDA adverse events, drug labels, medical device clearances, and other public health datasets through natural language commands.14-
- AlicenseBqualityCmaintenanceProvides access to 27 UK government data sources and services, enabling queries about transport, business, healthcare, and more via natural language.332MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to search, query, and analyze CMS healthcare datasets from data.cms.gov, supporting features like dataset discovery, filtering, and CSV download for large-scale analysis.52MIT