Skip to content

Latest commit

 

History

History
89 lines (66 loc) · 7 KB

development.md

File metadata and controls

89 lines (66 loc) · 7 KB

Development

You need Node.js 24.21 or later (see .nvmrc) and pnpm 12. Enable pnpm with corepack enable. The published packages work on Node.js 20 or later.

Repository layout

Path Package Description
packages/core @statsmcp/core PxWeb v1 and v2, StatBank Denmark, CBS OData, PxStat, SDMX, Eurostat, Statistics Canada and SingStat clients, table index, query planner and MCP tools. Has no country data.
packages/sistat @statsmcp/sistat SiStat preset and the stdio server.
packages/ssb @statsmcp/ssb Statbank Norway preset and the stdio server.
packages/stat-ee @statsmcp/stat-ee Statistics Estonia preset and the stdio server.
packages/hagstova @statsmcp/hagstova Statistics Faroe Islands preset and the stdio server.
packages/statfin @statsmcp/statfin Statistics Finland preset and the stdio server.
packages/scb @statsmcp/scb Statistics Sweden preset (PxWeb API v2) and the stdio server.
packages/dst @statsmcp/dst Statistics Denmark preset (StatBank API) and the stdio server.
packages/cbs @statsmcp/cbs Statistics Netherlands preset (CBS OData) and the stdio server.
packages/eurostat @statsmcp/eurostat Eurostat preset and the stdio server.
packages/statcan @statsmcp/statcan Statistics Canada preset (WDS) and the stdio server.
packages/singstat @statsmcp/singstat Singapore preset (SingStat Table Builder) and the stdio server.
packages/statice @statsmcp/statice Statistics Iceland preset (PxWeb v1, crawled table list) and the stdio server.
packages/dzs @statsmcp/dzs Croatian Bureau of Statistics preset (PxWeb v1, crawled table list) and the stdio server.
packages/cso @statsmcp/cso Central Statistics Office Ireland preset (PxStat) and the stdio server.
packages/abs @statsmcp/abs Australian Bureau of Statistics preset (SDMX) and the stdio server.
apps/worker private Cloudflare Worker for the hosted endpoint.
apps/crawler private Crawler for the table lists of sources without a small list endpoint. Writes the snapshots that statsmcp.dev serves.
tests/consumer none Typecheck of the published types with TypeScript 5. CI runs it.
docs Documentation.

Commands

pnpm install
pnpm build        # build all packages
pnpm test         # unit tests
pnpm typecheck
pnpm lint         # oxlint
pnpm format       # oxfmt check (pnpm format:fix to correct)

Test with an MCP client

  1. Build the packages:

    pnpm install && pnpm build
  2. Connect a client. Use one of these two options.

    Stdio server from source:

    claude mcp add sistat-local -- node "$PWD/packages/sistat/dist/bin.mjs"

    Worker on your computer:

    pnpm dev:worker
    claude mcp add --transport http sistat-worker http://127.0.0.1:8787/si/mcp
  3. Ask a question from examples.md, for example "What is the latest inflation rate in Slovenia?".

To call the tools without an assistant, use the MCP Inspector:

npx @modelcontextprotocol/inspector node packages/sistat/dist/bin.mjs

Add a statistics office

To make a server for a different PxWeb instance, refer to the @statsmcp/core README. Read data-licence.md first.

Secrets and variables for GitHub Actions

CI (ci.yml) needs no secrets, so pull requests from forks work.

Name Kind Used by Purpose
CLOUDFLARE_API_TOKEN secret crawl.yml Upload the table indexes to R2.
CLOUDFLARE_ACCOUNT_ID secret crawl.yml The Cloudflare account of the R2 bucket.
NPM_TOKEN secret release.yml Publish to npm, until trusted publishing is set up. See releasing.
RELEASE_ENABLED variable release.yml Set it to true to let pushes to main publish releases.

Contribute

Refer to CONTRIBUTING.md.