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
- Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
- Choose your integration method: MCP protocol or REST API.
Connect via MCP
Add to your MCP client config (Claude Desktop, Cursor, etc.):
{
"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.
| Parameter | Type | Required | Description |
|---|---|---|---|
dataset_code | string | required | 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 | string | required | 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 | any | optional | Start year (inclusive), e.g. 2015. |
time_to | any | optional | End year (inclusive), e.g. 2023. |
unit | any | optional | 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 | string | optional | Frequency 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | required | Search term (e.g. "gdp", "unemployment", "greenhouse gas"). |
limit | integer | optional | Maximum 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
topic_filter | any | optional | 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. |
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.
| Parameter | Type | Required | Description |
|---|---|---|---|
dataset_code | string | required | Eurostat dataset identifier (e.g. "nama_10_gdp"). Use search_datasets to find the right code. |
geo_codes | list[string] | required | List of ISO 3166-1 alpha-2 or Eurostat geo codes (e.g. ["NO", "SE", "DE", "FR"]). |
year | integer | required | The year to compare (e.g. 2022). |
unit | any | optional | Unit 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
geo_code | string | required | ISO 3166-1 alpha-2 country code (e.g. "NO", "DE", "FR", "SE"). Also accepts EU aggregates like "EU27_2020", "EA20". |
year | any | optional | Specific 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'.
| Parameter | Type | Required | Description |
|---|---|---|---|
feedback | string | required | |
feedback_type | string | optional | (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
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.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.