The AI connector (MCP)¶
undata-mcp is a Model Context Protocol server: it
lets an AI assistant such as Claude search UN indicators, fetch data and run the analyses
itself. Every tool only reads, and needs no account or key. Answers carry a table, a
summary sentence, the data-quality notes and the sources; analysis tools can attach their
chart as an image.
Setting it up¶
Install uv, which fetches Python and the package on first use.
Claude Desktop. Settings → Developer → Edit Config, then add, and restart:
{
"mcpServers": {
"undata": {"command": "uvx", "args": ["--from", "undata[mcp]", "undata-mcp"]}
}
}
Claude Code.
claude mcp add undata -- uvx --from "undata[mcp]" undata-mcp
Other clients. pip install "undata[mcp]", then run undata-mcp (stdio), or
undata-mcp --http to serve Streamable HTTP at http://127.0.0.1:8000/mcp
(--host, --port). Responses are cached on disk; --no-cache turns that off.
Things to ask¶
“Which least developed countries are on track to bring maternal mortality below 70 by 2030? Show me a chart.”
“Give me a one-page profile of Chad against Middle Africa and the world.”
“How wide is the rural-urban gap in primary school completion in the Sahel?”
“Which countries in Western Africa have reported electricity access in the last five years?”
Tools¶
Generated from the server, so it lists exactly what the installed version offers.
Search UN indicators¶
undata_search_indicators
Find indicators by what they measure.
Returns one row per indicator: its id (pass it to the other tools), name, source, how many places and years have data, and its SDG number if it has one. Start here when you do not know an indicator’s id.
Argument |
Type |
Meaning |
|---|---|---|
|
text |
Required. Plain words, e.g. “maternal mortality”. |
|
whole number |
Most indicators to return. Default: |
|
true/false |
Include copies of the same series held under other sources. Default: |
|
“markdown” | “json” |
“markdown” to read, “json” for exact values to compute with. Default: |
Describe an indicator¶
undata_describe_indicator
What an indicator measures, whose it is, its unit, its years, and its breakdowns.
Breakdowns (by sex, age, urbanization, wealth…) are what undata_get_data’s
breakdown and undata_group_gap’s breakdown accept.
Argument |
Type |
Meaning |
|---|---|---|
|
text |
Required. An indicator id from undata_search_indicators, or an SDG number such as “3.1.1”. |
Browse the SDG framework¶
undata_browse_sdg
Walk the SDG framework from goals down to series you can fetch.
Argument |
Type |
Meaning |
|---|---|---|
|
text (optional) |
Empty for the 17 goals; a goal (“5”) for its targets; a target (“5.5”) for its indicators; an indicator (“5.5.1”) for the series that report it. Default: |
List countries, regions and groups¶
undata_list_places
Countries in a UN M49 region or UN group, or the list of regions and groups.
Names are the UN’s official names. LDCs, LLDCs and SIDS are the UN’s current lists.
Argument |
Type |
Meaning |
|---|---|---|
|
text (optional) |
A region or group (“Western Africa”, “LDCs”); empty to list every region and group. Default: |
Get data by year¶
undata_get_data
Values by country and year, with unit and source on every row.
Argument |
Type |
Meaning |
|---|---|---|
|
list of text |
Required. One or more indicator ids or SDG numbers. |
|
list of text |
Required. Countries, regions or groups, e.g. [“Chad”, “Niger”], [“Southern Asia”], [“LDCs”]. |
|
whole number (optional) |
First year. Default: |
|
whole number (optional) |
Last year. Default: |
|
text (optional) |
A breakdown such as “sex” or “age” (see undata_describe_indicator). Default: |
|
whole number |
Rows per page. Default: |
|
whole number |
Rows to skip, for the next page. Default: |
|
“markdown” | “json” |
“markdown” to read, “json” for exact values to compute with. Default: |
Latest value per country¶
undata_latest_values
Each country’s most recent value, with the year it is from.
Countries’ latest years differ; the notes say so. within_years drops values
older than that and names the countries left out.
Argument |
Type |
Meaning |
|---|---|---|
|
list of text |
Required. One or more indicator ids or SDG numbers. |
|
list of text |
Required. Countries, regions or groups, e.g. [“Chad”, “Niger”], [“Southern Asia”], [“LDCs”]. |
|
whole number (optional) |
Only values from the past N years; older ones are named. Default: |
|
true/false |
Also return a publication-ready chart of the result, as an image. Default: |
|
“markdown” | “json” |
“markdown” to read, “json” for exact values to compute with. Default: |
Official totals for regions and groups¶
undata_group_totals
The figure the agency published for a region, a UN group or the world.
These are official aggregates, not averages of countries.
Argument |
Type |
Meaning |
|---|---|---|
|
list of text |
Required. One or more indicator ids or SDG numbers. |
|
list of text |
Required. Regions or groups, e.g. [“World”, “LDCs”, “Sub-Saharan Africa”]. |
|
true/false |
Only each place’s latest value. Default: |
|
“markdown” | “json” |
“markdown” to read, “json” for exact values to compute with. Default: |
Change between two years¶
undata_change_over_time
Each country’s value in two years, the difference and the percentage change.
Argument |
Type |
Meaning |
|---|---|---|
|
text |
Required. An indicator id from undata_search_indicators, or an SDG number such as “3.1.1”. |
|
list of text |
Required. Countries, regions or groups, e.g. [“Chad”, “Niger”], [“Southern Asia”], [“LDCs”]. |
|
whole number |
Required. |
|
whole number |
Required. |
|
true/false |
Also return a publication-ready chart of the result, as an image. Default: |
|
“markdown” | “json” |
“markdown” to read, “json” for exact values to compute with. Default: |
Compare indicators side by side¶
undata_compare_indicators
Latest values of several indicators side by side, with who has which spelled out.
With exactly two indicators, the chart is a scatter of one against the other.
Argument |
Type |
Meaning |
|---|---|---|
|
list of text |
Required. Two or more indicators. |
|
list of text |
Required. Countries, regions or groups, e.g. [“Chad”, “Niger”], [“Southern Asia”], [“LDCs”]. |
|
whole number (optional) |
Only values from the past N years; older ones are named. Default: |
|
true/false |
Also return a publication-ready chart of the result, as an image. Default: |
|
“markdown” | “json” |
“markdown” to read, “json” for exact values to compute with. Default: |
Assess SDG progress¶
undata_assess_progress
Is each country on track? The UN Statistics Division’s progress method.
Each country’s growth rate since the baseline is projected to the target year. With a target, the projected change is compared with the change the target needs; without, the growth rate is scored. Each country gets one of the SDG Report’s categories, from “On track or target met” to “Regression”, and a 0-5 score.
Argument |
Type |
Meaning |
|---|---|---|
|
text |
Required. An indicator id from undata_search_indicators, or an SDG number such as “3.1.1”. |
|
list of text |
Required. Countries, regions or groups, e.g. [“Chad”, “Niger”], [“Southern Asia”], [“LDCs”]. |
|
“higher” | “lower” |
Required. “lower” when a fall is progress (mortality, poverty); “higher” otherwise. |
|
number (optional) |
The value to reach by target_year, e.g. 70 for SDG 3.1.1. Default: |
|
whole number |
Default: |
|
whole number |
Default: |
|
true/false |
Also return a publication-ready chart of the result, as an image. Default: |
|
“markdown” | “json” |
“markdown” to read, “json” for exact values to compute with. Default: |
Country profile¶
undata_country_profile
One country’s latest values beside its UN M49 region and the world, with its rank.
Argument |
Type |
Meaning |
|---|---|---|
|
text |
Required. One country, e.g. “Chad”. |
|
list of text |
Required. One or more indicator ids or SDG numbers. |
|
true/false |
Also return a publication-ready chart of the result, as an image. Default: |
|
“markdown” | “json” |
“markdown” to read, “json” for exact values to compute with. Default: |
Gap between two groups¶
undata_group_gap
Two groups compared in the latest year that has both: the values, ratio and difference.
For example women and men, rural and urban, or the poorest and richest fifth.
Argument |
Type |
Meaning |
|---|---|---|
|
text |
Required. An indicator id from undata_search_indicators, or an SDG number such as “3.1.1”. |
|
list of text |
Required. Countries, regions or groups, e.g. [“Chad”, “Niger”], [“Southern Asia”], [“LDCs”]. |
|
text |
“sex”, “urbanization”, “wealth quantile”, or another breakdown it has. Default: |
|
list of text (optional) |
The two groups, e.g. [“Rural”, “Urban”]; default depends on the breakdown. Default: |
|
true/false |
Also return a publication-ready chart of the result, as an image. Default: |
|
“markdown” | “json” |
“markdown” to read, “json” for exact values to compute with. Default: |
UN groups side by side¶
undata_benchmark_groups
Published totals for regions and UN groups, at the baseline year and the latest.
Argument |
Type |
Meaning |
|---|---|---|
|
text |
Required. An indicator id from undata_search_indicators, or an SDG number such as “3.1.1”. |
|
list of text |
Regions or groups to compare. Default: |
|
whole number |
Default: |
|
true/false |
Also return a publication-ready chart of the result, as an image. Default: |
|
“markdown” | “json” |
“markdown” to read, “json” for exact values to compute with. Default: |
Who reports what¶
undata_check_availability
The year of each country’s latest value for each indicator; blank means no data.
Run this before comparing countries, to see whether their data is comparable in time.
Argument |
Type |
Meaning |
|---|---|---|
|
list of text |
Required. One or more indicator ids or SDG numbers. |
|
list of text |
Required. Countries, regions or groups, e.g. [“Chad”, “Niger”], [“Southern Asia”], [“LDCs”]. |
|
whole number (optional) |
Only values from the past N years; older ones are named. Default: |
|
true/false |
Also return a publication-ready chart of the result, as an image. Default: |
|
“markdown” | “json” |
“markdown” to read, “json” for exact values to compute with. Default: |