@statsmcp/cbs 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 +66 -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-B3skOvn1.mjs +76 -0
- package/package.json +56 -3
- package/snapshots/en.json.gz +0 -0
- package/snapshots/nl.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,67 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @statsmcp/cbs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An MCP server for [StatLine](https://opendata.cbs.nl/), the database of Statistics Netherlands (CBS). It gives AI assistants access to its tables in Dutch and English.
|
|
4
|
+
|
|
5
|
+
> This project is not affiliated with or endorsed by Statistics Netherlands (CBS).
|
|
6
|
+
|
|
7
|
+
## Use the server
|
|
8
|
+
|
|
9
|
+
### Hosted
|
|
10
|
+
|
|
11
|
+
Add `https://statsmcp.dev/nl/mcp` as a remote MCP server. It uses Streamable HTTP and needs no authentication. For the steps for each client, refer to [statsmcp.dev/netherlands](https://statsmcp.dev/netherlands/).
|
|
12
|
+
|
|
13
|
+
### Local
|
|
14
|
+
|
|
15
|
+
You need Node.js 20 or later.
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"cbs": { "command": "npx", "args": ["-y", "@statsmcp/cbs"] }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For Claude Code:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
claude mcp add cbs -- npx -y @statsmcp/cbs
|
|
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` (`nl` or `en`). Dutch and English tables have different IDs. The measures of a table are the values of its "Topics" variable. The server loads the table catalogue and searches the titles itself. Discontinued tables are marked "archived".
|
|
42
|
+
|
|
43
|
+
## Use it in your own server
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm install @statsmcp/cbs
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
|
|
51
|
+
import { createCbsServer } from '@statsmcp/cbs';
|
|
52
|
+
|
|
53
|
+
const server = createCbsServer({ userAgent: 'my-app/1.0' });
|
|
54
|
+
await server.connect(new StdioServerTransport());
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`createCbsServer` 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
|
+
CBS publishes its data under the [Creative Commons Attribution 4.0 licence (CC BY 4.0)](https://www.cbs.nl/en-gb/about-us/website/copyright). You can use it for any purpose, including commercial use, if you name Statistics Netherlands (CBS) as the source. Do not suggest that CBS endorses your product.
|
|
62
|
+
|
|
63
|
+
Each result contains the source line and a link to the table on cbs.nl. If you change the data or calculate new figures, say so, for example: `Source: CBS / Calculated by <you>`.
|
|
64
|
+
|
|
65
|
+
## Licence
|
|
66
|
+
|
|
67
|
+
The code is under the MIT licence. The data belongs to Statistics Netherlands (CBS).
|
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 cbsPreset, t as createCbsServer } from "./src-B3skOvn1.mjs";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
4
|
+
import { nodeTableSnapshots } from "@statsmcp/core/node";
|
|
5
|
+
// src/bin.ts
|
|
6
|
+
await createCbsServer({ tableSnapshots: nodeTableSnapshots(new URL("../snapshots/", import.meta.url), { userAgent: `${cbsPreset.name}-mcp/${cbsPreset.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 cbsPreset: PxwebPreset;
|
|
4
|
+
export type CbsServerOptions = Pick<PresetServerOptions, 'cache' | 'userAgent' | 'tableSnapshots'>;
|
|
5
|
+
export declare function createCbsServer(options?: CbsServerOptions): McpServer;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as cbsPreset, t as createCbsServer } from "./src-B3skOvn1.mjs";
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { createPresetServer } from "@statsmcp/core";
|
|
2
|
+
// src/preset.ts
|
|
3
|
+
const LICENCE = "CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)";
|
|
4
|
+
const ATTRIBUTION = {
|
|
5
|
+
nl: `Bron: CBS, ${LICENCE}`,
|
|
6
|
+
en: `Source: Statistics Netherlands (CBS), ${LICENCE}`
|
|
7
|
+
};
|
|
8
|
+
const cbsPreset = {
|
|
9
|
+
name: "cbs",
|
|
10
|
+
title: "StatLine (Statistics Netherlands official statistics)",
|
|
11
|
+
version: "0.3.0",
|
|
12
|
+
apiBaseUrl: "https://opendata.cbs.nl",
|
|
13
|
+
api: "cbs-odata",
|
|
14
|
+
languages: ["nl", "en"],
|
|
15
|
+
attribution: (lang) => lang === "nl" ? ATTRIBUTION.nl : ATTRIBUTION.en,
|
|
16
|
+
tableUrl: (lang, tableId) => lang === "nl" ? `https://www.cbs.nl/nl-nl/cijfers/detail/${tableId}` : `https://www.cbs.nl/en-gb/figures/detail/${tableId}`,
|
|
17
|
+
instructions: `Official statistics for the Netherlands from StatLine, the database of Statistics Netherlands (CBS). This server is not affiliated with or endorsed by CBS.
|
|
18
|
+
|
|
19
|
+
To answer a question with data:
|
|
20
|
+
1. Call \`search_tables\` with short topic keywords in Dutch ("nl") or English ("en"). Dutch and English tables have different ids (86141NED, 86141ENG), and there are more Dutch tables. Results marked "archived" are discontinued tables; prefer current tables.
|
|
21
|
+
2. Call \`get_table_metadata\` on the best table. The measures of a table are the values of the "Topics" variable; select only the ones you need. Use \`valueFilter\` to find a municipality or region by name.
|
|
22
|
+
3. Call \`query_table\` with only the values you need. Use \`latest\` for recent periods.
|
|
23
|
+
|
|
24
|
+
Always cite the source line that each result ends with. If you calculate new figures, say they are your own calculation based on CBS data.`,
|
|
25
|
+
maxCells: 5e3,
|
|
26
|
+
searchLimit: 10,
|
|
27
|
+
searchAliases: {
|
|
28
|
+
en: [
|
|
29
|
+
{
|
|
30
|
+
terms: ["inflation", "consumer price index"],
|
|
31
|
+
query: "consumer prices CPI"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
terms: [
|
|
35
|
+
"salary",
|
|
36
|
+
"salaries",
|
|
37
|
+
"earnings"
|
|
38
|
+
],
|
|
39
|
+
query: "wages"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
terms: [
|
|
43
|
+
"housing price",
|
|
44
|
+
"house price",
|
|
45
|
+
"home price",
|
|
46
|
+
"property price"
|
|
47
|
+
],
|
|
48
|
+
query: "existing own homes"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
nl: [
|
|
52
|
+
{
|
|
53
|
+
terms: ["inflatie", "prijsstijging"],
|
|
54
|
+
query: "consumentenprijzen CPI"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
terms: ["salaris", "loon"],
|
|
58
|
+
query: "lonen"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
terms: [
|
|
62
|
+
"huizenprijs",
|
|
63
|
+
"huizenprijzen",
|
|
64
|
+
"woningprijs",
|
|
65
|
+
"huisprijs"
|
|
66
|
+
],
|
|
67
|
+
query: "bestaande koopwoningen"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
// src/index.ts
|
|
73
|
+
function createCbsServer(options = {}) {
|
|
74
|
+
return createPresetServer(cbsPreset, options);
|
|
75
|
+
}
|
|
76
|
+
export { cbsPreset as n, createCbsServer as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsmcp/cbs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "MCP server for StatLine, the database of Statistics Netherlands (CBS)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Tadej Polajnar",
|
|
7
|
+
"homepage": "https://statsmcp.dev/netherlands/",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Stats-MCP/statsmcp.git",
|
|
11
|
+
"directory": "packages/cbs"
|
|
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
|
+
"statline",
|
|
23
|
+
"cbs",
|
|
24
|
+
"netherlands",
|
|
25
|
+
"statistics",
|
|
26
|
+
"pxweb"
|
|
27
|
+
],
|
|
28
|
+
"bin": {
|
|
29
|
+
"cbs-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
|