← All experiments

Giving AI assistants direct access to WHO health data

WHO's health spending database has no stable API, and its observatory API is hard for a model to drive. I built two open-source MCP servers so Claude and other assistants can query both directly.

  • Data
  • Tools
  • Health

Updated15 Sep 2026

The problem

I work on comparative health financing and health systems, and I wanted to ask an AI assistant questions like "compare out-of-pocket spending across Latin America since 2000" and get answers built on WHO's own data. Two WHO sources hold most of what I need: the Global Health Expenditure Database (GHED) and the Global Health Observatory (GHO).

What was out there

GHED has no stable documented API. Its data comes as an all-data workbook with thousands of variables from the SHA 2011 health accounts framework, cryptic codes (gghed_che means domestic general government health expenditure as a share of current health expenditure), and many variables that cannot be added together, such as percentages and PPP values.

GHO does have an OData API, but its indicator codes are cryptic (WHOSIS_000001 is life expectancy at birth), countries must be ISO3 codes, the filter syntax is unforgiving, and every cross-country comparison becomes a loop. The closest WHO server I found offered a single tool that passed raw OData queries through, with no commits since December 2025.

What I built

I built two companion MCP servers, both MIT licensed and published under the Decilion GitHub organisation and on PyPI:

  • ghed-mcp (PyPI), 35 tools for health spending: country profiles, regional and income-group benchmarks, financing-mix breakdowns, research exports and accounting checks.
  • gho-mcp (PyPI), 15 tools for the Observatory: indicator search, country profiles, comparisons, sex-disaggregated series and metadata.

They accept country names, ISO3 codes, WHO regions and World Bank income groups, and every data response carries a provenance block for citation. They are independent projects, not official WHO products.

Dark terminal card. A question asks how out-of-pocket spending changed in six Latin American countries since 2000; below it the ghed.compare_countries call and a trimmed JSON response with the WHO workbook version, a note that 2024 data are preliminary, a count of 144 rows and sample rows for Colombia, Brazil and Mexico.
A real ghed-mcp answer. Before giving any numbers, the server names the WHO workbook it read and warns that 2024 is preliminary.
Line chart on a dark background of out-of-pocket spending as a share of current health expenditure, 2000 to 2023, for Mexico, Chile, Peru, Brazil, Argentina and Colombia. In 2023 Mexico is highest at 41.2 percent and Colombia lowest at 14.6 percent.
The same 144 rows drawn as a chart: Mexico still pays 41 percent out of pocket, Colombia under 15 percent.
Dark terminal card. A question asks for life expectancy at birth in the same six countries; below it the gho.compare_countries call and a trimmed JSON response showing the OData filter the server built and 2023 values with uncertainty ranges, from 75.3 years in Mexico to 81.1 in Chile.
gho-mcp turns country names into the OData filter WHO's API expects and returns each value with its uncertainty range.

Equipment

How I built it

  1. I wrapped the GHO OData API in task-shaped tools, with a provenance block on every data response and warnings when countries report different latest years.
  2. For GHED, I made the server find the latest "GHED all data" workbook in WHO's Documentation Centre, download it, and build a derived SQLite database that it rebuilds only when the workbook changes.
  3. I encoded the accounting rules, such as current health expenditure = HF1 + HF2 + HF3 + HF4 + HFnec. A breakdown with a missing component is reported as incomplete, never filled with an assumed zero.
  4. I shared one curated country-group file between the two servers, so "LAC" means the same 33 countries in both, alongside World Bank regions, least developed countries and OECD members.
  5. Codex and independent Claude sessions reviewed the code at several stages. I fixed what they found and published through GitHub CI on Python 3.11 to 3.14 and PyPI Trusted Publishing.
  6. I ran fresh Claude Code sessions on four research tasks with only GHED connected, and checked their numbers against cells read directly from the WHO workbook.

Results

  • On a fresh install, the first request downloaded, validated and indexed WHO's March 2026 workbook (38,922,209 bytes) in 96 seconds: 195 countries and territories, 4,115 variables and 3,034,483 observations, in a 294,469,632-byte SQLite file.
  • 41 checks of values and missing cells against the original workbook matched, including all 33 Latin American and Caribbean countries in a regional summary.
  • 91 GHED tests pass from source and from an installed wheel, and the GHO suite passes its 77 tests.
  • In the four assistant trials every tool call was valid and the core values matched the workbook.
  • A weekly GitHub workflow checks every curated GHO indicator code against WHO's live catalog and opens an issue when one stops working.

What I learned

The right numbers can still lead to a wrong conclusion. In the trials the assistant extracted correct values, but some answers added unsupported causal explanations, left out that 2024 data are preliminary, or treated a nearly balanced but incomplete breakdown as complete. Better tool guidance reduced this without removing it.

Small edge cases can produce confident wrong output. A country with a single observation used to show a zero-change trend; it now gets null change values and is left out of change rankings.

WHO's GHO API rejects a filter that lists about 25 or more countries. Splitting requests into chunks of 10 fixed comparisons for the 33-country Latin America group.

Lab notes

  1. I released GHED 0.6.1 after testing it with fresh Claude Code sessions on four research tasks and checking the answers against the WHO workbook. I also prepared a hosted HTTP version with 34 read-only tools, not deployed yet.

  2. I published both servers on PyPI (GHED 0.6.0 and GHO 0.7.0) through GitHub Trusted Publishing.

  3. I built ghed-mcp, which finds WHO's health expenditure workbook, downloads it and builds a local SQLite cache to query, and made it public. Both servers now share country groups updated to the World Bank's FY2026 regions.

  4. I released gho-mcp, a server for the WHO Global Health Observatory, as a public repository.

© 2026 Johnattan García-Ruiz Last updated