@statsmcp/dzs 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 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
- # Temporary Holding Version
1
+ # @statsmcp/dzs
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 [PX-Web database of the Croatian Bureau of Statistics](https://web.dzs.hr/PXWeb/pxweb/en/) (Državni zavod za statistiku). It gives AI assistants access to its tables.
4
+
5
+ > This project is not affiliated with or endorsed by the Croatian Bureau of Statistics.
6
+
7
+ ## Use the server
8
+
9
+ ### Hosted
10
+
11
+ Add `https://statsmcp.dev/hr/mcp` as a remote MCP server. It uses Streamable HTTP and needs no authentication. For the steps for each client, refer to [statsmcp.dev/croatia](https://statsmcp.dev/croatia/).
12
+
13
+ ### Local
14
+
15
+ You need Node.js 20 or later.
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "dzs": { "command": "npx", "args": ["-y", "@statsmcp/dzs"] }
21
+ }
22
+ }
23
+ ```
24
+
25
+ For Claude Code:
26
+
27
+ ```sh
28
+ claude mcp add dzs -- npx -y @statsmcp/dzs
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` (`hr` or `en`). The Croatian list has one database more than the English list (settlements and population of Croatia).
42
+
43
+ ## Use it in your own server
44
+
45
+ ```sh
46
+ npm install @statsmcp/dzs
47
+ ```
48
+
49
+ ```ts
50
+ import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
51
+ import { nodeTableSnapshots } from '@statsmcp/core/node';
52
+ import { createDzsServer } from '@statsmcp/dzs';
53
+
54
+ const server = createDzsServer({
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
+ `createDzsServer` returns an `McpServer`. Search needs `tableSnapshots`. It also accepts a `cache`.
62
+
63
+ ## Data licence and attribution
64
+
65
+ The Croatian Bureau of Statistics publishes its data under the [Open Licence of the Republic of Croatia](https://web.dzs.hr/Hrv/about_us/Legals/Open%20Licence.pdf). You can use the data and the metadata for any purpose, including commercial use. You must name the source, give the date of the last update and link to the table.
66
+
67
+ Each result contains the source line and a link to the table. The search results show the date of the last update of each table. Give this date with the source. If you change the data or calculate new figures, say so, for example: `Croatian Bureau of Statistics and own calculations`. Do not suggest that the Croatian Bureau of Statistics endorses your product.
68
+
69
+ ## Licence
70
+
71
+ The code is under the MIT licence. The data belongs to the Croatian Bureau of Statistics.
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 dzsPreset, t as createDzsServer } from "./src-B5qyKP-0.mjs";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
4
+ import { nodeTableSnapshots } from "@statsmcp/core/node";
5
+ // src/bin.ts
6
+ await createDzsServer({ tableSnapshots: nodeTableSnapshots(new URL("../snapshots/", import.meta.url), { userAgent: `${dzsPreset.name}-mcp/${dzsPreset.version}` }) }).connect(new StdioServerTransport());
7
+ export {};
@@ -0,0 +1,5 @@
1
+ import { PresetServerOptions, PxwebPreset } from "@statsmcp/core";
2
+ import { McpServer } from "@modelcontextprotocol/server";
3
+ export declare const dzsPreset: PxwebPreset;
4
+ export type DzsServerOptions = Pick<PresetServerOptions, 'cache' | 'userAgent' | 'tableSnapshots'>;
5
+ export declare function createDzsServer(options?: DzsServerOptions): McpServer;
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export { t as createDzsServer, n as dzsPreset } from "./src-B5qyKP-0.mjs";
@@ -0,0 +1,101 @@
1
+ import { createPresetServer } from "@statsmcp/core";
2
+ // src/preset.ts
3
+ const LICENCE = "https://web.dzs.hr/Hrv/about_us/Legals/Open%20Licence.pdf";
4
+ const ATTRIBUTION = {
5
+ hr: `Izvor: Državni zavod za statistiku. Contains public sector information licensed under the Open Data Licence (${LICENCE})`,
6
+ en: `Source: Croatian Bureau of Statistics. Contains public sector information licensed under the Open Data Licence (${LICENCE})`
7
+ };
8
+ const dzsPreset = {
9
+ name: "dzs",
10
+ title: "PX-Web database of the Croatian Bureau of Statistics (official statistics)",
11
+ version: "0.3.0",
12
+ apiBaseUrl: "https://web.dzs.hr/PXWeb/api/v1",
13
+ database: [
14
+ "Cijene",
15
+ "Energija",
16
+ "Građevinarstvo",
17
+ "Industrija",
18
+ "Nacionalni racuni",
19
+ "Naselja i stanovništvo Republike Hrvatske",
20
+ "Okolis",
21
+ "Osobna potrošnja i pokazatelji siromaštva",
22
+ "Poljoprivreda, lov, šumarstvo i ribarstvo",
23
+ "Popis poljoprivrede 2020",
24
+ "Pravosudje",
25
+ "Robna razmjena s inozemstvom",
26
+ "Stanovništvo",
27
+ "Strukturne poslovne statistike",
28
+ "Subnacionalne statistike",
29
+ "Transport i komunikacije",
30
+ "Trgovina na malo",
31
+ "Turizam",
32
+ "Zaposlenost i plaće",
33
+ "Znanost, tehnologija i informacijsko društvo"
34
+ ],
35
+ search: "index",
36
+ languages: ["hr", "en"],
37
+ attribution: (lang) => lang === "hr" ? ATTRIBUTION.hr : ATTRIBUTION.en,
38
+ tableUrl: (lang, tableId) => {
39
+ const pageLang = lang === "hr" ? "hr" : "en";
40
+ const segments = tableId.split("/").map(encodeURIComponent);
41
+ const file = segments.pop() ?? tableId;
42
+ return `https://web.dzs.hr/PXWeb/pxweb/${pageLang}/${segments[0]}/${segments.join("__")}/${file}/`;
43
+ },
44
+ instructions: `Official statistics for Croatia from the PX-Web database of the Croatian Bureau of Statistics (Državni zavod za statistiku, DZS). This server is not affiliated with or endorsed by the Croatian Bureau of Statistics.
45
+
46
+ To answer a question with data:
47
+ 1. Call \`search_tables\` with short topic keywords in Croatian ("hr") or English ("en"). Table ids contain the database and folder names; use them exactly as search_tables returns them. You can also search for a table number such as ME_PS09 if no other table has the same number.
48
+ 2. Call \`get_table_metadata\` on the best table to see its variables and value codes. Use \`valueFilter\` to find a county, town or municipality by name.
49
+ 3. Call \`query_table\` with only the values you need. Use \`latest\` for recent periods.
50
+
51
+ The bureau allows 10 API calls per 10 seconds, so request only the tables you need. Registered unemployment is published by the Croatian Employment Service, not in this database.
52
+
53
+ Always cite the source line that each result ends with, and the date of the last update that search_tables shows for the table. If you change the data or calculate new figures, say so, for example "Croatian Bureau of Statistics and own calculations".`,
54
+ maxCells: 5e3,
55
+ searchLimit: 10,
56
+ searchAliases: {
57
+ en: [
58
+ {
59
+ terms: ["inflation", "consumer prices"],
60
+ query: "consumer price indices"
61
+ },
62
+ {
63
+ terms: [
64
+ "salary",
65
+ "salaries",
66
+ "wage",
67
+ "wages"
68
+ ],
69
+ query: "average monthly gross and net earnings"
70
+ },
71
+ {
72
+ terms: [
73
+ "housing price",
74
+ "house price",
75
+ "home price",
76
+ "property price"
77
+ ],
78
+ query: "house price indices"
79
+ }
80
+ ],
81
+ hr: [
82
+ {
83
+ terms: ["inflacija", "cijene"],
84
+ query: "indeksi potrošačkih cijena"
85
+ },
86
+ {
87
+ terms: ["plaća", "plaće"],
88
+ query: "prosječna mjesečna bruto i neto plaća"
89
+ },
90
+ {
91
+ terms: ["cijene stanova", "cijene nekretnina"],
92
+ query: "indeksi cijena stambenih objekata"
93
+ }
94
+ ]
95
+ }
96
+ };
97
+ // src/index.ts
98
+ function createDzsServer(options = {}) {
99
+ return createPresetServer(dzsPreset, options);
100
+ }
101
+ export { dzsPreset as n, createDzsServer as t };
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "@statsmcp/dzs",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.3.0",
4
+ "description": "MCP server for the PX-Web database of the Croatian Bureau of Statistics (Državni zavod za statistiku)",
5
+ "license": "MIT",
6
+ "author": "Tadej Polajnar",
7
+ "homepage": "https://statsmcp.dev/croatia/",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Stats-MCP/statsmcp.git",
11
+ "directory": "packages/dzs"
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
+ "dzs",
23
+ "croatia",
24
+ "hrvatska",
25
+ "statistics",
26
+ "pxweb"
27
+ ],
28
+ "bin": {
29
+ "dzs-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