NEW 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
NEW v0.11.0 — statcan CLI for agents: --json envelopes, stable exit codes with hints, statcan describe; fixes for single-period monthly dates and frequency labels
• v0.10.0 — structured output: SDMX tools publish an outputSchema and return typed structuredContent; failures are flagged isError; responses are 25–40% smaller
• v0.9.0 — query_sdmx on this server: fetch a table slice and run one read-only SQL query server-side; only the answer is returned, with no 500-row cap on the fetch
• v0.8.0 — fetch_sdmx_to_database (local install): store a full SDMX slice in SQLite without passing rows through the model; values stored as numbers
• v0.7.16 — statcan download now requires --key; StatCan SDMX no longer accepts the all shortcut
• v0.7.15 — OAuth 2.1/PKCE support: Claude.ai web connector now routes tool calls correctly
• v0.7.14 — fixed 307 redirect loop on POST /mcp; Claude.ai IPs now receive 200 OK
• v0.7.9 — automated CI/CD: version bumps on push, landing announcement workflow
• v0.7.8 — tool-level request logging and /.well-known/mcp.json discovery
• 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.onrender.com/mcp
Health Check
https://mcp-statcan.onrender.com/health
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"statcan": {
"type": "http",
"url": "https://mcp-statcan.onrender.com/mcp"
}
}
}
Claude Code (.mcp.json)
{
"mcpServers": {
"statcan": {
"type": "http",
"url": "https://mcp-statcan.onrender.com/mcp"
}
}
}
Claude Code (command line)
claude mcp add --transport http statcan https://mcp-statcan.onrender.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 (18)
All tools below are exposed over the /mcp endpoint. The hosted HTTP server 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, use query_sdmx: the SQL runs here and only the answer is sent back to the model.
| Tool Name | Category | Description |
|---|---|---|
| search_cubes_by_title | Discovery | Full-text keyword search across all StatCan tables, capped at 25 results |
| get_all_cubes_list | Discovery | Paginated inventory of all tables (100/page) |
| get_all_cubes_list_lite | Discovery | Lightweight paginated list, 1-hour TTL cache |
| get_cube_metadata | Metadata | Full table structure: dimensions, members, frequencies; summary mode caps members at 10 |
| get_code_sets | Metadata | WDS attribute decoder tables (scalar type, UOM, frequency, status codes) |
| get_series_info | Series | Resolve dimension coordinates to vectorId, frequency, UOM |
| get_series_info_from_vector | Series | Look up series metadata by vectorId |
| get_bulk_vector_data_by_range | Vector | Fetch multiple vectors filtered by release-date range |
| get_changed_series_data_from_vector | Change Detection | Detect data changes for a vector since a given date |
| get_changed_series_data_from_cube_pid_coord | Change Detection | Detect changes for a specific series by coordinate |
| get_changed_cube_list | Change Detection | List all tables with data changes since a given date |
| get_changed_series_list | Change Detection | List all series with changes since a given date |
| get_sdmx_structure | SDMX | Data Structure Definition as JSON: dimension positions and codelists with hierarchy |
| get_sdmx_data | SDMX | Server-side filtered observations by productId + SDMX key string |
| get_sdmx_rows | SDMX | Inline tabular rows (up to 500) returned directly in the tool response |
| query_sdmx | SDMX + SQL | Fetch observations and run one read-only SQL query server-side in a temporary in-memory table; returns only the result (rank, compare, growth) |
| get_sdmx_vector_data | SDMX | Single vectorId observations via SDMX |
| get_sdmx_key_for_dimension | SDMX | Returns the full OR-key for a large dimension (avoids wildcard sampling errors) |
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 all SDMX tools; read-only tools carry readOnlyHint |
| Max SDMX Rows | 500 per get_sdmx_data call |
| Server-side SQL | query_sdmx: 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 get_all_cubes_list_lite |
| 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 leaf codes from get_sdmx_key_for_dimension.
- vectorIds from metadata — get_cube_metadata 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).
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.