Statistics Sweden logo

Statistics Sweden

Community
isakskogstad

Connect LLMs or AI-chatbots to let them query and interact with official data and statistics from SCB (Sweden Statistics)

Publisherisakskogstad
RepositorySCB-MCP
LanguageTypeScript
Forks
5
Stars
8
Available tools
10
Transport typestreamable-http
Categories
Links
  • Connect tools to AI workflows

    Statistics Sweden exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 10 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    8 stars and 5 forks from the linked repository.

MCP Registry MCP Protocol

📊 SCB MCP Server

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

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
  • Labor Market: Employment, unemployment, occupational data, skills matching
  • Education: Student statistics, course enrollments, skills development

Data ranges from 1950s to present (monthly/quarterly updates). Real-time population statistics updated to November 2025.

  • Befolkning & demografi: Regionaldata, migrationer, födslar, dödsfall (312+ regioner)
  • Ekonomi & finans: BNP, skatter, företagsstatistik, nationalräkenskaper
  • Miljö: Växthusgaser, vatten/avfallshantering, hållbarhetsvärdena
  • Arbetsmarknad: Sysselsättning, arbetslöshet, yrkesdata, kompetensmatchning
  • Utbildning: Studentstatistik, kursanmälningar, kompetensutveckling

FeatureDescription
Comprehensive Access1,200+ tables, 312+ regions, 75+ years of historical data
Smart QueryingNatural language search, region code resolution ("Lerum" → 1441), TOP() & wildcard support
Fuzzy Matching"Goteborg" matches "Göteborg", "Malmo" matches "Malmö"
Developer-FriendlyFull documentation, clear errors with suggestions, selection validation, metadata in responses
Production-ReadyRate limiting (30 req/10s), consistent behavior, proper data types, language support (SV/EN)
Swedish by DefaultAll tools use Swedish (sv) as default for best search results
Real-Time DataMonthly/quarterly updates, population data to November 2025

Huvudfunktioner

FunktionBeskrivning
Omfattande åtkomst1 200+ tabeller, 312+ regioner, 75+ års historiska data
Smart sökningNaturspråkig sökning, regionkodupplösning ("Lerum" → 1441), TOP() & wildcard-stöd
Fuzzy matching"Goteborg" matchar "Göteborg", "Malmo" matchar "Malmö"
UtvecklarvänligFullständig dokumentation, tydliga felmeddelanden, valideringsmöjligheter, metadata i svaren
ProduktionsklarRate limiting (30 req/10s), konsekvent beteende, rätt datatyper, språkstöd (SV/EN)
Svenska som standardAlla verktyg använder svenska (sv) som default för bästa sökresultat
Aktuell dataMånatliga/kvartalsvisa uppdateringar, befolkningsdata till november 2025

🚀 Installation

Servern körs lokalt via stdio. Klona, bygg och peka din MCP-klient mot dist/index.js.

bash
git clone https://github.com/isakskogstad/SCB-MCP.git
cd SCB-MCP
npm install
npm run build

Claude Code (CLI)

bash
claude mcp add scb -- node /absolut/sökväg/till/SCB-MCP/dist/index.js

Claude Desktop / Codex / Gemini / Cursor (stdio)

Lägg till i klientens MCP-konfiguration (t.ex. ~/Library/Application Support/Claude/claude_desktop_config.json för Claude Desktop):

json
{
  "mcpServers": {
    "scb": {
      "command": "node",
      "args": ["/absolut/sökväg/till/SCB-MCP/dist/index.js"]
    }
  }
}

The server runs locally over stdio. Clone, build, and point your MCP client to dist/index.js.

bash
git clone https://github.com/isakskogstad/SCB-MCP.git
cd SCB-MCP
npm install
npm run build

Claude Code (CLI)

bash
claude mcp add scb -- node /absolute/path/to/SCB-MCP/dist/index.js

Claude Desktop / Codex / Gemini / Cursor (stdio)

json
{
  "mcpServers": {
    "scb": {
      "command": "node",
      "args": ["/absolute/path/to/SCB-MCP/dist/index.js"]
    }
  }
}

Användarguide

1. Sök efter statistiktabeller

python
# Hitta befolkningsrelaterade tabeller
results = scb.search_tables(query="befolkning statistik", limit=10)

# Filtrera efter kategori
results = scb.search_tables(query="miljö", category="environment", limit=5)

1. Search for statistical tables

python
results = scb.search_tables(query="population", limit=10)
results = scb.search_tables(query="environment", category="environment", limit=5)

2. Hitta regionkoder

python
# 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"
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
python
data = scb.get_table_data(
    tableId="TAB637",
    selection={
        "Region": ["1441"],
        "Kon": ["1+2"],
        "Tid": ["2024"],
        "ContentsCode": ["BE0101G9"]
    }
)

Best practices

ProblemLösning
Stor datamängd?Använd alltid preview_data() först för att testa
För mycket data?Använd "TOP(5)" istället för "*" för tidsperioder
Felaktiga koder?Anropa get_table_variables() först — koder varierar mellan tabeller
Osäker på enheter?Kontrollera variabeletikett för enheter (kt, ton, procent osv.)
IssueSolution
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
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)

Resurser


Av: Isak Skogstad

Installation

TypingMind
{
  "mcpServers": {
    "scb": {
      "url": "https://scb-mcp.onrender.com/mcp",
      "env": null
    }
  }
}

Available Tools

  • scb_get_api_status

    Get API configuration and rate limit information from Statistics Sweden

  • scb_search_tables

    Search for statistical tables in the SCB database. IMPORTANT: Swedish search terms give MUCH better results. Use "befolkning" not "population", "arbetslöshet" not "unemployment", "inkomst" not "income".

  • scb_get_table_info

    Get detailed metadata about a specific statistical table

  • scb_get_table_data

    Get statistical data from a table with optional filtering. Without selection, returns a smart default subset (latest time period, all categories). Use scb_preview_data for a quick preview first.

  • scb_check_usage

    Check current API usage and rate limit status

  • scb_search_regions

    Search for region codes by name (e.g., find code for "Lerum", "Stockholm"). Supports fuzzy matching for Swedish characters.

  • scb_get_table_variables

    Get available variables and their possible values for a table (essential before fetching data)

  • scb_find_region_code

    Find the exact region code for a specific municipality or area. Supports fuzzy matching (e.g., "Goteborg" matches "Göteborg").

  • scb_test_selection

    Test if a data selection is valid without retrieving data (prevents API errors). Always use this before scb_get_table_data.

  • scb_preview_data

    Get a small preview of data (max ~50 rows) to verify table structure and selection before fetching full data. Safer than scb_get_table_data for initial exploration.

Use Statistics Sweden MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Statistics Sweden is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP connects through a hosted MCP server URL in TypingMind.

Add an MCP server URL

Use this when Statistics Sweden is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter https://scb-mcp.onrender.com/mcp in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste https://scb-mcp.onrender.com/mcp into the Server URL field.
  2. Enter a connection name for Statistics Sweden.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the Statistics Sweden connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the Statistics Sweden tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the Statistics Sweden tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Statistics Sweden to help me with this task?
Statistics Sweden
Sure. I read it.
Here is what I found using Statistics Sweden.

Frequently asked questions

What is the Statistics Sweden MCP server used for?

Statistics Sweden is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Statistics Sweden MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Statistics Sweden with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Statistics Sweden MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Statistics Sweden connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Statistics Sweden MCP to TypingMind?

Statistics Sweden can be connected in TypingMind by adding its hosted MCP server URL. This is useful when you want a remote MCP connection that is available from your TypingMind workspace.

What tools does Statistics Sweden MCP provide in TypingMind?

Statistics Sweden exposes 10 MCP tools that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Statistics Sweden MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Statistics Sweden requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇