@pipeworx/mcp-eurostat 0.1.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 Pipeworx
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 ADDED
@@ -0,0 +1,55 @@
1
+ # mcp-eurostat
2
+
3
+ Eurostat MCP — wraps Eurostat Statistical Data API (no auth required)
4
+
5
+ Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 965+ live data sources.
6
+
7
+ ## Tools
8
+
9
+ | Tool | Description |
10
+ |------|-------------|
11
+
12
+ ## Quick Start
13
+
14
+ Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
15
+
16
+ ```json
17
+ {
18
+ "mcpServers": {
19
+ "eurostat": {
20
+ "url": "https://gateway.pipeworx.io/eurostat/mcp"
21
+ }
22
+ }
23
+ }
24
+ ```
25
+
26
+ Or connect to the full Pipeworx gateway for access to all 965+ data sources:
27
+
28
+ ```json
29
+ {
30
+ "mcpServers": {
31
+ "pipeworx": {
32
+ "url": "https://gateway.pipeworx.io/mcp"
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ ## Using with ask_pipeworx
39
+
40
+ Instead of calling tools directly, you can ask questions in plain English:
41
+
42
+ ```
43
+ ask_pipeworx({ question: "your question about Eurostat data" })
44
+ ```
45
+
46
+ The gateway picks the right tool and fills the arguments automatically.
47
+
48
+ ## More
49
+
50
+ - [All tools and guides](https://github.com/pipeworx-io/examples)
51
+ - [pipeworx.io](https://pipeworx.io)
52
+
53
+ ## License
54
+
55
+ MIT
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@pipeworx/mcp-eurostat",
3
+ "version": "0.1.0",
4
+ "description": "Eurostat MCP — wraps Eurostat Statistical Data API (no auth required)",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "types": "src/index.ts",
8
+ "keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "eurostat"],
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/pipeworx-io/mcp-eurostat"
13
+ },
14
+ "scripts": {
15
+ "typecheck": "tsc --noEmit"
16
+ },
17
+ "devDependencies": {
18
+ "typescript": "^5.7.0"
19
+ }
20
+ }
package/server.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.pipeworx-io/eurostat",
4
+ "title": "Eurostat",
5
+ "description": "Eurostat MCP — wraps Eurostat Statistical Data API (no auth required)",
6
+ "version": "0.1.0",
7
+ "websiteUrl": "https://pipeworx.io/packs/eurostat",
8
+ "repository": {
9
+ "url": "https://github.com/pipeworx-io/mcp-eurostat",
10
+ "source": "github"
11
+ },
12
+ "remotes": [
13
+ {
14
+ "type": "streamable-http",
15
+ "url": "https://gateway.pipeworx.io/eurostat/mcp"
16
+ }
17
+ ]
18
+ }
package/src/index.ts ADDED
@@ -0,0 +1,186 @@
1
+ interface McpToolDefinition {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: 'object';
6
+ properties: Record<string, unknown>;
7
+ required?: string[];
8
+ };
9
+ }
10
+
11
+ interface McpToolExport {
12
+ tools: McpToolDefinition[];
13
+ callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
14
+ meter?: { credits: number };
15
+ cost?: Record<string, unknown>;
16
+ provider?: string;
17
+ }
18
+
19
+ /**
20
+ * Eurostat MCP — wraps Eurostat Statistical Data API (no auth required)
21
+ *
22
+ * Tools:
23
+ * - get_dataset: fetch data from a specific Eurostat dataset
24
+ * - search_datasets: search for datasets by keyword
25
+ * - list_datasets: list available dataset categories
26
+ */
27
+
28
+
29
+ const DATA_URL = 'https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data';
30
+ const TOC_URL = 'https://ec.europa.eu/eurostat/api/dissemination/catalogue/toc';
31
+
32
+ const tools: McpToolExport['tools'] = [
33
+ {
34
+ name: 'get_dataset',
35
+ description:
36
+ 'Fetch statistical data from a Eurostat dataset by dataset code. Optionally filter by country (geo) and time period. Example: get_dataset({ dataset_code: "nama_10_gdp", geo: "DE", time: "2023" }). Common dataset codes: "nama_10_gdp" (GDP), "prc_hicp_manr" (inflation), "une_rt_m" (unemployment).',
37
+ inputSchema: {
38
+ type: 'object',
39
+ properties: {
40
+ dataset_code: {
41
+ type: 'string',
42
+ description: 'Eurostat dataset code, e.g. "nama_10_gdp", "prc_hicp_manr", "une_rt_m"',
43
+ },
44
+ geo: {
45
+ type: 'string',
46
+ description: 'Country/region code filter, e.g. "DE" (Germany), "FR" (France), "EU27_2020" (EU aggregate)',
47
+ },
48
+ time: {
49
+ type: 'string',
50
+ description: 'Time period filter, e.g. "2023", "2023M01" (Jan 2023), "2023Q1" (Q1 2023)',
51
+ },
52
+ },
53
+ required: ['dataset_code'],
54
+ },
55
+ },
56
+ {
57
+ name: 'search_datasets',
58
+ description:
59
+ 'Search for Eurostat datasets by keyword. Returns dataset codes, titles, and update dates. Example: search_datasets({ query: "unemployment rate" })',
60
+ inputSchema: {
61
+ type: 'object',
62
+ properties: {
63
+ query: {
64
+ type: 'string',
65
+ description: 'Search keyword, e.g. "gdp", "unemployment", "inflation", "population"',
66
+ },
67
+ },
68
+ required: ['query'],
69
+ },
70
+ },
71
+ {
72
+ name: 'list_datasets',
73
+ description:
74
+ 'Return a curated list of ~14 popular Eurostat dataset codes grouped by theme (Economy, Prices, Labour, Population, Migration, Trade, Energy, Environment, Tourism). No parameters required; use the returned codes with get_dataset.',
75
+ inputSchema: {
76
+ type: 'object',
77
+ properties: {},
78
+ required: [],
79
+ },
80
+ },
81
+ ];
82
+
83
+ async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
84
+ switch (name) {
85
+ case 'get_dataset':
86
+ return getDataset(
87
+ args.dataset_code as string,
88
+ args.geo as string | undefined,
89
+ args.time as string | undefined,
90
+ );
91
+ case 'search_datasets':
92
+ return searchDatasets(args.query as string);
93
+ case 'list_datasets':
94
+ return listDatasets();
95
+ default:
96
+ throw new Error(`Unknown tool: ${name}`);
97
+ }
98
+ }
99
+
100
+ async function getDataset(datasetCode: string, geo?: string, time?: string) {
101
+ const params = new URLSearchParams({ format: 'JSON', lang: 'en' });
102
+ if (geo) params.set('geo', geo);
103
+ if (time) params.set('time', time);
104
+
105
+ const res = await fetch(`${DATA_URL}/${encodeURIComponent(datasetCode)}?${params}`);
106
+ if (!res.ok) throw new Error(`Eurostat error: ${res.status}`);
107
+
108
+ const data = (await res.json()) as {
109
+ label: string;
110
+ updated: string;
111
+ id: string[];
112
+ size: number[];
113
+ dimension: Record<string, {
114
+ label: string;
115
+ category: {
116
+ index: Record<string, number>;
117
+ label: Record<string, string>;
118
+ };
119
+ }>;
120
+ value: Record<string, number | null>;
121
+ };
122
+
123
+ return {
124
+ dataset: datasetCode,
125
+ label: data.label,
126
+ updated: data.updated,
127
+ dimensions: Object.fromEntries(
128
+ data.id.map((dimId) => [
129
+ dimId,
130
+ {
131
+ label: data.dimension[dimId]?.label,
132
+ categories: data.dimension[dimId]?.category?.label ?? {},
133
+ },
134
+ ]),
135
+ ),
136
+ value_count: Object.keys(data.value).length,
137
+ values: data.value,
138
+ };
139
+ }
140
+
141
+ async function searchDatasets(query: string) {
142
+ const params = new URLSearchParams({ searchText: query, lang: 'en', type: 'dataset' });
143
+ const res = await fetch(`${TOC_URL}?${params}`);
144
+ if (!res.ok) throw new Error(`Eurostat error: ${res.status}`);
145
+
146
+ const data = (await res.json()) as {
147
+ items?: Array<{
148
+ code: string; title: string; lastUpdate?: string; shortDescription?: string;
149
+ }>;
150
+ };
151
+
152
+ const items = data.items ?? [];
153
+ return {
154
+ count: items.length,
155
+ datasets: items.slice(0, 30).map((d) => ({
156
+ code: d.code,
157
+ title: d.title,
158
+ last_update: d.lastUpdate,
159
+ description: d.shortDescription?.slice(0, 200),
160
+ })),
161
+ };
162
+ }
163
+
164
+ async function listDatasets() {
165
+ return {
166
+ note: 'Curated list of popular Eurostat datasets. Use get_dataset with these codes.',
167
+ datasets: [
168
+ { code: 'nama_10_gdp', theme: 'Economy', title: 'GDP and main components' },
169
+ { code: 'nama_10_pc', theme: 'Economy', title: 'GDP per capita' },
170
+ { code: 'prc_hicp_manr', theme: 'Prices', title: 'HICP — monthly inflation rate' },
171
+ { code: 'prc_hicp_aind', theme: 'Prices', title: 'HICP — annual average index' },
172
+ { code: 'une_rt_m', theme: 'Labour', title: 'Unemployment rate — monthly' },
173
+ { code: 'une_rt_a', theme: 'Labour', title: 'Unemployment rate — annual' },
174
+ { code: 'lfsi_emp_a', theme: 'Labour', title: 'Employment rate — annual' },
175
+ { code: 'demo_pjan', theme: 'Population', title: 'Population on 1 January' },
176
+ { code: 'demo_gind', theme: 'Population', title: 'Population change indicators' },
177
+ { code: 'migr_asyappctza', theme: 'Migration', title: 'Asylum applicants by citizenship' },
178
+ { code: 'ext_lt_maineu', theme: 'Trade', title: 'EU trade since 1999' },
179
+ { code: 'nrg_bal_c', theme: 'Energy', title: 'Complete energy balances' },
180
+ { code: 'env_air_gge', theme: 'Environment', title: 'Greenhouse gas emissions' },
181
+ { code: 'tour_occ_nim', theme: 'Tourism', title: 'Nights spent at tourist accommodation' },
182
+ ],
183
+ };
184
+ }
185
+
186
+ export default { tools, callTool, meter: { credits: 1 } } satisfies McpToolExport;
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "outDir": "dist",
10
+ "rootDir": "src",
11
+ "declaration": true
12
+ },
13
+ "include": ["src"]
14
+ }