# aihw-mcp

**Category:** 🧬 Biology & Bioinformatics  
**Repository:** https://github.com/Bigred97/aihw-mcp  
**GitHub Stars:** 0  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/aihw-mcp

## Description
Query the AIHW in plain English — mortality, cancer, health spend, hospital wait times.

## Tools
Capabilities this server exposes over MCP:

- **search_datasets** — Fuzzy-search the curated AIHW dataset catalog.

All datasets ship hand-curated in v0.1: long-term mortality (GRIM),
regional mortality (MORT), cancer incidence and mortality, health
expenditure, youth justice detention, and the public hospitals
register.

Examples:
    # Find a dataset that gives deaths by cause
    results = await search_datasets("mortality cause of death")
    # → [{id: 'GRIM_DEATHS', name: 'GRIM — long-term mortality', ...}]

    # Discover what's available on cancer
    results = await search_datasets("cancer")

Returns:
    List of DatasetSummary (id, name, description, update_frequency,
    is_curated), ranked by relevance.
- **describe_dataset** — Describe a dataset's filterable dimensions, returnable measures, units, and source.

Use this before calling get_data on a new dataset — it tells you the
valid filter keys ('sex', 'year', 'state'), the valid filter values
('Females', 'Males', 'Persons'), the measure aliases ('deaths',
'crude_rate_per_100000'), and the canonical source URL.

Returns:
    DatasetDetail with id, name, description, period_coverage, list of
    dimensions, list of measures (each with key, source_column, unit,
    description), and source_url + download_url.
- **get_data** — Query a curated AIHW dataset and return observations.

Examples:
    # Deaths from diabetes, all years and sexes
    resp = await get_data(
        "GRIM_DEATHS",
        filters={"cause_of_death": "Diabetes"},
        measures="deaths",
    )

    # Breast cancer incidence in females over time
    resp = await get_data(
        "CANCER_INCIDENCE_MORTALITY",
        filters={"cancer_type": "Breast cancer", "sex": "Female", "type": "Incidence"},
    )

    # Public hospitals in NSW with peer group "Principal referral"
    resp = await get_data(
        "PUBLIC_HOSPITALS",
        filters={"state": "NSW", "peer_group_name": "Principal referral"},
    )

Returns:
    DataResponse with records (or csv), unit, period bounds, row_count,
    source URL, and CC-BY attribution.
- **latest** — Return the most recent observation(s) per measure for a dataset.

For transposed time-series tables this trims to the most-recent period.
For wide datasets with a real period, "latest" means the most recent
period(s) — keeping ALL entities/dimensions at that period, not an
arbitrary N rows. For wide single-year tables with no period variation
(most AIHW datasets) it returns the same shape as get_data, capped at
`limit` rows so a large register (e.g. PUBLIC_HOSPITALS) doesn't blow
the response budget. Truncated responses set DataResponse.truncated_at
to the original row count.

When the curated YAML declares a `headline_slice`, those filter values
are applied automatically so the no-filter call returns ONE canonical
headline row (e.g. HEALTH_EXPENDITURE → national total, all areas, all
sources). User-supplied filters override the headline_slice per-key —
`latest("HEALTH_EXPENDITURE", filters={"state": "NSW"})` keeps the
area/source defaults and returns the NSW latest-year total.

Examples:
    # Latest year of GRIM data for All causes combined
    resp = await latest("GRIM_DEATHS", filters={"cause_of_death": "All causes combined"})

    # All ~700 public hospitals (default cap of 50 would otherwise apply)
    resp = await latest("PUBLIC_HOSPITALS", limit=1000)
- **top_n** — Return the N rows with the largest (or smallest) value of a measure.

This is the most common agent workflow: "show me the top 10 X by Y".
Without this tool, an agent would call get_data, receive the full table,
and then sort/slice locally — wasting tokens and turns. top_n does the
rank server-side and returns only the requested rows.

Examples:
    # Top 10 causes of death in 2023 (Persons)
    top_n("GRIM_DEATHS", "deaths", n=10,
          filters={"sex": "Persons", "year": "2023"})

    # 20 SA3 regions with the highest age-standardised mortality
    top_n("MORT_GEOGRAPHY", "age_standardised_rate_per_100000",
          filters={"category": "Statistical Area Level 3 (SA3)",
                   "sex": "Persons", "year": "2023"}, n=20)

    # 5 lowest-funded health expenditure areas in NSW
    top_n("HEALTH_EXPENDITURE", "real_expenditure_millions",
          filters={"state": "NSW", "financial_year": "2022-23"},
          n=5, direction="bottom")

Returns:
    DataResponse with at most `n` records, sorted by `measure` value
    in the requested direction. Other fields (period, unit, attribution)
    match a regular get_data call.
- **list_curated** — List every curated dataset ID in this version of aihw-mcp.

These are the datasets where get_data accepts plain-English filter keys
and returns aliased, well-typed measure columns. Each ID is documented
via describe_dataset.

Returns:
    Sorted list of dataset IDs.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "aihw-mcp": {
    "command": "uvx",
    "args": ["--upgrade","aihw-mcp"]
  }
}
```

## Documentation

## What aihw-mcp MCP server does

The aihw-mcp MCP server connects AI assistants to six curated Australian Institute of Health and Welfare datasets. Its coverage includes national long-term mortality from 1907 onward, regional mortality from 2019 onward, cancer incidence and mortality from 1968 onward, health expenditure from 1997–98 onward, youth justice detention from 2008 onward, and a public hospitals directory with a 2016–17 reference period.

The datasets support questions about causes of death, age-standardised mortality, cancer types and age bands, spending by state and area, youth detention populations, and hospital classifications. Results include the dataset identity, query details, period, unit, records, AIHW source URL, attribution, and server version.

## How it works

The server uses a FastMCP entry point and retrieves source files over HTTP. CSV and XLSX files are parsed according to dataset specifications stored in YAML, which define dimensions, measures, values, URLs, and file layout. A SQLite disk cache stores downloaded resources with per-resource time-to-live settings.

When AIHW publishes a newer matching resource, the server can discover it through the data.gov.au CKAN API. If discovery is unavailable, configured source URLs provide a fallback. Cached data can be refreshed by removing `~/.aihw-mcp/cache.db` or waiting for the seven-day cache TTL.

The aihw-mcp MCP server accepts common state identifiers across location-aware datasets, including state codes, full state names, case variants, ISO 3166-2 values, and four-digit postcodes. Time-series queries can also specify start and end periods.

## Setup and configuration

Run the package on demand with `uvx --upgrade aihw-mcp`, or install it with `pip install aihw-mcp`. The `--upgrade` option makes `uvx` check PyPI for a newer package release when the server starts instead of relying only on a cached wheel.

Claude Desktop can launch it with `uvx` and the `--upgrade` argument in its MCP configuration. No required environment variables are documented.

## Tools and capabilities

The aihw-mcp MCP server exposes six tools:

- `search_datasets` searches the curated catalog by keyword.
- `describe_dataset` lists available dimensions, filters, and measures.
- `get_data` applies filters and measures, with optional period limits and output formats.
- `latest` returns the most recent observation for each measure.
- `top_n` ranks rows by a selected measure and returns the highest or lowest entries.
- `list_curated` lists the available dataset identifiers.

Validation reports misspelled filter and measure names with fuzzy suggestions. The same response structure is used across the curated sources, and returned source URLs support citation by the calling agent.

## Limitations and notes

Coverage is limited to the six datasets included in the curated catalog. The public hospitals source is a directory rather than a time series, while the other sources have their own periods, dimensions, and measures. Data freshness depends on AIHW releases, resource discovery, and the local cache state.

_Full upstream README: https://allmcps.com/mcp/aihw-mcp/readme_

