@statsmcp/statice 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 +21 -0
- package/README.md +70 -2
- package/dist/bin.d.mts +1 -0
- package/dist/bin.mjs +7 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +1 -0
- package/dist/src-DudOnWsW.mjs +84 -0
- package/package.json +56 -3
- package/snapshots/en.json.gz +0 -0
- package/snapshots/is.json.gz +0 -0
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,71 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @statsmcp/statice
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An MCP server for the [PX-Web database of Statistics Iceland](https://px.hagstofa.is/pxen/pxweb/en/) (Hagstofa Íslands). It gives AI assistants access to its tables.
|
|
4
|
+
|
|
5
|
+
> This project is not affiliated with or endorsed by Statistics Iceland.
|
|
6
|
+
|
|
7
|
+
## Use the server
|
|
8
|
+
|
|
9
|
+
### Hosted
|
|
10
|
+
|
|
11
|
+
Add `https://statsmcp.dev/is/mcp` as a remote MCP server. It uses Streamable HTTP and needs no authentication. For the steps for each client, refer to [statsmcp.dev/iceland](https://statsmcp.dev/iceland/).
|
|
12
|
+
|
|
13
|
+
### Local
|
|
14
|
+
|
|
15
|
+
You need Node.js 20 or later.
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"statice": { "command": "npx", "args": ["-y", "@statsmcp/statice"] }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For Claude Code:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
claude mcp add statice -- npx -y @statsmcp/statice
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The API of the office has no list of all tables. The server searches a copy of the table list from https://statsmcp.dev, or the copy in the package. To stop all requests to statsmcp.dev, set the environment variable `STATSMCP_INDEX=off`.
|
|
32
|
+
|
|
33
|
+
## Tools
|
|
34
|
+
|
|
35
|
+
| Tool | What it does |
|
|
36
|
+
| -------------------- | ------------------------------------------------------------------------------------------------- |
|
|
37
|
+
| `search_tables` | Finds tables by keywords in their titles and folders. Returns table IDs, titles and update dates. |
|
|
38
|
+
| `get_table_metadata` | Lists the variables of a table and their value codes. Use `valueFilter` to find a value by name. |
|
|
39
|
+
| `query_table` | Returns data as CSV with readable labels. Use `latest` for recent periods. |
|
|
40
|
+
|
|
41
|
+
All tools are read-only. Each tool accepts `lang` (`en` or `is`). The English and Icelandic table lists are not the same. Use a table id in the language that search_tables returned it in.
|
|
42
|
+
|
|
43
|
+
## Use it in your own server
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm install @statsmcp/statice
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
|
|
51
|
+
import { nodeTableSnapshots } from '@statsmcp/core/node';
|
|
52
|
+
import { createStaticeServer } from '@statsmcp/statice';
|
|
53
|
+
|
|
54
|
+
const server = createStaticeServer({
|
|
55
|
+
userAgent: 'my-app/1.0',
|
|
56
|
+
tableSnapshots: nodeTableSnapshots(new URL('./snapshots/', import.meta.url))
|
|
57
|
+
});
|
|
58
|
+
await server.connect(new StdioServerTransport());
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`createStaticeServer` returns an `McpServer`. Search needs `tableSnapshots`. It also accepts a `cache`.
|
|
62
|
+
|
|
63
|
+
## Data licence and attribution
|
|
64
|
+
|
|
65
|
+
Statistics Iceland publishes its data under the [Creative Commons Attribution 4.0 licence (CC BY 4.0)](https://statice.is/publications/open-data-access). You can use it for any purpose, including commercial use, if you name Statistics Iceland as the source.
|
|
66
|
+
|
|
67
|
+
Each result contains the source line and a link to the table. If you change the data or calculate new figures, say so, for example: `Statistics Iceland and own calculations`. Do not suggest that Statistics Iceland endorses your product.
|
|
68
|
+
|
|
69
|
+
## Licence
|
|
70
|
+
|
|
71
|
+
The code is under the MIT licence. The data belongs to Statistics Iceland.
|
package/dist/bin.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/bin.mjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { n as staticePreset, t as createStaticeServer } from "./src-DudOnWsW.mjs";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
4
|
+
import { nodeTableSnapshots } from "@statsmcp/core/node";
|
|
5
|
+
// src/bin.ts
|
|
6
|
+
await createStaticeServer({ tableSnapshots: nodeTableSnapshots(new URL("../snapshots/", import.meta.url), { userAgent: `${staticePreset.name}-mcp/${staticePreset.version}` }) }).connect(new StdioServerTransport());
|
|
7
|
+
export {};
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PresetServerOptions, PxwebPreset } from "@statsmcp/core";
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/server";
|
|
3
|
+
export declare const staticePreset: PxwebPreset;
|
|
4
|
+
export type StaticeServerOptions = Pick<PresetServerOptions, 'cache' | 'userAgent' | 'tableSnapshots'>;
|
|
5
|
+
export declare function createStaticeServer(options?: StaticeServerOptions): McpServer;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as createStaticeServer, n as staticePreset } from "./src-DudOnWsW.mjs";
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { createPresetServer } from "@statsmcp/core";
|
|
2
|
+
// src/preset.ts
|
|
3
|
+
const TERMS = "https://statice.is/publications/open-data-access";
|
|
4
|
+
const ATTRIBUTION = {
|
|
5
|
+
is: `Heimild: Hagstofa Íslands, CC BY 4.0 (${TERMS})`,
|
|
6
|
+
en: `Source: Statistics Iceland, CC BY 4.0 (${TERMS})`
|
|
7
|
+
};
|
|
8
|
+
const staticePreset = {
|
|
9
|
+
name: "statice",
|
|
10
|
+
title: "PX-Web database of Statistics Iceland (official statistics)",
|
|
11
|
+
version: "0.3.0",
|
|
12
|
+
apiBaseUrl: {
|
|
13
|
+
en: "https://px.hagstofa.is/pxen/api/v1",
|
|
14
|
+
is: "https://px.hagstofa.is/pxis/api/v1"
|
|
15
|
+
},
|
|
16
|
+
database: [
|
|
17
|
+
"Atvinnuvegir",
|
|
18
|
+
"Efnahagur",
|
|
19
|
+
"Ibuar",
|
|
20
|
+
"Samfelag",
|
|
21
|
+
"Umhverfi"
|
|
22
|
+
],
|
|
23
|
+
search: "index",
|
|
24
|
+
languages: ["en", "is"],
|
|
25
|
+
attribution: (lang) => lang === "is" ? ATTRIBUTION.is : ATTRIBUTION.en,
|
|
26
|
+
tableUrl: (lang, tableId) => {
|
|
27
|
+
const pageLang = lang === "is" ? "is" : "en";
|
|
28
|
+
const segments = tableId.split("/").map(encodeURIComponent);
|
|
29
|
+
const file = segments.pop() ?? tableId;
|
|
30
|
+
return `https://px.hagstofa.is/px${pageLang}/pxweb/${pageLang}/${segments[0]}/${segments.join("__")}/${file}/`;
|
|
31
|
+
},
|
|
32
|
+
instructions: `Official statistics for Iceland from the PX-Web database of Statistics Iceland (Hagstofa Íslands). This server is not affiliated with or endorsed by Statistics Iceland.
|
|
33
|
+
|
|
34
|
+
To answer a question with data:
|
|
35
|
+
1. Call \`search_tables\` with short topic keywords in English ("en") or Icelandic ("is"). The English and Icelandic table lists are not the same, so use a table id only in the language that returned it. You can also search for a table number such as MAN00101 if no other table has the same number.
|
|
36
|
+
2. Call \`get_table_metadata\` on the best table to see its variables and value codes. Use \`valueFilter\` to find a municipality or industry by name.
|
|
37
|
+
3. Call \`query_table\` with only the values you need. Use \`latest\` for recent periods.
|
|
38
|
+
|
|
39
|
+
Always cite the source line that each result ends with. If you change the data or calculate new figures, say so, for example "Statistics Iceland and own calculations".`,
|
|
40
|
+
maxCells: 5e3,
|
|
41
|
+
searchLimit: 10,
|
|
42
|
+
searchAliases: {
|
|
43
|
+
en: [
|
|
44
|
+
{
|
|
45
|
+
terms: ["inflation", "consumer prices"],
|
|
46
|
+
query: "consumer price index"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
terms: [
|
|
50
|
+
"salary",
|
|
51
|
+
"salaries",
|
|
52
|
+
"wage",
|
|
53
|
+
"wages"
|
|
54
|
+
],
|
|
55
|
+
query: "wage index"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
terms: [
|
|
59
|
+
"housing price",
|
|
60
|
+
"house price",
|
|
61
|
+
"home price",
|
|
62
|
+
"property price"
|
|
63
|
+
],
|
|
64
|
+
query: "residential property market price index"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
terms: ["unemployment", "jobless"],
|
|
68
|
+
query: "employment unemployment and labour force monthly"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
is: [{
|
|
72
|
+
terms: ["verðbólga", "verðlag"],
|
|
73
|
+
query: "vísitala neysluverðs"
|
|
74
|
+
}, {
|
|
75
|
+
terms: ["laun"],
|
|
76
|
+
query: "launavísitala"
|
|
77
|
+
}]
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
// src/index.ts
|
|
81
|
+
function createStaticeServer(options = {}) {
|
|
82
|
+
return createPresetServer(staticePreset, options);
|
|
83
|
+
}
|
|
84
|
+
export { staticePreset as n, createStaticeServer as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsmcp/statice",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "MCP server for the PX-Web database of Statistics Iceland (Hagstofa Íslands)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Tadej Polajnar",
|
|
7
|
+
"homepage": "https://statsmcp.dev/iceland/",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Stats-MCP/statsmcp.git",
|
|
11
|
+
"directory": "packages/statice"
|
|
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
|
+
"statice",
|
|
23
|
+
"hagstofa",
|
|
24
|
+
"iceland",
|
|
25
|
+
"statistics",
|
|
26
|
+
"pxweb"
|
|
27
|
+
],
|
|
28
|
+
"bin": {
|
|
29
|
+
"statice-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
|
+
"snapshots"
|
|
40
|
+
],
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@modelcontextprotocol/server": "^2.4.0",
|
|
46
|
+
"@statsmcp/core": "0.3.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "26.6.5",
|
|
50
|
+
"tsdown": "0.23.2",
|
|
51
|
+
"typescript": "7.0.2",
|
|
52
|
+
"vitest": "5.0.5"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "tsdown",
|
|
56
|
+
"typecheck": "tsc --noEmit",
|
|
57
|
+
"test": "vitest run"
|
|
58
|
+
}
|
|
6
59
|
}
|
|
Binary file
|
|
Binary file
|