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 分

    請在儲存庫或註冊中心條目中宣告授權條款。