@statsmcp/statfin 0.0.0-stage → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tadej Polajnar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,65 @@
1
- # Temporary Holding Version
1
+ # @statsmcp/statfin
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ An MCP server for [StatFin](https://pxdata.stat.fi/PxWeb/pxweb/en/StatFin/), the database of Statistics Finland (Tilastokeskus). It gives AI assistants access to its tables in Finnish, Swedish and English.
4
+
5
+ > This project is not affiliated with or endorsed by Statistics Finland.
6
+
7
+ ## Use the server
8
+
9
+ ### Hosted
10
+
11
+ Add `https://statsmcp.dev/fi/mcp` as a remote MCP server. It uses Streamable HTTP and needs no authentication. For the steps for each client, refer to [statsmcp.dev/finland](https://statsmcp.dev/finland/).
12
+
13
+ ### Local
14
+
15
+ You need Node.js 20 or later.
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "statfin": { "command": "npx", "args": ["-y", "@statsmcp/statfin"] }
21
+ }
22
+ }
23
+ ```
24
+
25
+ For Claude Code:
26
+
27
+ ```sh
28
+ claude mcp add statfin -- npx -y @statsmcp/statfin
29
+ ```
30
+
31
+ ## Tools
32
+
33
+ | Tool | What it does |
34
+ | -------------------- | ------------------------------------------------------------------------------------------------ |
35
+ | `search_tables` | Finds tables by keywords in their titles. Returns table IDs, titles and publication dates. |
36
+ | `get_table_metadata` | Lists the variables of a table and their value codes. Use `valueFilter` to find a value by name. |
37
+ | `query_table` | Returns data as CSV with readable labels. Use `latest` for recent periods. |
38
+
39
+ All tools are read-only. Each tool accepts `lang` (`fi`, `sv` or `en`). Statistics Finland allows about 40 API calls per minute. The server keeps results in a cache to use fewer calls.
40
+
41
+ ## Use it in your own server
42
+
43
+ ```sh
44
+ npm install @statsmcp/statfin
45
+ ```
46
+
47
+ ```ts
48
+ import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
49
+ import { createStatfinServer } from '@statsmcp/statfin';
50
+
51
+ const server = createStatfinServer({ userAgent: 'my-app/1.0' });
52
+ await server.connect(new StdioServerTransport());
53
+ ```
54
+
55
+ `createStatfinServer` returns an `McpServer`. It also accepts a `cache`. To make one, install `@statsmcp/core` and use `createMemoryCache`, or implement the `Cache` interface.
56
+
57
+ ## Data licence and attribution
58
+
59
+ Statistics Finland publishes its data under the [Creative Commons Attribution 4.0 licence (CC BY 4.0)](https://stat.fi/en/about-us/get-to-know-statistics-finland/legislation/terms-of-use). You can use it for any purpose, including commercial use, if you name Statistics Finland as the source.
60
+
61
+ Each result contains the source line with the licence link, and a link to the table on StatFin. If you change the data or calculate new figures, say so, for example: `Source: Statistics Finland / Calculated by <you>`.
62
+
63
+ ## Licence
64
+
65
+ The code is under the MIT licence. The data belongs to Statistics Finland.
package/dist/bin.d.mts ADDED
@@ -0,0 +1 @@
1
+ export {}
package/dist/bin.mjs ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { t as createStatfinServer } from "./src-Csk-nzeT.mjs";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
4
+ // src/bin.ts
5
+ await createStatfinServer().connect(new StdioServerTransport());
6
+ export {};
@@ -0,0 +1,5 @@
1
+ import { PresetServerOptions, PxwebPreset } from "@statsmcp/core";
2
+ import { McpServer } from "@modelcontextprotocol/server";
3
+ export declare const statfinPreset: PxwebPreset;
4
+ export type StatfinServerOptions = Pick<PresetServerOptions, 'cache' | 'userAgent'>;
5
+ export declare function createStatfinServer(options?: StatfinServerOptions): McpServer;
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export { t as createStatfinServer, n as statfinPreset } from "./src-Csk-nzeT.mjs";
@@ -0,0 +1,96 @@
1
+ import { createPresetServer } from "@statsmcp/core";
2
+ // src/preset.ts
3
+ const LICENCE = "CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)";
4
+ const ATTRIBUTION = {
5
+ fi: `Lähde: Tilastokeskus, ${LICENCE}`,
6
+ sv: `Källa: Statistikcentralen, ${LICENCE}`,
7
+ en: `Source: Statistics Finland, ${LICENCE}`
8
+ };
9
+ const statfinPreset = {
10
+ name: "statfin",
11
+ title: "StatFin (Statistics Finland official statistics)",
12
+ version: "0.3.0",
13
+ apiBaseUrl: "https://pxdata.stat.fi/PXWeb/api/v1",
14
+ database: "StatFin",
15
+ languages: [
16
+ "fi",
17
+ "sv",
18
+ "en"
19
+ ],
20
+ attribution: (lang) => {
21
+ if (lang === "fi") return ATTRIBUTION.fi;
22
+ if (lang === "sv") return ATTRIBUTION.sv;
23
+ return ATTRIBUTION.en;
24
+ },
25
+ tableUrl: (lang, tableId) => {
26
+ const pageLang = ["fi", "sv"].includes(lang) ? lang : "en";
27
+ const segments = tableId.split("/");
28
+ const file = segments.pop() ?? tableId;
29
+ return `https://pxdata.stat.fi/PxWeb/pxweb/${pageLang}/StatFin/${["StatFin", ...segments].join("__")}/${file}/`;
30
+ },
31
+ instructions: `Official statistics for Finland from StatFin, the database of Statistics Finland (Tilastokeskus). This server is not affiliated with or endorsed by Statistics Finland.
32
+
33
+ To answer a question with data:
34
+ 1. Call \`search_tables\` with short topic keywords in Finnish ("fi"), Swedish ("sv") or English ("en"). Try another language when results are poor.
35
+ 2. Call \`get_table_metadata\` on the best table to see its variables and value codes. Use \`valueFilter\` to find a municipality, region or industry by name.
36
+ 3. Call \`query_table\` with only the values you need. Use \`latest\` for recent periods.
37
+
38
+ Statistics Finland allows about 40 API calls per minute, so avoid unnecessary calls. Always cite the source line that each result ends with. If you calculate new figures from the data, say they are your own calculation based on Statistics Finland data.`,
39
+ maxCells: 5e3,
40
+ searchLimit: 10,
41
+ searchAliases: {
42
+ en: [
43
+ {
44
+ terms: ["inflation", "consumer prices"],
45
+ query: "CPI"
46
+ },
47
+ {
48
+ terms: [
49
+ "salary",
50
+ "salaries",
51
+ "wage"
52
+ ],
53
+ query: "earnings"
54
+ },
55
+ {
56
+ terms: [
57
+ "housing price",
58
+ "house price",
59
+ "home price",
60
+ "property price"
61
+ ],
62
+ query: "prices of dwellings"
63
+ }
64
+ ],
65
+ fi: [
66
+ {
67
+ terms: ["inflaatio", "hintataso"],
68
+ query: "kuluttajahintaindeksi"
69
+ },
70
+ {
71
+ terms: [
72
+ "palkka",
73
+ "palkat",
74
+ "palkko"
75
+ ],
76
+ query: "ansiotasoindeksi"
77
+ },
78
+ {
79
+ terms: ["asuntojen hin", "asuntohin"],
80
+ query: "osakeasuntojen hinnat"
81
+ }
82
+ ],
83
+ sv: [{
84
+ terms: ["inflation"],
85
+ query: "konsumentprisindex"
86
+ }, {
87
+ terms: ["lön", "löner"],
88
+ query: "förtjänstnivåindex"
89
+ }]
90
+ }
91
+ };
92
+ // src/index.ts
93
+ function createStatfinServer(options = {}) {
94
+ return createPresetServer(statfinPreset, options);
95
+ }
96
+ export { statfinPreset as n, createStatfinServer as t };
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "@statsmcp/statfin",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.3.0",
4
+ "description": "MCP server for StatFin, the database of Statistics Finland (Tilastokeskus)",
5
+ "license": "MIT",
6
+ "author": "Tadej Polajnar",
7
+ "homepage": "https://statsmcp.dev/finland/",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Stats-MCP/statsmcp.git",
11
+ "directory": "packages/statfin"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/Stats-MCP/statsmcp/issues"
15
+ },
16
+ "type": "module",
17
+ "engines": {
18
+ "node": ">=20"
19
+ },
20
+ "keywords": [
21
+ "mcp",
22
+ "statfin",
23
+ "tilastokeskus",
24
+ "finland",
25
+ "statistics",
26
+ "pxweb"
27
+ ],
28
+ "bin": {
29
+ "statfin-mcp": "./dist/bin.mjs"
30
+ },
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.mts",
34
+ "default": "./dist/index.mjs"
35
+ }
36
+ },
37
+ "files": [
38
+ "dist"
39
+ ],
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "dependencies": {
44
+ "@modelcontextprotocol/server": "^2.4.0",
45
+ "@statsmcp/core": "0.3.0"
46
+ },
47
+ "devDependencies": {
48
+ "@types/node": "26.6.5",
49
+ "tsdown": "0.23.2",
50
+ "typescript": "7.0.2",
51
+ "vitest": "5.0.5"
52
+ },
53
+ "scripts": {
54
+ "build": "tsdown",
55
+ "typecheck": "tsc --noEmit",
56
+ "test": "vitest run"
57
+ }
6
58
  }