Skip to main content

NHSUK MCP Server

A Model Context Protocol (MCP) server that provides tools for searching NHS organisations by type and location, plus accessing NHS health information using Azure API Management.

Features

  • Get Organisation Types: List all 24 available NHS organisation types
  • Convert Postcode: Convert UK postcodes to latitude/longitude coordinates
  • Search by Postcode: Find NHS organisations near a specific postcode
  • Search by Coordinates: Find NHS organisations near specific coordinates
  • Get Health Topic: Get detailed NHS health information and guidance on medical conditions

Installation

From PyPI (Recommended)

pip install nhsuk-mcp

From Source

git clone https://github.com/sinclr4/nhsuk-mcp-python.git
cd nhsuk-mcp-python
pip install -e .

Configuration

Environment Variables

This server requires two environment variables:

  • API_MANAGEMENT_ENDPOINT - The Azure API Management base URL (without service paths)
  • API_MANAGEMENT_SUBSCRIPTION_KEY - Your subscription key for API Management

Usage with Claude Desktop

Installation

pip install nhsuk-mcp

Configuration

Add to your Claude Desktop config file:

macOS/Linux: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "nhsuk": {
      "command": "python",
      "args": ["-m", "nhsuk_mcp.server"],
      "env": {
        "API_MANAGEMENT_ENDPOINT": "https://nhsuk-apim-int-uks.azure-api.net",
        "API_MANAGEMENT_SUBSCRIPTION_KEY": "your-subscription-key-here"
      }
    }
  }
}

Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "nhsuk": {
      "command": "python",
      "args": ["-m", "nhsuk_mcp.server"],
      "env": {
        "API_MANAGEMENT_ENDPOINT": "https://nhsuk-apim-int-uks.azure-api.net",  
        "API_MANAGEMENT_SUBSCRIPTION_KEY": "your-subscription-key-here"
      }
    }
  }
}

Restart Claude Desktop

After updating the configuration, restart Claude Desktop. The MCP server will be available with 5 tools.

Available MCP Tools

1. get_organisation_types

Lists all NHS organisation types with descriptions.

Returns: Dictionary of organisation type codes and their descriptions.

Example types:

  • PHA - Pharmacy
  • GPP - GP Practice
  • HOS - Hospital
  • DEN - Dentists
  • CLI - Clinics

2. convert_postcode_to_coordinates

Converts a UK postcode to latitude/longitude coordinates.

Parameters:

  • postcode (string, required): UK postcode (e.g., "SW1A 1AA")

Returns: Latitude and longitude coordinates

3. search_organisations_by_postcode

Search for NHS organisations near a specific postcode.

Parameters:

  • organisationType (string, required): Organisation type code (e.g., "PHA", "GPP", "HOS")
  • postcode (string, required): UK postcode
  • maxResults (integer, optional): Maximum number of results (1-50, default: 10)

Returns: List of organisations with name, address, postcode, distance, and coordinates

4. search_organisations_by_coordinates

Search for NHS organisations near specific coordinates.

Parameters:

  • organisationType (string, required): Organisation type code
  • latitude (number, required): Latitude coordinate
  • longitude (number, required): Longitude coordinate
  • maxResults (integer, optional): Maximum number of results (1-50, default: 10)

Returns: List of organisations with name, address, postcode, distance, and coordinates

5. get_health_topic

Get detailed information about a specific health condition or topic from the NHS API.

Parameters:

  • topic (string, required): The health topic or condition slug (e.g., "asthma", "diabetes", "flu", "covid-19")

Returns: Comprehensive information including name, description, last reviewed date, URL, and content sections

Example topics: asthma, diabetes, flu, covid-19, heart-disease, stroke, cancer, depression, anxiety

Supported Organisation Types

The server supports 24 NHS organisation types:

Code Description
CCG Clinical Commissioning Group
CLI Clinics
DEN Dentists
GDOS Generic Directory of Services
GPB GP
GPP GP Practice
GSD Generic Service Directory
HA Health Authority
HOS Hospital
HWB Health and Wellbeing Board
LA Local Authority
LAT Area Team
MIU Minor Injury Unit
OPT Optician
PHA Pharmacy
RAT Regional Area Team
SCL Social Care Provider Location
SCP Social Care Provider
SHA Strategic Health Authority
STP Sustainability and Transformation Partnership
TRU Trust
UC Urgent Care
UNK UNKNOWN

Docker Deployment

Build Image

docker build -t nhs-orgs-mcp-python .

Run Container

docker run -i \
  -e API_MANAGEMENT_ENDPOINT="https://nhsuk-apim-int-uks.azure-api.net" \
  -e API_MANAGEMENT_SUBSCRIPTION_KEY="your-key" \
  nhs-orgs-mcp-python

Example Usage

Once configured in Claude Desktop, you can ask questions like:

  • "What NHS organisation types are available?"

  • "Find pharmacies near postcode SW1A 1AA"

  • "Show me GP practices within 5 miles of London"

  • "What's the nearest hospital to coordinates 51.5074, -0.1278?"

  • "Convert postcode M1 1AE to coordinates"

  • "Get information about asthma"

  • "Tell me about diabetes symptoms and treatment"

  • "What is the NHS guidance on flu?"

Development

Local Setup

# Clone repository
git clone https://github.com/sinclr4/nhsuk-mcp-python.git
cd nhsuk-mcp-python

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode
pip install -e .

# Set environment variables
export API_MANAGEMENT_ENDPOINT="https://nhsuk-apim-int-uks.azure-api.net"
export API_MANAGEMENT_SUBSCRIPTION_KEY="your-key"

# Run the server
python -m nhsuk_mcp.server

Project Structure

nhsuk-mcp-python/
├── nhsuk_mcp/
│   ├── __init__.py          # Package initialization
│   ├── server.py            # MCP server implementation
│   ├── models.py            # Data models (Organisation, PostcodeResult)
│   └── azure_search.py      # API Management service integration
├── pyproject.toml           # Project metadata and dependencies
├── Dockerfile               # Container build configuration
└── README.md                # This file

Requirements

  • Python 3.10 or higher
  • Dependencies:
    • mcp>=1.0.0 - Model Context Protocol SDK
    • httpx>=0.27.0 - HTTP client
    • pydantic>=2.0.0 - Data validation

License

MIT License - See LICENSE file for details

Links

Author

Rob Sinclair - rob.sinclair@nhschoices.net

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for nhsuk-mcp 1.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nhsuk-mcp 1.0.6
File Size Uploaded Provenance
nhsuk_mcp-1.0.6.tar.gz 13.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nhsuk-mcp 1.0.6
File Interpreter ABI Platform
nhsuk_mcp-1.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 24.7 kB

Release files / nhsuk_mcp-1.0.6.tar.gz

Download URL nhsuk_mcp-1.0.6.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
70dc709fbe60876b15be31c313a8840a4acd7c57ec80e9468636fb62214976e8
BLAKE2b-256 checksum
How to use checksums
cb2dc9b03a1024a3395d27525b9e2f882d15bab84d398668ccc5bb3f247b96c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.3

Release files / nhsuk_mcp-1.0.6-py3-none-any.whl

Download URL nhsuk_mcp-1.0.6-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c36b24d6ff5e574d12293bf09d2b10f9b041e98c506609e7fec9a3a1fda78a2d
BLAKE2b-256 checksum
How to use checksums
0ec3127aa09b6f44928396b789b147bb0e9f04d64a59432ae16c06d41b781695
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.3

Security for nhsuk-mcp 1.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.6 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page