GnistAI GnistAI
Log in

Getting Started with Eurostat

EU statistical data — demographics, trade, GDP, employment, and social indicators.

All Tutorials   |   Overview   |   Playground   |   MCP   |   REST API   |   Home
Economics

Data source: Eurostat

Overview

Eurostat wraps Eurostat, handling authentication, pagination, and rate limits for you. This tutorial covers all 6 tools with working code examples you can copy and run.

Prerequisites

  1. Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
  2. Choose your integration method: MCP protocol or REST API.

Connect via MCP

Add to your MCP client config (Claude Desktop, Cursor, etc.):

MCP Config
{
  "mcpServers": {
    "gnist-eurostat": {
      "url": "https://context.gnist.ai/mcp/eurostat/",
      "headers": {
        "Gnist-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Tools (6)

get_stat

Fetch a time series from a Eurostat dataset filtered by geographic area. Covers economic, demographic, environmental, health, trade, and agricultural statistics for EU/EEA countries. Data is free to use (CC-BY-4.0). Args: dataset_code: Eurostat dataset identifier (e.g. "nama_10_gdp" for national accounts, "lfsi_emp_a" for employment). Use search_datasets or list_datasets to discover codes. geo: ISO 3166-1 alpha-2 country/region code (e.g. "NO", "DE", "EU27_2020"). Comma-separated for multiple geographies (e.g. "NO,SE,DK"). time_from: Start year (inclusive), e.g. 2015. time_to: End year (inclusive), e.g. 2023. unit: Unit filter code (e.g. "CP_MEUR" for current prices in millions of euros, "PC_GDP" for percentage of GDP). Optional — omit to get all units. freq: Frequency code: "A" (annual, default), "Q" (quarterly), "M" (monthly). Returns: Dict with dataset_code, geo, count, and a list of {geo, time, value} records sorted by time descending. Values may be null where data is unavailable.

ParameterTypeRequiredDescription
dataset_codestringrequiredEurostat dataset identifier (e.g. "nama_10_gdp" for national accounts, "lfsi_emp_a" for employment). Use search_datasets or list_datasets to discover codes.
geostringrequiredISO 3166-1 alpha-2 country/region code (e.g. "NO", "DE", "EU27_2020"). Comma-separated for multiple geographies (e.g. "NO,SE,DK").
time_fromanyoptionalStart year (inclusive), e.g. 2015.
time_toanyoptionalEnd year (inclusive), e.g. 2023.
unitanyoptionalUnit filter code (e.g. "CP_MEUR" for current prices in millions of euros, "PC_GDP" for percentage of GDP). Optional — omit to get all units.
freqstringoptionalFrequency code: "A" (annual, default), "Q" (quarterly), "M" (monthly). (default: A)
curl -X POST "https://context.gnist.ai/mcp/eurostat/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_stat", "arguments": {"dataset_code": "nama_10_gdp", "geo": "NO"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/eurostat/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'dataset_code': 'nama_10_gdp', 'geo': 'NO'},
            'name': 'get_stat'}},
)
print(resp.json())

search_datasets

Search Eurostat dataset catalogue by keyword. Covers 6,000+ statistical datasets across economics, demographics, environment, health, trade, agriculture, and more from EU and European countries. Args: query: Search term (e.g. "gdp", "unemployment", "greenhouse gas"). limit: Maximum number of results to return (default 20). Returns: Matching datasets with code, title, and data availability period. Use the code field with get_stat or compare_countries.

ParameterTypeRequiredDescription
querystringrequiredSearch term (e.g. "gdp", "unemployment", "greenhouse gas").
limitintegeroptionalMaximum number of results to return (default 20). (default: 20)
curl -X POST "https://context.gnist.ai/mcp/eurostat/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "search_datasets", "arguments": {"query": "gdp"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/eurostat/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'query': 'gdp'}, 'name': 'search_datasets'}},
)
print(resp.json())

list_datasets

Browse all available Eurostat datasets, optionally filtered by topic keyword. Args: topic_filter: Optional keyword to filter dataset titles (e.g. "trade", "energy", "migration"). Case-insensitive substring match on title and code. If omitted, returns the first 50 datasets from the catalogue. Returns: Up to 50 datasets with code, title, and data availability period. Use the code field with get_stat, compare_countries, or search_datasets.

ParameterTypeRequiredDescription
topic_filteranyoptionalOptional keyword to filter dataset titles (e.g. "trade", "energy", "migration"). Case-insensitive substring match on title and code. If omitted, returns the first 50 datasets from the catalogue.
curl -X POST "https://context.gnist.ai/mcp/eurostat/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "list_datasets", "arguments": {"topic_filter": "trade"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/eurostat/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'topic_filter': 'trade'}, 'name': 'list_datasets'}},
)
print(resp.json())

compare_countries

Compare one Eurostat dataset across multiple countries for a given year. Args: dataset_code: Eurostat dataset identifier (e.g. "nama_10_gdp"). Use search_datasets to find the right code. geo_codes: List of ISO 3166-1 alpha-2 or Eurostat geo codes (e.g. ["NO", "SE", "DE", "FR"]). year: The year to compare (e.g. 2022). unit: Unit filter code (e.g. "CP_MEUR"). Optional. Returns: Dict with dataset_code, year, and values mapping geo_code to numeric value. Values may be null if data is unavailable for a country/year pair.

ParameterTypeRequiredDescription
dataset_codestringrequiredEurostat dataset identifier (e.g. "nama_10_gdp"). Use search_datasets to find the right code.
geo_codeslist[string]requiredList of ISO 3166-1 alpha-2 or Eurostat geo codes (e.g. ["NO", "SE", "DE", "FR"]).
yearintegerrequiredThe year to compare (e.g. 2022).
unitanyoptionalUnit filter code (e.g. "CP_MEUR"). Optional.
curl -X POST "https://context.gnist.ai/mcp/eurostat/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "compare_countries", "arguments": {"dataset_code": "nama_10_gdp", "geo_codes": "[\"NO\"", "year": 2022}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/eurostat/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'dataset_code': 'nama_10_gdp',
                          'geo_codes': '["NO"',
                          'year': 2022},
            'name': 'compare_countries'}},
)
print(resp.json())

country_profile

Get a snapshot of key economic and demographic indicators for a European country. Fetches GDP, employment rate, and population in parallel from Eurostat. Data sourced from Eurostat (CC-BY-4.0), free to use. Args: geo_code: ISO 3166-1 alpha-2 country code (e.g. "NO", "DE", "FR", "SE"). Also accepts EU aggregates like "EU27_2020", "EA20". year: Specific year to retrieve. Defaults to most recent available. Returns: Country profile with GDP (million EUR), employment rate (%), and population. Any field may be null if Eurostat has no data for that country/year combination.

ParameterTypeRequiredDescription
geo_codestringrequiredISO 3166-1 alpha-2 country code (e.g. "NO", "DE", "FR", "SE"). Also accepts EU aggregates like "EU27_2020", "EA20".
yearanyoptionalSpecific year to retrieve. Defaults to most recent available.
curl -X POST "https://context.gnist.ai/mcp/eurostat/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "country_profile", "arguments": {"geo_code": "NO"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/eurostat/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'geo_code': 'NO'}, 'name': 'country_profile'}},
)
print(resp.json())

report_feedback

Report a bug, feature request, or general feedback for this data source. Use this when something doesn't work as expected, when you'd like a new feature, or when you have suggestions for improvement. Args: feedback: Describe the issue or suggestion. feedback_type: One of 'bug', 'feature_request', or 'general'.

ParameterTypeRequiredDescription
feedbackstringrequired
feedback_typestringoptional (default: general)
curl -X POST "https://context.gnist.ai/mcp/eurostat/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "report_feedback", "arguments": {"feedback": "example"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/eurostat/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'feedback': 'example'}, 'name': 'report_feedback'}},
)
print(resp.json())

Common Patterns

Search then retrieve
Use search_datasets to find items, then get_stat to get full details. This two-step pattern is common for exploring data before drilling down.
Pagination
Several tools support limit, offset, or page parameters. Start with small limits during development, then increase for production queries.

FAQ

What data does Eurostat provide?

EU statistical data — demographics, trade, GDP, employment, and social indicators. It exposes 6 tools: get_stat, search_datasets, list_datasets, compare_countries, country_profile, report_feedback.

What do I need to get started?

A Gnist API key (free tier: 100 calls/day). Sign up at https://context.gnist.ai/signup.

What format does the Eurostat API return?

JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.

Next Steps

Related Tutorials