MCP
An MCP server for Statistics Canada data.
Connect an AI agent to every Statistics Canada table. Generate chart images ready to share.
Connect
Every client uses one server URL. No key or sign-in is needed.
https://statcan2.ca/api/mcpClaude
Settings → Connectors → Add custom connector. Paste the server URL.
Claude Code
claude mcp add --transport http statcan2 https://statcan2.ca/api/mcpChatGPT
Settings → Apps → Advanced settings → turn on Developer mode. Create an app, paste the server URL and choose No authentication. Needs a paid plan, on the web.
Codex
codex mcp add statcan2 --url https://statcan2.ca/api/mcpGemini CLI
gemini mcp add --transport http statcan2 https://statcan2.ca/api/mcpGrok
In the xAI Responses API, add this remote MCP tool.
{"type":"mcp","server_url":"https://statcan2.ca/api/mcp","server_label":"statcan2"}Le Chat
Intelligence → Connectors → Add connector → Custom MCP connector. Paste the server URL and choose no authentication.
Cursor
Add to ~/.cursor/mcp.json.
{"mcpServers":{"statcan2":{"url":"https://statcan2.ca/api/mcp"}}}VS Code · Copilot
code --add-mcp '{"name":"statcan2","type":"http","url":"https://statcan2.ca/api/mcp"}'Windsurf
Add to ~/.codeium/windsurf/mcp_config.json.
{"mcpServers":{"statcan2":{"serverUrl":"https://statcan2.ca/api/mcp"}}}OpenCode
Add to opencode.json.
{"mcp":{"statcan2":{"type":"remote","url":"https://statcan2.ca/api/mcp"}}}Run locally
Run the server over stdio from a checkout of this repo, with your own data build.
{"mcpServers":{"statcan2":{"command":"npm","args":["run","--silent","mcp"],"cwd":"<repo>/api","env":{"STATCAN_BUILD":"<data>/build","STATCAN_NORMALIZED":"<data>/normalized","STATCAN_CODESETS":"<data>/codeSets.json"}}}}Tools 10
search_tablesSearch the Statistics Canada table inventory by whitespace-separated terms; every term must match the table ID, title, dimension names, member names, or notes.q search words · archived archived or current · queryable only tables with data · limit page sizesearch_seriesSearch series (one line of a table: one vector, or one coordinate in Census tables).q search words · pid table ID · place_id place ID · unit_family unit type · limit page sizeget_placeGet a place: its level, schema and geo_code, every vintage of it (same schema and geo_code, e.g. Ontario 2011, 2016, 2021 DGUIDs), its parent, and every table that covers it, grouped by subject, with the member ID to filter on (m1), the number of series, and a citation per table.place_id place IDget_tableGet one table's metadata: title, official frequency, subject and survey names, dimensions with every member and its member ID, notes, corrections, symbol legend, and the build report.pid table IDget_seriesGet time series for a filter: one series per coordinate (the vector in WDS tables), each with member labels, unit, scale, period_kind, and points [ref_date, value_num, status, period_start, period_end].pid table ID · from start date · to end date · vector series ID · m1–m9 member ID per dimensionget_observationsGet observation rows for a filter, with member labels, place_id for dimension 1, unit_family, and period_start, period_end, period_kind.pid table ID · from start date · to end date · vector series ID · m1–m9 member ID per dimension · limit page size · offset rows to skipget_cubeGet a chartable table's dimensions, member IDs, roles, defaults, units, and period range.pid table IDrun_viewRun a chart spec across table layers.spec chart specrender_chartRender a chart spec as a 3200×1800 sharing PNG through the PNG API.spec chart specplan_chartTurn a question into an editable chart spec using the planner.q questionChart images
Use plan_chart to get a spec, then render_chart to generate a 3200×1800 PNG through the image API. The tool returns the image, download and chart URLs, and data build IDs. If your client does not display images, open the returned download URL.
Example prompts
- Compare food and gasoline inflation in Ontario over the past five years.
- Show unemployment rates for the Prairies and Atlantic Canada.
- Which Statistics Canada tables cover housing in Toronto?
- Render a shareable PNG of food inflation in Ontario over the past five years.