Statfin Mcp

io.github.3121n由 GitHub 账号 3121n 发布v0.1.0更新于 Oct 24, 2026

Statistics Finland (StatFin/PxWeb): search tables, read metadata, fetch JSON-stat2 data.

概览

AI 生成的概览

让助手搜索芬兰统计局的 StatFin 数据表、读取其元数据,并以 JSON-stat2 格式获取官方统计数据。

可以做什么
封装 StatFin 的 PxWeb API,用于芬兰官方统计。工具可用本地打包的索引按关键词搜索 3000 多张表,返回表的标题与维度及有效取值代码,按条件获取 JSON-stat2 数据,并列出约 140 个主题领域。所有工具都接受可选语言参数(默认英语,另有芬兰语、瑞典语);变量代码与语言无关。
适用场景
当助手需要芬兰官方统计数据(如人口、经济等 StatFin 主题),并按地区、年份和变量筛选时适用。也适合在查询前先了解有哪些表以及维度代码。
运行要求
作为本地 stdio 进程运行,通常用 npx 从 npm 包 @nor-data/statfin-mcp 启动,因此需要 Node.js 以及访问 StatFin PxWeb API 的网络连接。无需 API 密钥或账号。
安装前请注意
查询会发送到芬兰统计局的公开 PxWeb API,该接口限制为每 10 秒 30 次调用,并拒绝超过约 10 万个单元格的查询。少数主题在服务端返回 HTTP 400,构建打包搜索索引时会被跳过。数据由芬兰统计局以 CC BY 4.0 许可。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Statfin Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

@nor-data/statfin-mcp

MCP server for official statistics from Statistics Finland (Tilastokeskus) — the StatFin database, exposed through the PxWeb API. Search 3000+ tables, inspect their dimensions, and pull data as JSON-stat2. No API key required.

Part of the nor-data family of Nordic open-data MCP servers. Built on the same pattern as the SSB (Norway) server — StatFin and SSB both speak PxWeb, so the tools mirror each other.

Tools

ToolWhat it does
sok_tabellKeyword search across all StatFin tables. PxWeb has no server-side search, so this matches a bundled index (built from the full table tree) locally and returns the most relevant tables with their tabell_id.
hent_tabellMetadata for a table: title + dimensions (variables) with their valid value codes and labels. Read this first to learn which filter codes exist.
hent_dataFetch actual values as JSON-stat2, filtered by a flat {variabelkode: [verdier]} map. Supports special selections like {filter:'top', values:['1']} for the latest period.
list_emnerList the ~140 StatFin subject areas (e.g. vaerak = Population structure). Scope a search or browse when a keyword misses.

All tools accept an optional lang (en default, fi, sv). Variable codes are language-independent; only titles/labels are localised.

Example agent flow

  1. sok_tabell({ query: "population by region" }) → tabell_id: "vaerak/statfin_vaerak_pxt_11ra.px"
  2. hent_tabell({ tabell_id }) → sees variables Alue (area), Vuosi (year), Tiedot (info)
  3. hent_data({ tabell_id, filtre: { Alue: ["SSS"], Vuosi: { filter: "top", values: ["1"] } } }) → latest national figures as JSON-stat2

Install

jsonc
// Claude Desktop / Claude Code MCP config{  "mcpServers": {    "statfin": {      "command": "npx",      "args": ["-y", "@nor-data/statfin-mcp"]    }  }}

Develop

bash
npm installnpm run build-index   # crawl the StatFin tree → data/tables-index.json (~1–2 min)npm run dev           # run from source via tsxnpm run build         # compile to dist/

The search index is bundled in the package (data/tables-index.json). Re-run npm run build-index to refresh it (nightly is plenty — StatFin updates tables, not the tree, frequently).

Notes & limits

  • PxWeb allows 30 calls / 10 s and rejects queries over ~100 000 cells (HTTP 403) — keep hent_data selections small (few regions × few years).
  • A few subjects (vtp, kivih, sekn, akay) return HTTP 400 server-side and are skipped during indexing; this is a StatFin quirk, not a bug here. The index records them under skipped.
  • Data licensed under CC BY 4.0 by Statistics Finland.

License

MIT

来源:README.md,提交 4dbfb9d

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

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

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。