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 分