MCP server and CLI for Statistics Canada's Web Data Service (WDS) and SDMX REST API. Gives any MCP client — Claude, Cursor, VS Code Copilot, Gemini — structured access to Canadian statistical data. Includes a standalone CLI for direct downloads without an LLM.
Access Statistics Canada data via the Web Data Services API
2026-11-13
ดาว
—
เครื่องมือ
—
อัปไทม์
—
statcan
Hosted on Render — no install required for most users. See Quick Start.
Pick the option that fits you. You don't need to install anything for Option 1.
Option 1 — Use the hosted server (recommended)
Connect directly to the public server on Render. No uv, no terminal, no local setup.
Claude Desktop / Claude.ai
Open Settings → Connectors → Add Custom Connector
Name: mcp-statcan
URL: https://mcp-statcan.onrender.com/mcp
Save and restart
Claude Code
claude mcp add statcan --transport http https://mcp-statcan.onrender.com/mcp --scope global
The hosted server provides all WDS + SDMX tools. Database tools (SQLite) require local setup (Option 3) — they are intentionally excluded from the shared server.
Option 2 — Self-host HTTP (WDS + SDMX, no DB)
Run a local server with the same tools as the hosted version.
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Step 2 — Start the server:
uvx statcan-mcp-server --transport http
# Listening at http://localhost:8000
Step 3 — Connect your client to http://localhost:8000/mcp.
Option 3 — Full local setup (WDS + SDMX + SQLite)
Everything from Option 2, plus database tools for storing and querying data with SQL. Runs via stdio.
Step 1 — Install uv (same as above).
Step 2 — Configure your client with the stdio snippets in Setup by Client below.
uvx downloads and runs the server automatically on first use.
Option 4 — statcan CLI (no LLM needed)
Download StatCan data directly from the terminal. See statcan CLI.
uvx statcan-mcp-server # installs the package
statcan search "labour force"
statcan metadata 14-10-0287-01 # run first to find dimension IDs
statcan download 14-10-0287-01 --key "1.1.1" --last 12 --output lfs.csv # run `statcan metadata <pid>` first to find real dimension IDs
Examples
Chat examples
Dataset
Query
Demo
Source
Canada's Greenhouse Gas Emissions
"Create a simple visualization for greenhouse emissions for Canada as a whole over the last 4 years"
Chat
Table 38-10-0097-01
Canada's International Trade in Services
"Create a quick analysis for international trade in services for the last 6 months with a visualization"
Chat
Table 12-10-0144-01
Ontario Building Construction Price Index
"Generate a visualization for Ontario's Building Price index from Q4 2023 to Q4 2024"
Chat
Table 18-10-0289-01
Canadian Unemployment Dashboard
"Create a Canadian Unemployment Dashboard using statcan mcp"
Chat
Table 14-10-0287-01
Dashboard examples
Title
Link
Source
Canada's Critical Minerals Economy
Dashboard
Table 36-10-0708-01
Price of Everything: CPI Dashboard 2015–2026
Dashboard
Table 18-10-0004-01
Canada's Biomedical & Biotech Industries
Dashboard
Table 27-10-0297-01
Setup by Client
Hosted server (Option 1)
Claude Desktop — Settings → Connectors → Add Custom Connector
Name: mcp-statcan
URL: https://mcp-statcan.onrender.com/mcp
Claude Code
claude mcp add statcan --transport http https://mcp-statcan.onrender.com/mcp --scope global
Cursor — .cursor/mcp.json (project) or ~/.cursor/mcp.json (global):
Pass --db-path with an absolute path. Claude Desktop overrides the subprocess HOME env var, which can break default path resolution.
Claude Code
claude mcp add statcan --scope global -- uvx statcan-mcp-server
Cursor / VS Code / Gemini — use uvx statcan-mcp-server as the stdio command.
How Claude.ai Uses This Server
Claude.ai (web) has no bash sandbox — it can't run shell commands. Instead, it uses MCP tools for discovery and its Python script tool to fetch data without bloating the context window.
The pattern:
1. MCP tools (small payloads — metadata only):
search_cubes_by_title("labour force") → productId
get_sdmx_structure(productId=...) → dimension layout + codes
get_sdmx_key_for_dimension(...) → OR key for large dimensions
2. Python script (data never enters context):
url = "https://mcp-statcan.onrender.com/files/sdmx/<pid>/<key>?lastNObservations=12"
→ validate URL domain → write to ./statcan_<pid>.csv → print summary only
3. Follow-up script (analysis from local file):
rows = list(csv.DictReader(open("./statcan_<pid>.csv")))
→ filter / sort / aggregate → print only the result
get_sdmx_data on the hosted server always returns a download_csv URL instead of inline data — data stays out of the context window regardless of response size.
Claude Code (bash sandbox) uses the statcan CLI instead:
statcan search "labour force"
statcan metadata 14-10-0287-01 # run first to find dimension IDs
statcan download 14-10-0287-01 --key "1.1.1" --last 12 --output ./lfs.csv # run `statcan metadata <pid>` first to find real dimension IDs
awk -F',' 'NR>1 && $1=="Canada"' ./lfs.csv | sort -t',' -rn -k5 | head -10
MCP Prompts
The server ships five prompts accessible as slash commands in supported clients. Each has dual instructions — Claude Code (bash) and Claude.ai web (Python script).
Prompt
What it teaches
/statcan-data-lookup
End-to-end: search → structure → build key → fetch to local file → analyze
/sdmx-key-builder
SDMX key syntax: wildcards, OR keys, time parameters, download URL format
/statcan-download
Download a specific table: CLI commands + Python script alternative
/statcan-explore
Sample before committing: 3-period fetch, column layout, size estimate