NEW v0.19.0 — get_sdmx_data(format="csv") returns a compact CSV about 3× smaller to copy into files; key_template on every search result; labels fall back to WDS metadata when StatCan serves an incomplete structure
• v0.18.0 — the 5-tool core toolset is now the default: about 939 tokens in tools/list, down from 17 tools / about 8,044 (STATCAN_TOOLSET=legacy restores the old set); retries for stalled StatCan requests; truncated table structures are no longer cached
• v0.17.0 — search is paged (10 per page, offset) with SDMX key templates; get_sdmx_data summarizes results over 100 observations unless full=true; keys are validated against the table structure, so a bad key fails at once instead of hanging
• v0.16.0 — compact output: observations grouped by series, slimmer search results, get_code_sets summary by default; read-only annotations on every tool; fixes for bulk vector range and changed-series requests
• v0.15.0 — the interactive chart view was removed; agents get full rows; server now at mcp-statcan.com
• v0.14.0 — experimental interactive chart and table view (MCP Apps), removed again in v0.15.0
• v0.12.0 — data correctness: SDMX data now read as XML; wildcards return every series (previously a partial set), and VECTOR_ID, DGUID and UOM are correct per row
• Listed on the MCP server registry
Connection Instructions
Add this server to your MCP client using the Streamable HTTP transport. No API key is required — Statistics Canada data is publicly available.
https://mcp-statcan.com/mcp
Health Check
https://mcp-statcan.com/health
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"statcan": {
"type": "http",
"url": "https://mcp-statcan.com/mcp"
}
}
}
Claude Code (.mcp.json)
{
"mcpServers": {
"statcan": {
"type": "http",
"url": "https://mcp-statcan.com/mcp"
}
}
}
Claude Code (command line)
claude mcp add --transport http statcan https://mcp-statcan.com/mcp
Local install (stdio, includes SQLite tools and the statcan CLI)
pip install statcan-mcp-server
CLI for agents with a shell (JSON output, stable exit codes)
statcan describe
statcan --json download 18-10-0004-01 --key "2+3.2" --last 12 --output cpi.csv
Command-Line Interface
The statcan CLI ships with the local install and works without an LLM. People can browse tables in the terminal; agents with a shell can use --json for structured output and stable exit codes.
Exploring a table: search, metadata, download
Agent mode: JSON envelopes and exit codes
Registered Tools (5)
The hosted server publishes the core toolset below over the /mcp endpoint (about 939 tokens in tools/list, down from about 8,044 for the 17-tool legacy set). It runs in stateless mode — composite and SQLite database tools are intentionally omitted here. To use those, run the server locally over stdio (pip install statcan-mcp-server). For calculations on this server, pass sql to get_sdmx_data: the SQL runs here and only the answer is sent back to the model.
| Tool Name | Category | Description |
|---|---|---|
| search_cubes_by_title | Discovery | Find tables by title keywords (English or French), paged; every result on the page includes the SDMX key template |
| get_sdmx_structure | SDMX | Dimensions in key order with their codes; search finds codes by label, dimension lists one full dimension plus its leaf_key |
| get_sdmx_data | SDMX + SQL | Observations by productId + key, or one vectorId; summary over 100 observations unless full; format="csv" returns every observation as a compact CSV (about 3× smaller to copy into a file); optional sql runs one read-only query server-side and returns only the result |
| get_series_info | Series | productId + coordinates, or vectorIds: decoded frequency, unit and scalar, titles (English and French), SDMX key |
| get_changes | Change Detection | Tables released on a date (default today), or new data points for one series |
Set STATCAN_TOOLSET=legacy (or --toolset legacy) on a self-hosted server for the previous tool set.
Technical Specifications
| Transport | Streamable HTTP (stateless) — MCP 2025-03-26 spec |
| Upstream APIs | Statistics Canada WDS REST + SDMX 2.1 REST (data read as structure-specific XML) |
| Authentication | OAuth 2.1/PKCE available (auto-approved, no credentials); open access also supported |
| SSL Verification | On by default; STATCAN_VERIFY_SSL=false disables it for broken trust stores |
| Structured Output | outputSchema + structuredContent on the SDMX data and structure tools; read-only tools carry readOnlyHint |
| Max SDMX Rows | 500 per get_sdmx_data call |
| Server-side SQL | get_sdmx_data with sql: SQLite in-memory, one SELECT per call, 2 s limit, up to 50,000 fetched rows, 500 result rows; nothing stored |
| Cache | 1-hour TTL on the cube list and on table structures |
| Python | 3.10+ — asyncio, httpx, Starlette, Uvicorn |
| Install | pip install statcan-mcp-server |
| Source | github.com/Aryan-Jhaveri/mcp-statcan |
Known Constraints & Notes
- lastNObservations + startPeriod/endPeriod — cannot be combined; StatCan returns HTTP 406.
- Wildcards include totals — . returns every member of a dimension, including totals and parent aggregates. For sums or rankings use the leaf_key from get_sdmx_structure(productId, dimension=N).
- vectorIds from structure — get_sdmx_structure returns member names but not vectorIds. Use get_series_info to resolve coordinates to vectorIds.
- Data format — SDMX data is read as structure-specific XML and labelled from the table’s structure. StatCan’s SDMX-JSON mis-indexes series and attributes, which previously caused missing wildcard rows, wrong OR-key labels and misplaced VECTOR_ID/UOM values (fixed in v0.12.0).
- claude.ai keeps a saved tool list — after an update, disconnect and reconnect the connector (Settings → Connectors) to see new tools and parameters.
- claude.ai’s code sandbox cannot reach StatCan — data arrives through the connector, so to build a file the model copies the tool result. Use get_sdmx_data(format="csv") to keep that copy small.
Data Attribution
All data returned by this server originates from Statistics Canada. Users are responsible for complying with Statistics Canada’s Open Licence when using or redistributing data obtained through this server. This MCP server is an independent project and is not affiliated with or endorsed by Statistics Canada or the Government of Canada.