@statsmcp/eurostat 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 +68 -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-kcHxZCr-.mjs +64 -0
- package/package.json +56 -3
- package/snapshots/de.json.gz +0 -0
- package/snapshots/en.json.gz +0 -0
- package/snapshots/fr.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,69 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @statsmcp/eurostat
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An MCP server for the [Eurostat database](https://ec.europa.eu/eurostat/data/database): harmonised statistics for the EU, EFTA and candidate countries, in English, German and French. Use it to compare countries.
|
|
4
|
+
|
|
5
|
+
> This project is not affiliated with or endorsed by Eurostat or the European Commission.
|
|
6
|
+
|
|
7
|
+
## Use the server
|
|
8
|
+
|
|
9
|
+
### Hosted
|
|
10
|
+
|
|
11
|
+
Add `https://statsmcp.dev/eu/mcp` as a remote MCP server. It uses Streamable HTTP and needs no authentication. For the steps for each client, refer to [statsmcp.dev/eurostat](https://statsmcp.dev/eurostat/).
|
|
12
|
+
|
|
13
|
+
### Local
|
|
14
|
+
|
|
15
|
+
You need Node.js 20 or later.
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"eurostat": { "command": "npx", "args": ["-y", "@statsmcp/eurostat"] }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For Claude Code:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
claude mcp add eurostat -- npx -y @statsmcp/eurostat
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The server searches the full table list of the office. If the office API cannot give this list, the server uses a copy of the 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. Returns table IDs, titles and publication 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`, `de` or `fr`). Countries are values of the `geo` variable. The server loads the Eurostat table of contents and searches the titles itself. Discontinued datasets are marked "archived".
|
|
42
|
+
|
|
43
|
+
## Use it in your own server
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm install @statsmcp/eurostat
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
|
|
51
|
+
import { createEurostatServer } from '@statsmcp/eurostat';
|
|
52
|
+
|
|
53
|
+
const server = createEurostatServer({ userAgent: 'my-app/1.0' });
|
|
54
|
+
await server.connect(new StdioServerTransport());
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`createEurostatServer` returns an `McpServer`. It also accepts a `cache`. To make one, install `@statsmcp/core` and use `createMemoryCache`, or implement the `Cache` interface.
|
|
58
|
+
|
|
59
|
+
## Data licence and attribution
|
|
60
|
+
|
|
61
|
+
Eurostat allows reuse of its data for commercial and non-commercial purposes if you acknowledge the source. Refer to the [Eurostat copyright notice](https://ec.europa.eu/eurostat/help/copyright-notice).
|
|
62
|
+
|
|
63
|
+
Data for countries outside the EU, EFTA and candidate countries (for example the USA, Japan or China) may only be reused for non-commercial purposes. Some trade data has the same limit.
|
|
64
|
+
|
|
65
|
+
Each result contains the source line and a link to the dataset in the Eurostat data browser. If you change the data or calculate new figures, say so and say that Eurostat is not responsible for the change.
|
|
66
|
+
|
|
67
|
+
## Licence
|
|
68
|
+
|
|
69
|
+
The code is under the MIT licence. The data belongs to Eurostat and the national statistics offices that supply it.
|
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 eurostatPreset, t as createEurostatServer } from "./src-kcHxZCr-.mjs";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
4
|
+
import { nodeTableSnapshots } from "@statsmcp/core/node";
|
|
5
|
+
// src/bin.ts
|
|
6
|
+
await createEurostatServer({ tableSnapshots: nodeTableSnapshots(new URL("../snapshots/", import.meta.url), { userAgent: `${eurostatPreset.name}-mcp/${eurostatPreset.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 eurostatPreset: PxwebPreset;
|
|
4
|
+
export type EurostatServerOptions = Pick<PresetServerOptions, 'cache' | 'userAgent' | 'tableSnapshots'>;
|
|
5
|
+
export declare function createEurostatServer(options?: EurostatServerOptions): McpServer;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as createEurostatServer, n as eurostatPreset } from "./src-kcHxZCr-.mjs";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createPresetServer } from "@statsmcp/core";
|
|
2
|
+
// src/preset.ts
|
|
3
|
+
const TERMS = "https://ec.europa.eu/eurostat/help/copyright-notice";
|
|
4
|
+
const ATTRIBUTION = {
|
|
5
|
+
de: `Quelle: Eurostat (${TERMS})`,
|
|
6
|
+
fr: `Source : Eurostat (${TERMS})`,
|
|
7
|
+
en: `Source: Eurostat (${TERMS})`
|
|
8
|
+
};
|
|
9
|
+
const eurostatPreset = {
|
|
10
|
+
name: "eurostat",
|
|
11
|
+
title: "Eurostat (harmonised official statistics for EU and EFTA countries)",
|
|
12
|
+
version: "0.3.0",
|
|
13
|
+
apiBaseUrl: "https://ec.europa.eu/eurostat/api/dissemination",
|
|
14
|
+
api: "eurostat",
|
|
15
|
+
languages: [
|
|
16
|
+
"en",
|
|
17
|
+
"de",
|
|
18
|
+
"fr"
|
|
19
|
+
],
|
|
20
|
+
attribution: (lang) => {
|
|
21
|
+
if (lang === "de") return ATTRIBUTION.de;
|
|
22
|
+
if (lang === "fr") return ATTRIBUTION.fr;
|
|
23
|
+
return ATTRIBUTION.en;
|
|
24
|
+
},
|
|
25
|
+
tableUrl: (lang, tableId) => `https://ec.europa.eu/eurostat/databrowser/view/${tableId}/default/table?lang=${lang}`,
|
|
26
|
+
instructions: `Harmonised official statistics for the EU, EFTA and candidate countries from Eurostat. Use it to compare countries. For the most detailed national data, a national statistics server may have more. This server is not affiliated with or endorsed by Eurostat or the European Commission.
|
|
27
|
+
|
|
28
|
+
To answer a question with data:
|
|
29
|
+
1. Call \`search_tables\` with short topic keywords in English ("en"), German ("de") or French ("fr"). Dataset codes look like prc_hicp_minr. Results marked "archived" are discontinued datasets; prefer current ones.
|
|
30
|
+
2. Call \`get_table_metadata\` on the best dataset. Countries are values of the "geo" variable (for example SI, DE, EU27_2020); use \`valueFilter\` to find a country or region by name. Select one value of "unit" and "freq" when the dataset has several.
|
|
31
|
+
3. Call \`query_table\` with only the values you need. Use \`latest\` on "time" for recent periods.
|
|
32
|
+
|
|
33
|
+
Always cite the source line that each result ends with. Data for countries outside the EU, EFTA and candidate countries may only be reused for non-commercial purposes.`,
|
|
34
|
+
maxCells: 5e3,
|
|
35
|
+
searchLimit: 10,
|
|
36
|
+
searchAliases: { en: [
|
|
37
|
+
{
|
|
38
|
+
terms: [
|
|
39
|
+
"salary",
|
|
40
|
+
"salaries",
|
|
41
|
+
"wage"
|
|
42
|
+
],
|
|
43
|
+
query: "earnings"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
terms: ["population"],
|
|
47
|
+
query: "population on 1 January"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
terms: [
|
|
51
|
+
"housing price",
|
|
52
|
+
"house price",
|
|
53
|
+
"home price",
|
|
54
|
+
"property price"
|
|
55
|
+
],
|
|
56
|
+
query: "house price index"
|
|
57
|
+
}
|
|
58
|
+
] }
|
|
59
|
+
};
|
|
60
|
+
// src/index.ts
|
|
61
|
+
function createEurostatServer(options = {}) {
|
|
62
|
+
return createPresetServer(eurostatPreset, options);
|
|
63
|
+
}
|
|
64
|
+
export { eurostatPreset as n, createEurostatServer as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsmcp/eurostat",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "MCP server for the Eurostat database (harmonised statistics for EU and EFTA countries)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Tadej Polajnar",
|
|
7
|
+
"homepage": "https://statsmcp.dev/eurostat/",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Stats-MCP/statsmcp.git",
|
|
11
|
+
"directory": "packages/eurostat"
|
|
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
|
+
"eurostat",
|
|
23
|
+
"european-union",
|
|
24
|
+
"eu",
|
|
25
|
+
"statistics",
|
|
26
|
+
"pxweb"
|
|
27
|
+
],
|
|
28
|
+
"bin": {
|
|
29
|
+
"statsmcp-eurostat": "./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
|
|
Binary file
|