Skip to main content
Glama
country-analytics-mcp

country-analytics-mcp

🌍 country-analytics-mcp

Ask an AI plain-language questions about world economics — answered live from three public APIs that disagree with each other.

Python MCP Azure Keys

"What was France's GDP in 2022 in US dollars?" · "Convert that to euros at the Dec 30 2022 rate." · "What's Europe's total GDP — and who did you exclude, and why?"

GDP, population, GDP per capita, regional totals in your currency, rankings — reconciled live (nothing hard-coded, no keys, no accounts) and fully traceable: every answer names its countries, years, FX rate, and exclusions.


⚡ Step 1 — Connect it to your AI (60 seconds, nothing to install)

The server is already running on Azure. Paste this URL into your AI client:

https://country-analytics-mcp.grayriver-35df865c.eastus.azurecontainerapps.io/mcp

🟠 Claude (claude.ai or Claude Desktop)

  1. Settings → Connectors → Add custom connector

  2. Name: country-analytics · URL: the one above · no authentication

  3. Add, then start a chat and ask away — Claude picks the tools itself.

🟢 ChatGPT

  1. Settings → Apps & Connectors → Advanced settings → enable Developer mode

  2. Back in Connectors → Create: name country-analytics, MCP server URL as above, Authentication: None → save

  3. In a new chat, enable the connector (via the composer's tools / Developer mode menu) and ask your question.

(Custom connectors require a paid plan on both platforms; exact menu names shift occasionally.)

🔍 No paid plan? MCP Inspector works too

npx @modelcontextprotocol/inspector

Transport Streamable HTTP → paste the URL → Connect → call the 8 tools from a form UI.

💤 The app scales to zero when idle — the first request after a quiet spell takes ~10 extra seconds to cold-start. Health check: /health

Related MCP server: Development Indicators MCP

💬 Step 2 — Things worth asking

Ask this…

…and notice

How many countries does the source list for Europe?

53 — and 5 of them have no World Bank data (it says which)

France's GDP in 2022, in USD?

exact World Bank figure, year pinned

Now in euros, at the Dec 30 2022 rate

conversion pinned to the ECB rate, date echoed back

Europe's total GDP in euros?

the answer states its scope, FX date, and every excluded country

Same, but using the World Bank's definition of Europe

a different set (Central Asia in, Malta out — yes, really)

Top 5 European countries by GDP per capita

rankings with the year each value actually came from

What couldn't you reconcile for Europe?

the full flagged-issues ledger


💻 Run it locally (clean checkout → connected client)

No hosted dependency required — the same server runs on your machine with Python 3.10+:

git clone https://github.com/Satyampatel779/country-analytics-mcp.git
cd country-analytics-mcp
python -m venv .venv
.venv\Scripts\pip install .            # macOS/Linux: .venv/bin/pip install .

Transport

Command

stdio (Claude Desktop, Inspector)

.venv\Scripts\python -m country_analytics.server

HTTP at http://127.0.0.1:8000/mcp

set MCP_TRANSPORT=http then the same command (export on macOS/Linux)

Docker (identical to the hosted image)

docker build -t cam . && docker run -p 8000:8000 cam

Claude Desktop (stdio): merge client-configs/claude_desktop_config.json into your claude_desktop_config.json (Settings → Developer → Edit Config), fix the absolute path, restart:

{
  "mcpServers": {
    "country-analytics": {
      "command": "C:\\path\\to\\country-analytics-mcp\\.venv\\Scripts\\python.exe",
      "args": ["-m", "country_analytics.server"]
    }
  }
}

MCP Inspector (stdio or HTTP): step-by-step in client-configs/mcp_inspector.md.

✅ Prove it works

.venv\Scripts\pip install ".[dev]"
.venv\Scripts\python -m pytest -q       # 11 live tests, both MCP transports

Expected values are cross-checked against independent direct fetches of the same live APIs — not constants.


🔧 What's under the hood

Three keyless public services, each speaking a different protocol, joined on ISO2 codes (never names — the sources spell them differently):

Source

Protocol

Provides

Countries GraphQL

GraphQL

Which countries are on a continent (ISO2, name, currency)

World Bank Indicators

REST, [metadata, data] arrays

GDP (NY.GDP.MKTP.CD, current US$) & population (SP.POP.TOTL) by year

Frankfurter

REST

ECB FX rates, latest or pinned to a date

The 8 tools

Tool

Answers

list_continents()

continent codes + country counts

list_countries(continent)

the full source list with join status per country

get_country_metric(country, metric, year, currency, fx_date)

one country, one number, fully traced

region_total(continent, metric, year, currency, scope, fx_date, missing_policy)

regional totals — every assumption a parameter

rank_countries(continent, metric, year, top_n, currency, scope, order)

top-N / bottom-N

convert_currency(amount, from, to, date)

pinned or latest FX conversion

list_reconciliation_issues(continent)

everything excluded, unmatched, or flagged — with reasons

describe_methodology()

join key, defaults, and which parameters change them

Judgment calls are parameters, not hard-coded

  • scope — geographic continent (default) vs. the World Bank region: for Europe the WB set adds Central Asia and drops Malta (the World Bank files it under MENA — flagged, of course).

  • year — pinned exactly, or latest walks back past null years per country and reports the year used.

  • missing_policy — exclude-and-list (default) or walk back to the most recent earlier value.

  • fx_date — defaults to the pinned year's last trading day (2022 → 2022-12-30); pin any date you like.

  • Refuses to guess — currencies outside Frankfurter's 30 (Serbian dinar, hryvnia…) return the supported list instead of an invented rate.

📄 More

  • WRITEUP.md — sources & join choices, every disagreement found, every assumption, production notes (≤1 page, written for a non-technical stakeholder).

  • samples/sample_run_output.md — a real timestamped run: the reconciled Europe table, computed metrics, and the flagged-issues list, kept as a reference in case a source is down during evaluation.

Available Tools

8 tools
convert_currencyA

Convert an amount between two Frankfurter-supported currencies at the latest rate or a pinned historical date ("YYYY-MM-DD"; non-trading days fall back to the prior trading day and the response says so). Unsupported currencies are refused with the supported list.

Inputs: amount (required), to_currency (required), from_currency (required), date.

describe_methodologyA

How every number is produced: sources, join key, scope/year/FX/missing-value defaults, and which parameters change them. Use this to answer "how did you get that?".

Inputs: no named parameters.

get_country_metricA

One country's gdp, population, or gdp_per_capita for a year.

  • country: ISO2/ISO3 code or a name from either source ("France", "FR", "FRA", "Czechia").

  • metric: gdp | population | gdp_per_capita (GDP divided by population, same year).

  • year: a year like "2022", or "latest" (walks back past null years and reports year_used).

  • currency: any Frankfurter-supported currency (GDP is natively current US$).

  • fx_date: "YYYY-MM-DD" or "latest". Default: year-end of a pinned year (falls back to the last trading day, e.g. 2022 -> 2022-12-30), or the latest rate when year='latest'. The response includes the exact year used, FX rate and date, flags, and sources.

Inputs: country (required), year, metric, fx_date, +1 more.

list_continentsA

List the seven continent codes (AF AN AS EU NA OC SA) with names and how many countries the country-list source has for each. Start here to find a continent code.

Inputs: no named parameters.

list_countriesA

List every country the source lists for a continent (e.g. 'EU'), with ISO codes, both sources' names, currencies, and whether each could be matched in the World Bank. Answers "how many countries are in ?" via countries_listed_by_source.

Inputs: continent (required).

list_reconciliation_issuesA

Every disagreement found while reconciling the three sources for a continent: countries missing from the World Bank, name mismatches (joined on ISO2 instead), excluded aggregate rows, currencies the FX source doesn't cover, and how the World Bank region differs from the geographic continent. Use this to explain any number's coverage.

Inputs: continent (required).

rank_countriesA

Top-N (or bottom-N with order='asc') countries of a continent by gdp, population, or gdp_per_capita. Same scope/year/currency/fx_date semantics as region_total. Countries without data for the requested year are excluded and listed with reasons.

Inputs: continent (required), year, order, scope, +4 more.

region_totalA

Regional total for a continent: sum of GDP, sum of population, or population-weighted GDP per capita (sum GDP / sum population). All judgment calls are parameters:

  • scope: 'continent' = the geographic continent per the country-list source (default); 'wb_region' = the World Bank region(s) overlapping it — a DIFFERENT country set (e.g. Europe & Central Asia adds Central Asia and the Caucasus).

  • year: "2022" or "latest" (latest walks back per country and may mix years — flagged).

  • missing_policy (pinned years): 'exclude' = countries without that year's value are excluded and listed (default); 'walk_back' = use their most recent earlier value.

  • currency / fx_date: as in get_country_metric. The response lists every included country with its value and year, every exclusion with its reason, the FX rate used, and the assumptions applied.

Inputs: continent (required), year, scope, metric, +3 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 8 tools

    Disambiguation4/5

    Tools are mostly distinct: list_continents, list_countries, and get_country_metric target different granularities, while region_total and rank_countries differ by aggregation vs ranking. However, both region_total and rank_countries share identical scope/year/currency semantics and could be confused for aggregate queries, and get_country_metric is buried despite its importance.

    Naming Consistency5/5

    All tool names follow a clear verb_noun pattern (list_continents, get_country_metric, region_total, convert_currency, describe_methodology). The only slight deviation is region_total and rank_countries which omit an explicit verb, but they remain readable and consistent within the set.

    Tool Count5/5

    Eight tools is well-scoped for a country analytics server: listing entities, fetching metrics, aggregating, ranking, converting currency, and explaining reconciliation/methodology. Each tool earns its place without redundancy.

    Completeness5/5

    The surface covers the full lifecycle: discovery (continents, countries), retrieval (get_country_metric), aggregation (region_total), ranking (rank_countries), currency conversion, and transparency tools (list_reconciliation_issues, describe_methodology). No obvious gaps for the stated domain.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables AI clients to ask quantitative questions about any continent's economy, answering with live reconciled GDP, population, per-capita, ranking, and historical FX conversion figures pulled from three public APIs at query time. Every judgment call—which countries count, how missing years are handled, which currency and FX date—is exposed as a parameter, and the server reports exactly which rows it excluded, why, and where each number came from.
      -
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI assistants to discover, retrieve, and compare official international development indicators from sources such as the World Bank, FAOSTAT, WHO, UNICEF, and IMF, while preserving source identifiers, units, and citations.
      10
      2
      MIT
    • A
      license
      A
      quality
      F
      maintenance
      Enables AI agents to discover, retrieve, compare, and analyze trusted macroeconomic statistics from central banks and international organizations, resolving concepts to official series with provenance and validation.
      6
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to query cross-country macroeconomic and financial statistics, including GDP, inflation, fiscal balance, debt, exchange rates, trade, and balance-of-payments data for comparison and time-series analysis.
      306 npm
      MIT