@statsmcp/stat-ee 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 +64 -2
- package/dist/bin.d.mts +1 -0
- package/dist/bin.mjs +6 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +1 -0
- package/dist/src-DdQBXnT1.mjs +79 -0
- package/package.json +55 -3
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
|
-
#
|
|
1
|
+
# @statsmcp/stat-ee
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An MCP server for the [database of Statistics Estonia](https://andmed.stat.ee/en/stat) (Statistikaamet). It gives AI assistants access to its tables in Estonian and English.
|
|
4
|
+
|
|
5
|
+
> This project is not affiliated with or endorsed by Statistics Estonia.
|
|
6
|
+
|
|
7
|
+
## Use the server
|
|
8
|
+
|
|
9
|
+
### Hosted
|
|
10
|
+
|
|
11
|
+
Add `https://statsmcp.dev/ee/mcp` as a remote MCP server. It uses Streamable HTTP and needs no authentication. For the steps for each client, refer to [statsmcp.dev/estonia](https://statsmcp.dev/estonia/).
|
|
12
|
+
|
|
13
|
+
### Local
|
|
14
|
+
|
|
15
|
+
You need Node.js 20 or later.
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"stat-ee": { "command": "npx", "args": ["-y", "@statsmcp/stat-ee"] }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For Claude Code:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
claude mcp add stat-ee -- npx -y @statsmcp/stat-ee
|
|
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. Archived tables are marked. |
|
|
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` (`et` or `en`).
|
|
40
|
+
|
|
41
|
+
## Use it in your own server
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
npm install @statsmcp/stat-ee
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
|
|
49
|
+
import { createStatEeServer } from '@statsmcp/stat-ee';
|
|
50
|
+
|
|
51
|
+
const server = createStatEeServer({ userAgent: 'my-app/1.0' });
|
|
52
|
+
await server.connect(new StdioServerTransport());
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`createStatEeServer` 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 Estonia shares its open data under the [Creative Commons Attribution-ShareAlike 4.0 licence (CC BY-SA 4.0)](https://creativecommons.org/licenses/by-sa/4.0/). You can use it for any purpose, including commercial use, if you name Statistics Estonia as the source. If you change the data or make new data from it, you must share the result under the same licence.
|
|
60
|
+
|
|
61
|
+
Each result contains the source line with the licence link, and a link to the table on andmed.stat.ee. If you change the data or calculate new figures, say so, for example: `Source: Statistics Estonia / Calculated by <you>, CC BY-SA 4.0`.
|
|
62
|
+
|
|
63
|
+
## Licence
|
|
64
|
+
|
|
65
|
+
The code is under the MIT licence. The data belongs to Statistics Estonia.
|
package/dist/bin.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/bin.mjs
ADDED
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 statEePreset: PxwebPreset;
|
|
4
|
+
export type StatEeServerOptions = Pick<PresetServerOptions, 'cache' | 'userAgent'>;
|
|
5
|
+
export declare function createStatEeServer(options?: StatEeServerOptions): McpServer;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as createStatEeServer, n as statEePreset } from "./src-DdQBXnT1.mjs";
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { createPresetServer } from "@statsmcp/core";
|
|
2
|
+
// src/preset.ts
|
|
3
|
+
const LICENCE_URL = "https://creativecommons.org/licenses/by-sa/4.0/";
|
|
4
|
+
const ATTRIBUTION = {
|
|
5
|
+
et: `Allikas: Statistikaamet, CC BY-SA 4.0 (${LICENCE_URL})`,
|
|
6
|
+
en: `Source: Statistics Estonia, CC BY-SA 4.0 (${LICENCE_URL})`
|
|
7
|
+
};
|
|
8
|
+
const statEePreset = {
|
|
9
|
+
name: "stat-ee",
|
|
10
|
+
title: "Statistics Estonia database (official statistics of Estonia)",
|
|
11
|
+
version: "0.3.0",
|
|
12
|
+
apiBaseUrl: "https://andmed.stat.ee/api/v1",
|
|
13
|
+
database: "stat",
|
|
14
|
+
languages: ["et", "en"],
|
|
15
|
+
attribution: (lang) => lang === "et" ? ATTRIBUTION.et : ATTRIBUTION.en,
|
|
16
|
+
tableUrl: (lang, tableId) => {
|
|
17
|
+
return `https://andmed.stat.ee/${lang === "et" ? "et" : "en"}/stat/${tableId.replace(/\.px$/i, "")}`;
|
|
18
|
+
},
|
|
19
|
+
tableIdFromHit: (hit) => hit.id,
|
|
20
|
+
isArchived: (hit) => hit.path?.startsWith("/Lepetatud_tabelid/") ?? false,
|
|
21
|
+
instructions: `Official statistics for Estonia from the database of Statistics Estonia (Statistikaamet). This server is not affiliated with or endorsed by Statistics Estonia.
|
|
22
|
+
|
|
23
|
+
To answer a question with data:
|
|
24
|
+
1. Call \`search_tables\` with short topic keywords in Estonian ("et") or English ("en"). Results marked "archived" are closed tables. Prefer current tables, but archived tables can still be queried for older periods.
|
|
25
|
+
2. Call \`get_table_metadata\` on the best table to see its variables and value codes. Use \`valueFilter\` to find a county, municipality or activity by name.
|
|
26
|
+
3. Call \`query_table\` with only the values you need. Many monthly and quarterly tables keep the year and the month or quarter in two variables; select both, for example the latest year and its months.
|
|
27
|
+
|
|
28
|
+
Always cite the source line that each result ends with. The data is under CC BY-SA 4.0: if you change the data or calculate new figures, say so and share them under the same licence.`,
|
|
29
|
+
maxCells: 5e3,
|
|
30
|
+
searchLimit: 10,
|
|
31
|
+
searchAliases: {
|
|
32
|
+
en: [
|
|
33
|
+
{
|
|
34
|
+
terms: [
|
|
35
|
+
"salary",
|
|
36
|
+
"salaries",
|
|
37
|
+
"wage"
|
|
38
|
+
],
|
|
39
|
+
query: "average monthly gross wages"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
terms: ["inflation"],
|
|
43
|
+
query: "consumer price index"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
terms: [
|
|
47
|
+
"housing price",
|
|
48
|
+
"house price",
|
|
49
|
+
"home price",
|
|
50
|
+
"property price"
|
|
51
|
+
],
|
|
52
|
+
query: "dwelling price index"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
et: [
|
|
56
|
+
{
|
|
57
|
+
terms: ["inflatsioon", "hinnatõus"],
|
|
58
|
+
query: "tarbijahinnaindeks"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
terms: ["keskmine palk", "palgad"],
|
|
62
|
+
query: "keskmine brutokuupalk"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
terms: [
|
|
66
|
+
"eluaseme hind",
|
|
67
|
+
"korteri hind",
|
|
68
|
+
"kinnisvara hind"
|
|
69
|
+
],
|
|
70
|
+
query: "eluaseme hinnaindeks"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
// src/index.ts
|
|
76
|
+
function createStatEeServer(options = {}) {
|
|
77
|
+
return createPresetServer(statEePreset, options);
|
|
78
|
+
}
|
|
79
|
+
export { statEePreset as n, createStatEeServer as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsmcp/stat-ee",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "MCP server for the database of Statistics Estonia (Statistikaamet)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Tadej Polajnar",
|
|
7
|
+
"homepage": "https://statsmcp.dev/estonia/",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Stats-MCP/statsmcp.git",
|
|
11
|
+
"directory": "packages/stat-ee"
|
|
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
|
+
"statistics-estonia",
|
|
23
|
+
"statistikaamet",
|
|
24
|
+
"estonia",
|
|
25
|
+
"statistics",
|
|
26
|
+
"pxweb"
|
|
27
|
+
],
|
|
28
|
+
"bin": {
|
|
29
|
+
"stat-ee-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
|
}
|