@statsmcp/bns 0.0.0-stage → 0.6.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/bns
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 [StatBank](https://statbank.statistica.md/PxWeb/pxweb/en/) of the National Bureau of Statistics of the Republic of Moldova (NBS). It gives AI assistants access to its tables in Romanian and English.
4
+
5
+ > This project is not affiliated with or endorsed by the National Bureau of Statistics of the Republic of Moldova.
6
+
7
+ ## Use the server
8
+
9
+ ### Hosted
10
+
11
+ Add `https://statsmcp.dev/md/mcp` as a remote MCP server. It uses Streamable HTTP and needs no authentication. For the steps for each client, refer to [statsmcp.dev/moldova](https://statsmcp.dev/moldova/).
12
+
13
+ ### Local
14
+
15
+ You need Node.js 20 or later.
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "bns": { "command": "npx", "args": ["-y", "@statsmcp/bns"] }
21
+ }
22
+ }
23
+ ```
24
+
25
+ For Claude Code:
26
+
27
+ ```sh
28
+ claude mcp add bns -- npx -y @statsmcp/bns
29
+ ```
30
+
31
+ The API of the office would need one search per database, more than its rate limit allows. 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 English or Romanian in all six thematic databases. |
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. Some tables are split by period: an older table and a newer one for the latest years.
42
+
43
+ ## Use it in your own server
44
+
45
+ ```sh
46
+ npm install @statsmcp/bns
47
+ ```
48
+
49
+ ```ts
50
+ import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
51
+ import { createBnsServer } from '@statsmcp/bns';
52
+ import { nodeTableSnapshots } from '@statsmcp/core/node';
53
+
54
+ const server = createBnsServer({
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
+ `createBnsServer` returns an `McpServer`. Search needs `tableSnapshots`. It also accepts a `cache`.
62
+
63
+ ## Data licence and attribution
64
+
65
+ The NBS publishes its content under the [Creative Commons Attribution 4.0 licence (CC BY 4.0)](https://statistica.gov.md/en/copyright-139.html). You can use it for commercial and non-commercial purposes if you state the source with a link to the material and say when you changed it.
66
+
67
+ Each result contains the source line and a link to the table.
68
+
69
+ ## Licence
70
+
71
+ The code is under the MIT licence. The data belongs to the National Bureau of Statistics of the Republic of Moldova.
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 bnsPreset, t as createBnsServer } from "./src-65Pv_PA4.mjs";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
4
+ import { nodeTableSnapshots } from "@statsmcp/core/node";
5
+ // src/bin.ts
6
+ await createBnsServer({ tableSnapshots: nodeTableSnapshots(new URL("../snapshots/", import.meta.url), { userAgent: `${bnsPreset.name}-mcp/${bnsPreset.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 bnsPreset: PxwebPreset;
4
+ export type BnsServerOptions = Pick<PresetServerOptions, 'cache' | 'userAgent' | 'tableSnapshots'>;
5
+ export declare function createBnsServer(options?: BnsServerOptions): McpServer;
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export { n as bnsPreset, t as createBnsServer } from "./src-65Pv_PA4.mjs";
@@ -0,0 +1,60 @@
1
+ import { createPresetServer } from "@statsmcp/core";
2
+ // src/preset.ts
3
+ const TERMS = "https://statistica.gov.md/en/copyright-139.html";
4
+ const ATTRIBUTION = {
5
+ ro: `Sursa: Biroul Național de Statistică al Republicii Moldova, CC BY 4.0 (${TERMS})`,
6
+ en: `Source: National Bureau of Statistics of the Republic of Moldova, CC BY 4.0 (${TERMS})`
7
+ };
8
+ const bnsPreset = {
9
+ name: "bns",
10
+ title: "StatBank of the National Bureau of Statistics of the Republic of Moldova (official statistics)",
11
+ version: "0.6.0",
12
+ apiBaseUrl: "https://statbank.statistica.md/PxWeb/api/v1",
13
+ database: [
14
+ "10 Mediul inconjurator",
15
+ "20 Populatia si procesele demografice",
16
+ "30 Statistica sociala",
17
+ "40 Statistica economica",
18
+ "50 Statistica gender",
19
+ "60 Statistica regionala"
20
+ ],
21
+ search: "index",
22
+ languages: ["ro", "en"],
23
+ attribution: (lang) => lang === "ro" ? ATTRIBUTION.ro : ATTRIBUTION.en,
24
+ tableUrl: (lang, tableId) => {
25
+ const pageLang = lang === "ro" ? "ro" : "en";
26
+ const [database = "", ...rest] = tableId.split("/").map(encodeURIComponent);
27
+ const file = rest.pop() ?? "";
28
+ return `https://statbank.statistica.md/PxWeb/pxweb/${pageLang}/${database}/${[database, ...rest].join("__")}/${file}/`;
29
+ },
30
+ instructions: `Official statistics for Moldova from the StatBank of the National Bureau of Statistics (NBS). This server is not affiliated with or endorsed by the NBS.
31
+
32
+ To answer a question with data:
33
+ 1. Call \`search_tables\` with short topic keywords in English ("en") or Romanian ("ro"). Some tables are split by period, with an older table and a newer one for the latest years. Compare the periods in the titles and use the table that covers the period you need. A few tables exist only in Romanian.
34
+ 2. Call \`get_table_metadata\` on the best table to see its variables and value codes. Use \`valueFilter\` to find a district by name.
35
+ 3. Call \`query_table\` with only the values you need. Use \`latest\` for recent periods.
36
+
37
+ The StatBank allows about 10 API calls per 10 seconds. Always cite the source line that each result ends with, with the table link. If you change the data or calculate new figures, say so, for example "Own calculations based on data of the National Bureau of Statistics of the Republic of Moldova".`,
38
+ maxCells: 5e3,
39
+ searchLimit: 10,
40
+ searchAliases: {
41
+ en: [{
42
+ terms: ["inflation", "consumer prices"],
43
+ query: "CPI"
44
+ }],
45
+ ro: [{
46
+ terms: [
47
+ "inflatia",
48
+ "inflație",
49
+ "preturi",
50
+ "prețuri"
51
+ ],
52
+ query: "IPC"
53
+ }]
54
+ }
55
+ };
56
+ // src/index.ts
57
+ function createBnsServer(options = {}) {
58
+ return createPresetServer(bnsPreset, options);
59
+ }
60
+ export { bnsPreset as n, createBnsServer as t };
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "@statsmcp/bns",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.6.0",
4
+ "description": "MCP server for the StatBank of the National Bureau of Statistics of the Republic of Moldova",
5
+ "license": "MIT",
6
+ "author": "Tadej Polajnar",
7
+ "homepage": "https://statsmcp.dev/moldova/",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Stats-MCP/statsmcp.git",
11
+ "directory": "packages/bns"
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
+ "bns",
23
+ "nbs",
24
+ "moldova",
25
+ "statistics",
26
+ "pxweb"
27
+ ],
28
+ "bin": {
29
+ "bns-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.6.0"
47
+ },
48
+ "devDependencies": {
49
+ "@types/node": "26.6.6",
50
+ "tsdown": "0.23.4",
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