s

scb-mcp

@isakskogstad/scb-mcp
Hosted
0 Stars 7 次浏览 isakskogstad 更新于 2026-08-23

MCP server for Statistics Sweden (SCB) - 1200+ tables with population, economy, environment data

该服务暂未提供标准配置,请参考 README 手动接入

可用工具 (5 个)

该服务在 MCP 协议中暴露的工具,AI 可按需调用

tavily_search 14 个参数 需填 1 项

Search the web for current information on any topic. Use for news, facts, or data beyond your knowledge cutoff. Returns snippets and source URLs.

必填参数:query

tavily_extract 6 个参数 需填 1 项

Extract content from URLs. Returns raw page content in markdown or text format.

必填参数:urls

tavily_crawl 11 个参数 需填 1 项

Crawl a website starting from a URL. Extracts content from pages with configurable depth and breadth.

必填参数:url

tavily_map 8 个参数 需填 1 项

Map a website's structure. Returns a list of URLs found starting from the base URL.

必填参数:url

tavily_research 2 个参数 需填 1 项

Perform comprehensive research on a given topic or question. Use this tool when you need to gather information from multiple sources to answer a question or complete a task. Returns a detailed response based on the research findings.

必填参数:input

服务介绍

MCP Registry
Server Status
![MCP Protocol](https://img.shields.io/badge/MCP-2025- -03- -26-green)

📊 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

| Feature | Description |
|- -- -- -- --|- -- -- -- -- -- --|
| Comprehensive Access | 1,200+ tables, 312+ regions, 75+ years of historical data |
| Smart Querying | Natural language search, region code resolution ("Lerum" → 1441), TOP() & wildcard support |
| Fuzzy Matching | "Goteborg" matches "Göteborg", "Malmo" matches "Malmö" |
| Developer-Friendly | Full documentation, clear errors with suggestions, selection validation, metadata in responses |
| Production-Ready | Rate limiting (30 req/10s), consistent behavior, proper data types, language support (SV/EN) |
| Swedish by Default | All tools use Swedish (sv) as default for best search results |
| Real-Time Data | Monthly/quarterly updates, population data to November 2025 |

# Huvudfunktioner

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


# 🚀 Snabbstart

Enklaste sättet: Använd den redan hostade servern — ingen installation behövs!

MCP remote URL: https://scb-mcp.onrender.com/mcp

Lägg till denna konfiguration i din MCP-värd:

{
  "mcpServers": {
    "scb": {
      "type": "http",
      "url": "https://scb-mcp.onrender.com/mcp"
    }
  }
}

Klart! Du har nu tillgång till alla 1 200+ svenska statistiktabeller.

Easiest way: Use the already hosted server — no installation needed!

MCP remote URL: https://scb-mcp.onrender.com/mcp

Add this configuration to your MCP host:

{
  "mcpServers": {
    "scb": {
      "type": "http",
      "url": "https://scb-mcp.onrender.com/mcp"
    }
  }
}

Done! You now have access to all 1,200+ Swedish statistical tables.


# Installation & inställning

# # Alternativ 1: Remote URL (ingen installation)

Använd den hostade servern direkt - fungerar med alla MCP-kompatibla klienter:

URL: https://scb-mcp.onrender.com/mcp

| Klient | Hur du ansluter |
|- -- -- -- -|- -- -- -- -- -- -- -- --|
| GitHub Copilot (VS Code) | Lägg till i .vscode/mcp.json (se nedan) |
| ChatGPT (Dev Mode) | Lägg till MCP server URL: https://scb-mcp.onrender.com/mcp |
| Claude Web | Lägg till MCP server: https://scb-mcp.onrender.com/mcp |
| Gemini | Konfigurera HTTP MCP endpoint |
| Custom | POST till /mcp med JSON-RPC 2.0 |

# # # GitHub Copilot (VS Code)

Skapa .vscode/mcp.json i ditt projekt:

{
  "servers": {
    "scb": {
      "type": "http",
      "url": "https://scb-mcp.onrender.com/mcp"
    }
  }
}

Eller använd Command Palette: MCP: Add Server och välj HTTP-typ.

Ingen autentisering krävs. CORS är aktiverat för alla domäner.


# # Alternativ 2: Lokal installation (Node.js)

För Claude Code, terminal-klienter eller egen hosting:

#  Klona repository
git clone https://github.com/isakskogstad/SCB-MCP.git
cd SCB-MCP

#  Installera och bygg
npm install
npm run build

# # # Claude Code (CLI)

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

# # # MCP-konfiguration (stdio)

Lägg till i ~/.config/claude/claude_desktop_config.json:

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

# # # Kör egen HTTP-server

npm run start  #  Startar på port 3000
#  eller
PORT=8080 npm run start

# # Alternativ 3: Docker

docker build -t scb-mcp .
docker run -p 3000:3000 scb-mcp

# # Option 1: Remote URL (no installation)

Use the hosted server directly - works with all MCP-compatible clients:

URL: https://scb-mcp.onrender.com/mcp

| Client | How to connect |
|- -- -- -- -|- -- -- -- -- -- -- -- -|
| ChatGPT (Dev Mode) | Add MCP server URL: https://scb-mcp.onrender.com/mcp |
| Claude Web | Add MCP server: https://scb-mcp.onrender.com/mcp |
| Gemini | Configure HTTP MCP endpoint |
| Custom | POST to /mcp with JSON-RPC 2.0 |

No authentication required. CORS enabled for all origins.


# # Option 2: Local installation (Node.js)

For Claude Code, terminal clients or self-hosting:

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

# # # Claude Code (CLI)

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

# # # MCP configuration (stdio)

Add to ~/.config/claude/claude_desktop_config.json:

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

# # # Run your own HTTP server

npm run start  #  Starts on port 3000
#  or
PORT=8080 npm run start

# # Option 3: Docker

docker build -t scb-mcp .
docker run -p 3000:3000 scb-mcp

# Användarguide

# # 1. Sök efter statistiktabeller

#  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

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

# # 2. Hitta regionkoder

#  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"
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

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

# Best practices

| Problem | Lö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.) |

| 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

#  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
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

相关 MCP 服务