@statsmcp/singstat 0.0.0-stage → 0.4.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,67 @@
1
- # Temporary Holding Version
1
+ # @statsmcp/singstat
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 [SingStat Table Builder](https://tablebuilder.singstat.gov.sg/), the database of the Singapore Department of Statistics. It gives AI assistants access to its time series in English.
4
+
5
+ > This project is not affiliated with or endorsed by the Singapore Department of Statistics. The Department of Statistics also runs its own SingStat MCP server.
6
+
7
+ ## Use the server
8
+
9
+ ### Hosted
10
+
11
+ There is no hosted endpoint for Singapore. Run the server on your computer, so that you accept the Singapore Open Data Licence yourself.
12
+
13
+ ### Local
14
+
15
+ You need Node.js 20 or later.
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "singstat": { "command": "npx", "args": ["-y", "@statsmcp/singstat"] }
21
+ }
22
+ }
23
+ ```
24
+
25
+ For Claude Code:
26
+
27
+ ```sh
28
+ claude mcp add singstat -- npx -y @statsmcp/singstat
29
+ ```
30
+
31
+ ## Tools
32
+
33
+ | Tool | What it does |
34
+ | -------------------- | ------------------------------------------------------------------------------------------------ |
35
+ | `search_tables` | Finds tables by keywords in their titles. Returns table IDs, titles and publication dates. |
36
+ | `get_table_metadata` | Lists the variables of a table and their value codes. Use `valueFilter` to find a value by name. |
37
+ | `query_table` | Returns data as CSV with readable labels. Use `latest` for recent periods. |
38
+
39
+ All tools are read-only. Each tool accepts `lang` (`en`). Each table has two variables: `series` (the rows) and `time` (the periods).
40
+
41
+ ## Use it in your own server
42
+
43
+ ```sh
44
+ npm install @statsmcp/singstat
45
+ ```
46
+
47
+ ```ts
48
+ import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
49
+ import { createSingstatServer } from '@statsmcp/singstat';
50
+
51
+ const server = createSingstatServer({ userAgent: 'my-app/1.0' });
52
+ await server.connect(new StdioServerTransport());
53
+ ```
54
+
55
+ `createSingstatServer` returns an `McpServer`. It also accepts a `cache`. To make one, install `@statsmcp/core` and use `createMemoryCache`, or implement the `Cache` interface.
56
+
57
+ ## Data licence and attribution
58
+
59
+ SingStat datasets are made available under the [Singapore Open Data Licence](https://data.gov.sg/open-data-licence). You can use them for any purpose, including commercial use. Credit the dataset and the date you accessed it, and link the licence. Do not suggest that the data has official status through your product.
60
+
61
+ The licence also says that users must indemnify the agency against claims that come from their use of the data. Read the licence before you use the data in a product.
62
+
63
+ Each result contains the source line and a link to the table in Table Builder.
64
+
65
+ ## Licence
66
+
67
+ The code is under the MIT licence. The data belongs to the Singapore Department of Statistics and the agencies that supply it.
package/dist/bin.d.mts ADDED
@@ -0,0 +1 @@
1
+ export {}
package/dist/bin.mjs ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { t as createSingstatServer } from "./src-BzWl2lF0.mjs";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
4
+ // src/bin.ts
5
+ await createSingstatServer().connect(new StdioServerTransport());
6
+ export {};
@@ -0,0 +1,5 @@
1
+ import { PresetServerOptions, PxwebPreset } from "@statsmcp/core";
2
+ import { McpServer } from "@modelcontextprotocol/server";
3
+ export declare const singstatPreset: PxwebPreset;
4
+ export type SingstatServerOptions = Pick<PresetServerOptions, 'cache' | 'userAgent'>;
5
+ export declare function createSingstatServer(options?: SingstatServerOptions): McpServer;
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export { t as createSingstatServer, n as singstatPreset } from "./src-BzWl2lF0.mjs";
@@ -0,0 +1,40 @@
1
+ import { createPresetServer } from "@statsmcp/core";
2
+ // src/preset.ts
3
+ const ATTRIBUTION = "Contains information from SingStat Table Builder (Singapore Department of Statistics), made available under the Singapore Open Data Licence (https://data.gov.sg/open-data-licence)";
4
+ const singstatPreset = {
5
+ name: "singstat",
6
+ title: "SingStat Table Builder (official statistics of Singapore)",
7
+ version: "0.4.0",
8
+ apiBaseUrl: "https://tablebuilder.singstat.gov.sg/api/table",
9
+ api: "singstat",
10
+ languages: ["en"],
11
+ attribution: () => ATTRIBUTION,
12
+ tableUrl: (_lang, tableId) => `https://tablebuilder.singstat.gov.sg/table/TS/${tableId}`,
13
+ instructions: `Official statistics for Singapore from SingStat Table Builder, the database of the Singapore Department of Statistics. This server is not affiliated with or endorsed by the Department of Statistics, and the data has no official status through it.
14
+
15
+ To answer a question with data:
16
+ 1. Call \`search_tables\` with short topic keywords in English. Table ids look like M213751.
17
+ 2. Call \`get_table_metadata\` on the best table. Each table has two variables: "series" (the rows, with their unit) and "time" (the periods). Use \`valueFilter\` to find a series by name.
18
+ 3. Call \`query_table\` with the series you need. Use \`latest\` on "time" for recent periods.
19
+
20
+ Always cite the source line that each result ends with, including the dataset name and the date you accessed it.`,
21
+ maxCells: 5e3,
22
+ searchLimit: 10,
23
+ searchAliases: { en: [{
24
+ terms: ["population"],
25
+ query: "total population"
26
+ }, {
27
+ terms: [
28
+ "housing price",
29
+ "house price",
30
+ "home price",
31
+ "property price"
32
+ ],
33
+ query: "property price index"
34
+ }] }
35
+ };
36
+ // src/index.ts
37
+ function createSingstatServer(options = {}) {
38
+ return createPresetServer(singstatPreset, options);
39
+ }
40
+ export { singstatPreset as n, createSingstatServer as t };
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "@statsmcp/singstat",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.4.0",
4
+ "description": "MCP server for SingStat Table Builder, the database of the Singapore Department of Statistics",
5
+ "license": "MIT",
6
+ "author": "Tadej Polajnar",
7
+ "homepage": "https://statsmcp.dev/singapore/",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Stats-MCP/statsmcp.git",
11
+ "directory": "packages/singstat"
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
+ "singstat",
23
+ "department-of-statistics",
24
+ "singapore",
25
+ "statistics",
26
+ "pxweb"
27
+ ],
28
+ "bin": {
29
+ "statsmcp-singstat": "./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
+ ],
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "dependencies": {
44
+ "@modelcontextprotocol/server": "^2.4.0",
45
+ "@statsmcp/core": "0.4.0"
46
+ },
47
+ "devDependencies": {
48
+ "@types/node": "26.6.5",
49
+ "tsdown": "0.23.2",
50
+ "typescript": "7.0.2",
51
+ "vitest": "5.0.5"
52
+ },
53
+ "scripts": {
54
+ "build": "tsdown",
55
+ "typecheck": "tsc --noEmit",
56
+ "test": "vitest run"
57
+ }
6
58
  }