@statsmcp/hagstova 0.0.0-stage → 0.4.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/hagstova
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 the [StatBank of Statistics Faroe Islands](https://statbank.hagstova.fo/pxweb/en/H2/) (Hagstova Føroya). It gives AI assistants access to its tables in Faroese and English.
4
+
5
+ > This project is not affiliated with or endorsed by Statistics Faroe Islands.
6
+
7
+ ## Use the server
8
+
9
+ ### Hosted
10
+
11
+ Add `https://statsmcp.dev/fo/mcp` as a remote MCP server. It uses Streamable HTTP and needs no authentication. For the steps for each client, refer to [statsmcp.dev/faroe-islands](https://statsmcp.dev/faroe-islands/).
12
+
13
+ ### Local
14
+
15
+ You need Node.js 20 or later.
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "hagstova": { "command": "npx", "args": ["-y", "@statsmcp/hagstova"] }
21
+ }
22
+ }
23
+ ```
24
+
25
+ For Claude Code:
26
+
27
+ ```sh
28
+ claude mcp add hagstova -- npx -y @statsmcp/hagstova
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. Discontinued tables are marked "archived". |
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` (`fo` or `en`). English search is the most reliable. Faroese search matches whole words only.
40
+
41
+ ## Use it in your own server
42
+
43
+ ```sh
44
+ npm install @statsmcp/hagstova
45
+ ```
46
+
47
+ ```ts
48
+ import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
49
+ import { createHagstovaServer } from '@statsmcp/hagstova';
50
+
51
+ const server = createHagstovaServer({ userAgent: 'my-app/1.0' });
52
+ await server.connect(new StdioServerTransport());
53
+ ```
54
+
55
+ `createHagstovaServer` 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 Faroe Islands publishes its data under the [Creative Commons Attribution 4.0 licence (CC BY 4.0)](https://hagstova.fo/en/terms-use). You can use it for any purpose, including commercial use, if you name Statistics Faroe Islands as the source.
60
+
61
+ Each result contains the source line and a link to the table on the StatBank. If you change the data or calculate new figures, say so, for example: `Statistics Faroe Islands and own calculations`. Do not suggest that Statistics Faroe Islands endorses your product.
62
+
63
+ ## Licence
64
+
65
+ The code is under the MIT licence. The data belongs to Statistics Faroe Islands.
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 createHagstovaServer } from "./src-D8hZ-3bv.mjs";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
4
+ // src/bin.ts
5
+ await createHagstovaServer().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 hagstovaPreset: PxwebPreset;
4
+ export type HagstovaServerOptions = Pick<PresetServerOptions, 'cache' | 'userAgent'>;
5
+ export declare function createHagstovaServer(options?: HagstovaServerOptions): McpServer;
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export { t as createHagstovaServer, n as hagstovaPreset } from "./src-D8hZ-3bv.mjs";
@@ -0,0 +1,56 @@
1
+ import { createPresetServer } from "@statsmcp/core";
2
+ // src/preset.ts
3
+ const ATTRIBUTION = {
4
+ fo: "Kelda: Hagstova Føroya, CC BY 4.0 (https://hagstova.fo/en/terms-use)",
5
+ en: "Source: Statistics Faroe Islands, CC BY 4.0 (https://hagstova.fo/en/terms-use)"
6
+ };
7
+ const DISCONTINUED = /\s-\s*(?:discontinued|endað)\s*$/i;
8
+ const hagstovaPreset = {
9
+ name: "hagstova",
10
+ title: "StatBank of Statistics Faroe Islands (official statistics)",
11
+ version: "0.4.0",
12
+ apiBaseUrl: "https://statbank.hagstova.fo/api/v1",
13
+ database: "H2",
14
+ languages: ["fo", "en"],
15
+ attribution: (lang) => lang === "fo" ? ATTRIBUTION.fo : ATTRIBUTION.en,
16
+ tableUrl: (lang, tableId) => {
17
+ const pageLang = lang === "fo" ? "fo" : "en";
18
+ const segments = tableId.split("/");
19
+ const file = segments.pop() ?? tableId;
20
+ return `https://statbank.hagstova.fo/pxweb/${pageLang}/H2/${["H2", ...segments].join("__")}/${file}/`;
21
+ },
22
+ isArchived: (hit) => DISCONTINUED.test(hit.title),
23
+ instructions: `Official statistics for the Faroe Islands from the StatBank of Statistics Faroe Islands (Hagstova Føroya). This server is not affiliated with or endorsed by Statistics Faroe Islands.
24
+
25
+ To answer a question with data:
26
+ 1. Call \`search_tables\` with short topic keywords. English ("en") search is the most reliable; Faroese ("fo") search matches whole words only. Results marked "archived" are discontinued tables; prefer current tables.
27
+ 2. Call \`get_table_metadata\` on the best table to see its variables and value codes. Use \`valueFilter\` to find a municipality or island by name.
28
+ 3. Call \`query_table\` with only the values you need. Use \`latest\` for recent periods.
29
+
30
+ Always cite the source line that each result ends with. If you change the data or calculate new figures, say so, for example "Statistics Faroe Islands and own calculations".`,
31
+ maxCells: 5e3,
32
+ searchLimit: 10,
33
+ searchAliases: {
34
+ en: [{
35
+ terms: [
36
+ "housing price",
37
+ "home price",
38
+ "property price"
39
+ ],
40
+ query: "house prices"
41
+ }],
42
+ fo: [{
43
+ terms: [
44
+ "inflatión",
45
+ "prísvøkstur",
46
+ "prísir"
47
+ ],
48
+ query: "brúkaraprístalið"
49
+ }]
50
+ }
51
+ };
52
+ // src/index.ts
53
+ function createHagstovaServer(options = {}) {
54
+ return createPresetServer(hagstovaPreset, options);
55
+ }
56
+ export { hagstovaPreset as n, createHagstovaServer as t };
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "@statsmcp/hagstova",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.4.0",
4
+ "description": "MCP server for the StatBank of Statistics Faroe Islands (Hagstova Føroya)",
5
+ "license": "MIT",
6
+ "author": "Tadej Polajnar",
7
+ "homepage": "https://statsmcp.dev/faroe-islands/",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Stats-MCP/statsmcp.git",
11
+ "directory": "packages/hagstova"
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
+ "hagstova",
23
+ "faroe-islands",
24
+ "statbank",
25
+ "statistics",
26
+ "pxweb"
27
+ ],
28
+ "bin": {
29
+ "hagstova-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.4.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
  }