npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@iflow-mcp/ksaklfszf921-scb-mcp

v2.5.3

Published

Model Context Protocol server for Statistics Sweden (SCB) PX API

Readme

MCP Registry Server Status 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

| 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

  • SCB-databas: https://www.scb.se/
  • API-dokumentation: https://www.scb.se/en/services/open-data-api/pxwebapi/
  • Dataexplorer: https://pxweb.scb.se/pxweb/en/

Av: Isak Skogstad