Scb Opendata Mcp

io.github.ashwinvis由 GitHub 帳號 ashwinvis 發布v0.2.1更新於 Oct 24, 2026

Statistics Sweden’s open data made available as an MCP server, using Python and FastMCP

概覽

AI 產生的概覽

讓助理透過 SCB PxWebApi v2 瀏覽並取得瑞典統計局的開放統計表、代碼清單與已儲存查詢。

可以做什麼
提供工具來列出與搜尋約 5,155 個統計表、讀取表中繼資料與變數,並依選用條件取得表資料。它也提供有效篩選值的代碼清單、預設選取,以及儲存、取得與刪除查詢的已儲存查詢工具。結果支援分頁,並支援英文或瑞典文標籤。
適用情境
當助理需要關於就業、勞動成本、薪資或類似民用資料的瑞典官方統計資料,並希望在對話中完成表的探索與篩選資料取得,而非手動呼叫 API 時,適合使用。
執行需求
以 Python 套件(scb-opendata-mcp)透過 stdio 在本機執行,需要 Python 3.11 或更高版本以及 pip 或 uv。需要網路存取瑞典統計局的 PxWebApi v2。未宣告帳號、API 金鑰或環境變數。
安裝前請注意
README 說明這是非官方工具,程式碼由 AI 產生,並建議在正式使用前進行徹底驗證。已儲存查詢工具可以建立與刪除儲存的查詢,因此請審查寫入操作。資料透過網路從瑞典統計局的公開 API 取得。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Scb Opendata Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

MCP Server for Statistics Sweden (SCB) API

[PyPI]

A FastMCP server that provides access to Statistics Sweden's PxWebApi v2, offering statistical tables covering employment, labor costs, wages, and other civil data from Sweden.

Features

  • Table Discovery: Browse and search 5,155 statistical tables
  • Data Retrieval: Fetch statistical data with optional filtering
  • Codelists: Access code lists for valid filter values
  • Saved Queries: Save and retrieve frequently used queries
  • Pagination: Handle large result sets efficiently
  • Language Support: English and Swedish
  • Error Handling: Robust error handling with retry logic

Installation

Prerequisites

  • Python 3.11 or higher
  • pip or uv package manager

Install from PyPI

bash
pip install scb-opendata-mcp
# Or with uvuvx scb_opendata_mcp

Install from source

bash
# Clone the repositorygit clone https://github.com/ashwinvis/scb-opendata-mcp.gitcd scb-opendata-mcp
# Install dependenciespip install .
# Or with uvuv sync

Usage

Running the server

The package on installation

bash
scb_opendata_mcp
# Or with uvuv run scb_opendata_mcp

See scb_opendata_mcp --help for available options. An stdio transport mechanism also exists.

Fallback option

bash
uv run fastmcp run src/scb_opendata_mcp/server.py -t http  # HTTP server

Configuration for common agent harnesses

Claude Code

bash
claude mcp add --scope user --transport http scb_opendata_mcp http://localhost:6767

Mistral Vibe

In ~/.vibe/config.toml or ~/.vibe/agents/name_of_agent.toml:

toml
[[mcp_servers]]name = "scb_opendata_mcp"transport = "http"url = "http://localhost:6767/mcp"

OpenCode

In ~/.config/opencode/opencode.jsonc:

json
{  "mcp": {    "scb_opendata_mcp": {      "type": "remote",      "url": "https://localhost:6767/mcp",      "enabled": true    }  }}

Tools Available

Table Discovery

  • list_tables() - List all available statistical tables with pagination
  • get_table_metadata(table_id) - Get detailed metadata including variables
  • search_tables(query) - Convenience wrapper over list_tables, to search tables by name or description

Data Retrieval

  • get_table_data(table_id, filters) - Fetch data with optional filtering
  • get_table_default_selection(table_id) - Get default data selection for a table

Codelist Tools

  • list_codelists(table_id) - List all available codelists for the table
  • get_codelist(codelist_id) - Get specific codelist details

Saved Query Tools

  • get_saved_query(query_id) - Get a saved query including data and selection criteria
  • get_saved_query_data(query_id) - Get data from a specific saved query
  • get_saved_query_selection(query_id) - Get the selection query used in a specific saved query
  • save_query(table_id, selection) - Save a data query
  • delete_saved_query(query_id) - Delete a saved query

Development

Running Tests

bash
uv run pytest

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License

Support

For issues or questions:

SCB Open Data Skills

This is an unofficial companion repository SCB Open Data Skills that provides skill definitions for accessing Statistics Sweden's data through this MCP server. These skills are designed to work with major coding agent tools and provide workflows for various statistical domains.

Disclaimer

This is an unofficial tool. The code was generated using AI while using official documents and the API specification as context. Tests are also added to verify the functionality. A thorough rigorous verification test is recommended before using it in any serious application.

來源:README.md,提交 a13e0b5

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.2.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分