UNdata

UNdata

A CLI and MCP server for querying UN statistical data via the SDMX REST API, providing tools to list datasets, retrieve WDI and MDG data, search series, and compare countries without requiring an API key.

Category
访问服务器

README

UNdata

CLI and MCP server for the UNdata SDMX REST API — UN Statistics Division open data. Query World Development Indicators, Millennium Development Goals and other UN datasets from your terminal, from analysis pipelines, or from any MCP client (Claude, Antigravity). No API key required.

Features

  • undata CLI — terminal access with table / json / csv / parquet output, runnable from anywhere
  • Full CLI ↔ MCP parity: the 7 tools, 3 prompts, and 3 reference docs are all reachable from both interfaces
  • 7 MCP tools: list dataflows, WDI data, country profile, series search, MDG data, generic query, multi-country compare
  • 3 prompts: economic analysis, development goals progress, country comparison — also via undata prompt
  • 3 resources: API guide, country codes, WDI series catalog — also via undata guide|countries|catalog
  • Disk cache so repeated research queries are instant across runs
  • Declarative dataflow registry — add a dataset with one entry, no new code
  • Built for humans and AIs: pretty tables + Markdown for people; clean JSON/CSV and --raw for agents and pipelines

Install (one command)

Requires uv. Installs both undata (CLI) and undata-mcp (server) onto your PATH.

# Windows (PowerShell)
./install.ps1                 # add -Export for Parquet support

# macOS / Linux
./install.sh                  # add --export for Parquet support

Or directly:

uv tool install .             # or:  uv tool install '.[export]'

After uv tool install, both commands live in uv's tool bin (e.g. ~/.local/bin), which uv puts on your PATH — so undata and undata-mcp run from any directory. If your shell can't find them yet, run uv tool update-shell and reopen the terminal.

Run without installing:

uvx --from . undata wdi PER

PyPI (future): the package is metadata-complete and ready to publish. Once published, install anywhere with pipx install undata-mcp / uvx undata-mcp. Publishing is a deliberate, public step (uv build && uv publish) and is intentionally left for you to trigger.

CLI usage

undata dataflows                                   # list available datasets (live)
undata datasets                                    # registered datasets + aliases (offline)

undata wdi PER --years 2015:2023                   # WDI for one country
undata wdi PER --series NY_GDP_PCAP_CD --format table
undata profile PER --year 2022                     # latest snapshot, all indicators
undata search education --country BRA              # find WDI series codes
undata mdg PER --years 2000:2020                   # Millennium Development Goals

undata compare PER COL BRA --series NY_GDP_PCAP_CD # multi-country comparison
undata compare PER COL --format csv -o out.csv     # export to CSV for analysis
undata compare PER COL --format parquet -o out.parquet

undata query wdi A..PER --years 2020:2023          # generic SDMX query (alias or id)

# Reference docs (same content the MCP serves as resources)
undata guide                                       # API guide (Markdown in a terminal, raw when piped)
undata countries --raw                             # ISO-3 country codes
undata catalog                                     # common WDI series codes by topic

# Guided analysis prompts (same templates the MCP exposes)
undata prompt                                      # list prompts
undata prompt country_economic_analysis -c PER --year 2022
undata prompt compare_countries -c PER,COL,BRA

undata mcp-config                                  # print an MCP client config snippet
undata --version
undata serve                                       # start the MCP server (= undata-mcp)

Global flags on every data command: --format table|json|csv|parquet (default table) and --output/-o FILE. Reference commands take --raw for plain-text (AI/pipeline) output.

MCP usage

Point your MCP client at the undata-mcp command. Example (.antigravity.json, already included):

{
  "mcpServers": {
    "undata": {
      "command": "uv",
      "args": ["--directory", "C:\\Users\\USER\\source\\MCPs\\UNdata-mcp", "run", "undata-mcp"]
    }
  }
}

undata-mcp and undata serve are equivalent.

Tool Description
undata_list_dataflows List available datasets
undata_get_wdi_data World Development Indicators for a country
undata_get_country_profile Latest snapshot across all WDI indicators
undata_search_wdi_series Find series codes by keyword
undata_get_mdg_data Millennium Development Goals data
undata_compare_countries Compare WDI indicators across countries
undata_query Generic SDMX query for any dataflow

Architecture

The logic lives in a shared service layer; the CLI and the MCP tools are thin adapters over it, so there is zero duplication between the two interfaces.

services/   core async logic (get_wdi_data, compare_countries, …)  ← single source of truth
  ↑     ↑
tools/    cli/     thin adapters (MCP tools / Typer commands)
registry.py   declarative DataflowSpec + build_key() — add datasets by config
cache.py      pluggable CacheBackend: MemoryCache (server) / DiskCache (CLI)
client.py     async httpx client, cache injected
formatters.py pure CSV → dict shaping

Adding a new dataset = one DataflowSpec entry in registry.py (and, if its output shape differs, one small service function). New interfaces (REST API, notebooks) can reuse services/ unchanged.

Configuration

Copy .env.example to .env (all optional):

UNDATA_CACHE_TTL=600           # response cache seconds (0 = disabled)
UNDATA_TIMEOUT=60              # HTTP timeout seconds (SDMX can be slow)
UNDATA_CACHE_BACKEND=memory   # memory | disk (CLI forces disk automatically)
UNDATA_CACHE_DIR=...          # override the disk cache location

Tests

uv run pytest tests/ -v

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选