MCP server for Statistics Sweden (SCB) - 1200+ tables with population, economy, environment data
io.github.isakskogstad/scb-mcp (SCB MCP) Server
This MCP server provides access for LLMs and AI chatbots to search, find, and retrieve official data and statistics from Statistics Sweden (Statistikbyrån, SCB). It focuses on 1,200+ tables covering population, economy, and environment data.
🛠️ Key Features
Official statistics access via MCP
Search and retrieval of SCB tables
Data coverage includes population, economy, and environment
Identified as a “remote-MCP-server” in its topics list
🚀 Use Cases
Find relevant official SCB statistics for analysis
Retrieve population, economy, and environment datasets from 1,200+ tables
Query SCB data through MCP-enabled LLM workflows
⚡ Developer Benefits
MCP protocol integration (referenced as “MCP-2025-03-26”)
Published in the MCP Registry (badge indicates “Published”)
Clear focus on SCB open-data and official-statistics sources
⚠️ Limitations
Description provided does not list specific tools or endpoints (toolCount not included)
Capabilities described at a high level only (no table schemas or query examples included)
SCB MCP är server som LLM:s och AI-chatbotar kan använda för att söka, hitta och hämta officiell data och statistik från Statistikbyrån (SCB). Det omfattar 1 200+ statistiktabeller med data om befolkning & demografi, ekonomi & finans, miljö, arbetsmarknad, utbildning och transport. Perfekt för att bygga interaktiva instrumentpaneler, forskningsverktyg och utbildningsapplikationer.
Översikt
🇬🇧 Overview
The SCB MCP server provides seamless integration with Statistics Sweden's PxWebAPI 2.0, enabling LLM:s to access:
Population & Demographics: Regional data, migrations, births, deaths (312+ regions)
Economy & Finance: GDP, taxes, business statistics, national accounts
Environment: Greenhouse gas emissions, water/waste management, sustainability metrics
# Lerum kommun
region = scb.find_region_code(query="Lerum")
# Returnerar: code="1441", name="Lerum"# Större regioner
region = scb.find_region_code(query="Stockholm")
# Returnerar: code="01" (län), code="0180" (kommun)# Fuzzy matching - fungerar utan svenska tecken
region = scb.find_region_code(query="Goteborg")
# Returnerar: code="1480", name="Göteborg"
🇬🇧 Resolve region codes (English)
python
region = scb.find_region_code(query="Lerum")
region = scb.find_region_code(query="Stockholm")
# Fuzzy matching - works without Swedish characters
region = scb.find_region_code(query="Goteborg")
# Returns: code="1480", name="Göteborg"
3. Hämta data
python
# Medelålder i Lerum 2024
data = scb.get_table_data(
tableId="TAB637",
selection={
"Region": ["1441"],
"Kon": ["1+2"],
"Tid": ["2024"],
"ContentsCode": ["BE0101G9"]
}
)
# Resultat: Medelålder i Lerum 2024: 40.1 år
Anropa get_table_variables() först — koder varierar mellan tabeller
Osäker på enheter?
Kontrollera variabeletikett för enheter (kt, ton, procent osv.)
🇬🇧 Best practices (English)
Issue
Solution
Large dataset?
Always use preview_data() first to test
Too much data?
Use "TOP(5)" instead of "*" for time periods
Wrong codes?
Call get_table_variables() first — codes vary between tables
Unsure about units?
Check variable label for units (kt, tonnes, percent, etc.)
Praktiska exempel
Ex: Befolkningstrend Lerum vs Stockholm
python
# Jämför två regioner över tid
data = scb.get_table_data(
tableId="TAB637",
selection={
"Region": ["1441", "0180"], # Lerum och Stockholm"Kon": ["1+2"],
"Tid": ["TOP(5)"],
"ContentsCode": ["BE0101G9"]
}
)
# Stockholm: 41.0 år (2024), Lerum: 40.1 år (2024)# Trend: Stockholm åldras snabbare
🇬🇧 Example 1: Population trends (English)
python
data = scb.get_table_data(
tableId="TAB637",
selection={
"Region": ["1441", "0180"], # Lerum and Stockholm"Kon": ["1+2"],
"Tid": ["TOP(5)"],
"ContentsCode": ["BE0101G9"]
}
)
# Stockholm: 41.0 years (2024), Lerum: 40.1 years (2024)