{
  "markdown": "# @nor-data/statfin-mcp\n\nMCP server for official statistics from **Statistics Finland (Tilastokeskus)** — the\n**StatFin** database, exposed through the PxWeb API. Search 3000+ tables, inspect\ntheir dimensions, and pull data as JSON-stat2. **No API key required.**\n\nPart of the [`nor-data`](https://github.com/3121n) family of Nordic open-data MCP\nservers. Built on the same pattern as the SSB (Norway) server — StatFin and SSB both\nspeak PxWeb, so the tools mirror each other.\n\n## Tools\n\n| Tool | What it does |\n|------|--------------|\n| `sok_tabell` | Keyword 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`. |\n| `hent_tabell` | Metadata for a table: title + dimensions (variables) with their valid value codes and labels. Read this first to learn which filter codes exist. |\n| `hent_data` | Fetch actual values as JSON-stat2, filtered by a flat `{variabelkode: [verdier]}` map. Supports special selections like `{filter:'top', values:['1']}` for the latest period. |\n| `list_emner` | List the ~140 StatFin subject areas (e.g. `vaerak` = Population structure). Scope a search or browse when a keyword misses. |\n\nAll tools accept an optional `lang` (`en` default, `fi`, `sv`). Variable **codes**\nare language-independent; only titles/labels are localised.\n\n## Example agent flow\n\n1. `sok_tabell({ query: \"population by region\" })`\n   → `tabell_id: \"vaerak/statfin_vaerak_pxt_11ra.px\"`\n2. `hent_tabell({ tabell_id })` → sees variables `Alue` (area), `Vuosi` (year), `Tiedot` (info)\n3. `hent_data({ tabell_id, filtre: { Alue: [\"SSS\"], Vuosi: { filter: \"top\", values: [\"1\"] } } })`\n   → latest national figures as JSON-stat2\n\n## Install\n\n```jsonc\n// Claude Desktop / Claude Code MCP config\n{\n  \"mcpServers\": {\n    \"statfin\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@nor-data/statfin-mcp\"]\n    }\n  }\n}\n```\n\n## Develop\n\n```bash\nnpm install\nnpm run build-index   # crawl the StatFin tree → data/tables-index.json (~1–2 min)\nnpm run dev           # run from source via tsx\nnpm run build         # compile to dist/\n```\n\nThe search index is bundled in the package (`data/tables-index.json`). Re-run\n`npm run build-index` to refresh it (nightly is plenty — StatFin updates tables,\nnot the tree, frequently).\n\n### Notes & limits\n\n- PxWeb allows **30 calls / 10 s** and rejects queries over **~100 000 cells**\n  (HTTP 403) — keep `hent_data` selections small (few regions × few years).\n- A few subjects (`vtp`, `kivih`, `sekn`, `akay`) return HTTP 400 server-side and\n  are skipped during indexing; this is a StatFin quirk, not a bug here. The index\n  records them under `skipped`.\n- Data licensed under CC BY 4.0 by Statistics Finland.\n\n## License\n\nMIT\n",
  "bytes": 2806,
  "sha": "1de9657bdb7b1545d3d70053a7fea0f2b068e1b5b8e6e7e6214acd5ceb7c291d",
  "repo_slug": "3121n/nor-data-statfin-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_3121n_statfin_mcp_4edd32d6/readme"
}