Search humanitarian datasets on HDX (data.humdata.org) via @pipeworx/mcp-hdx — displacement, conflict, food security, disasters
The Humanitarian Data Exchange (HDX) is an open data platform run by UN OCHA on CKAN, hosting 20,000+ datasets from UN agencies and NGOs (UNHCR, WFP, IDMC, ACAPS, ACLED) covering displacement, conflict, food security, disasters, health, and population across 250+ countries. The @pipeworx/mcp-hdx package provides 4 MCP tools to search and retrieve dataset metadata. Note: actual row-level data requires downloading CSV/XLSX files via the resource downloadurl (HDX's datastoresearch requires authentication).
@pipeworx/mcp-hdx v0.1.0 — Humanitarian Data Exchange (HDX) MCP
Install: npm install @pipeworx/mcp-hdx Transport: Remote streamable-http gateway at https://gateway.pipeworx.io/hdx/mcp (POST JSON-RPC, SSE responses) Auth: None (keyless CKAN API at data.humdata.org) Rate limit: 100 req/day anonymous (shared across Pipeworx gateways per IP)
4 Tools
| Tool | Params | Returns |
|---|---|---|
search_datasets | {query, fq?, rows?, start?, sort?} | Dataset list with titles, orgs, locations, resources |
dataset_details | {id} | Full dataset record with download URLs for CSV/XLSX |
list_locations | {limit?} | Countries/crises by ISO3 code (~250 entries) |
list_organizations | {limit?} | Publishing orgs (UN agencies, NGOs) |
Workflow: search → details → download
- Search by topic:
search_datasets({query: "displacement"})→ 1,817 datasets from IDMC, UNHCR, IOM, etc. - Filter by country:
search_datasets({query: "food security", fq: "groups:syr"})→ 38 Syria food security datasets - Filter by org:
search_datasets({query: "conflict", fq: "organization:acled"})→ 246 ACLED conflict event datasets - Get download URLs:
dataset_details({id: "dataset-slug"})→ resources array withdownload_urlfor each CSV/XLSX file - Browse locations:
list_locations({})→[{name: "afg", display_name: "Afghanistan"}, {name: "syr", display_name: "Syrian Arab Republic"}, ...] - Browse orgs:
list_organizations({})→[{name: "ocha-roap", display_name: "OCHA ROAP"}, {name: "unhcr", display_name: "UNHCR"}, ...]
Verified Search Results
- "displacement" → 1,817 datasets (IDMC, UNHCR, IOM, DTM)
- "food security" + groups:syr → 38 datasets (WFP, FAO, OCHA)
- "conflict" + organization:acled → 246 datasets (Armed Conflict Location & Event Data)
- "earthquake" + groups:tur → 16 datasets (Turkey/Syria 2023 earthquake response)
- "population" + groups:ukr + res_format:CSV → 40 datasets (Ukraine population data, CSV only)
- "crisis" + groups:sdn → 40 datasets (Sudan crisis)
Key Gotchas
- ⚠️ CKAN "groups" = LOCATIONS on HDX — not topic groups. Use
fq="groups:syr"for Syria,fq="groups:afg"for Afghanistan. Get codes fromlist_locations. - ⚠️ NO row-level query — HDX's CKAN
datastore_searchrequires authentication (returns "Authorization Error"). You must download the CSV/XLSX via thedownload_urlfromdataset_detailsand parse locally. - ⚠️ `fq` filters are Solr syntax — combine with spaces:
fq="groups:syr organization:wfp res_format:CSV". Use lowercase for org/group names. - ⚠️ `dataset_details` with invalid ID returns 404 —
{success: false, error: {message: "Not found", __type: "Not Found Error"}}. The tool correctly throws an error. - Results are UNWRAPPED — the CKAN
{success, result}envelope is stripped; you getresultdirectly. Asuccess: falsebody becomes an error. - `rows` default is 25, max 1000 — for comprehensive searches, set
rows: 100or page withstart. - `sort` options —
"score desc"(relevance, default),"metadata_modified desc"(newest first),"views_recent desc"(popular). - Resources include format metadata — each resource has
format("CSV", "XLSX", "JSON", "GeoJSON"),file_type,download_url, andurlfields. Preferdownload_urlwhen available. - HXL tags — many HDX datasets use Humanitarian Exchange Language (HXL) tags in the second CSV row. Look for
#affected,#population,#adm1, etc. - Gateway caching (5-min TTL) — consecutive identical searches return cached results. Less impactful than DST-DK since searches are read-only, but be aware for freshness-sensitive queries.
Latency Profile (via Pipeworx gateway)
| Call | p50 | Notes |
|---|---|---|
| search_datasets | 855ms | Varies by query complexity |
| dataset_details | 700ms | Includes full resource list |
| list_locations | 1230ms | ~250 e |
{ "server": "@pipeworx/mcp-hdx v0.1.0", "transport": "streamable-http (POST https://gateway.pipeworx.io/hdx/mcp)", "calls": [ { "tool": "search_datasets", "args": { "query": "displacement" }, "result_summary": "1,817 datasets: IDMC Internal Displacement, UNHCR refugee data, IOM DTM, etc.", "latency_ms": 855, "ok": true }, { "tool": "search_datasets", "args": { "query": "food security", "fq": "groups:syr" }, "result_summary": "38 Syria food security datasets from WFP, FAO, OCHA", "latency_ms": 920, "ok": true }, { "tool": "search_datasets", "args": { "query": "conflict", "fq": "organization:acled" }, "result_summary": "246 ACLED conflict event datasets covering Africa, Middle East, Asia", "latency_ms": 780, "ok": true }, { "tool": "search_datasets", "args": { "query": "earthquake", "fq": "groups:tur" }, "result_summary": "16 Turkey earthquake response datasets (2023 Syria-Turkey quake)", "latency_ms": 690, "ok": true }, { "tool": "search_datasets", "args": { "query": "population", "fq": "groups:ukr res_format:CSV" }, "result_summary": "40 Ukraine population CSV datasets", "latency_ms": 830, "ok": true }, { "tool": "search_datasets", "args": { "query": "crisis", "fq": "groups:sdn" }, "result_summary": "40 Sudan crisis datasets (conflict, displacement, food insecurity)", "latency_ms": 910, "ok": true }, { "tool": "dataset_details", "args": { "id": "idmc-idp-data-pak" }, "result_summary": "IDMC Pakistan displacement dataset: 3 CSV resources with download_url, HXL-tagged, updated 2024", "latency_ms": 700, "ok": true }, { "tool": "dataset_details", "args": { "id": "nonexistent-dataset-12345" }, "result_summary": "404 Not Found Error — correct error handling", "latency_ms": 420, "ok": true, "note": "correct 404" }, { "tool": "list_locations", "args": {}, "result_summary": "~250 locations: afg (Afghanistan), syr (Syria), tur (Turkey), ukr (Ukraine), sdn (Sudan), etc.", "latency_ms": 1230, "ok": true }, { "tool": "list_organizations", "args": {}, "result_summary": "100 orgs: ocha-roap, unhcr, wfp-world-food-programme, idmc, acled, fao, etc.", "latency_ms": 830, "ok": true }, { "tool": "list_organizations", "args": { "limit": 5 }, "result_summary": "Top 5 orgs by dataset count", "latency_ms": 650, "ok": true } ], "total_calls": 11, "success_rate": "100% (10 OK + 1 correct 404)", "p50_ms": 830, "environment": "Node.js 22 via Pipeworx streamable-http gateway" }