CensusMapper Documentation

MCP server

CensusMapper has an MCP server, so AI assistants such as Claude can look up census variables and regions, download census data, find existing CensusMapper maps, and draft new maps for you.

Connecting

The server address is:

https://censusmapper.ca/mcp

It uses the streamable HTTP transport. Add it to any MCP client that accepts a server URL.

Claude Code:

claude mcp add --transport http censusmapper https://censusmapper.ca/mcp

Claude (claude.ai or the desktop app): add a custom connector with the address above.

Most tools work without an API key (see below). To use your key, your client needs to send it in an X-Api-Key header. In Claude Code:

claude mcp add --transport http censusmapper https://censusmapper.ca/mcp \
  --header "X-Api-Key: YOUR_API_KEY"

Get your key from the API Access section of your profile. Don’t paste your key into a chat: the conversation may be stored, and the assistant doesn’t need to see it.

What works without a key

Without a key Needs a key
Listing datasets, searching variables and regions, browsing the variable hierarchy, estimating costs Region boundaries (GeoJSON)
Census data, for requests up to 200 API points Census data above 200 API points
Searching public maps, reading public maps and their R code Listing your own maps
  Creating and editing maps

A data request costs one point per region and variable, so 20 regions × 10 variables is 200 points. Boundaries cost 5 points per region (20 at high resolution). See API for your account’s quota.

Making maps with an assistant

With an API key, an assistant can create maps and edit your existing ones. This is off by default. To turn it on, go to API Access in your profile and switch on Let AI tools and scripts edit my maps with this token.

Even then, the assistant can only:

  • create private maps, and
  • change the content of your maps (variables, formula, colours, description).

It can’t publish, share or delete a map. You do that yourself in the map editor, which is also the place to check the draft before anyone else sees it. Each key can make up to 200 map changes per day.

Things to try

  • “What share of households in Montréal rent? Show me by census tract.”
  • “Find CensusMapper maps about commuting by bike.”
  • “Make a map of median household income by dissemination area for the Vancouver region in 2021.”
  • “Give me R code to reproduce this map: https://censusmapper.ca/maps/…”

The server tells the assistant to search for existing maps first and to point you to a few relevant ones at the end of its answer.

Tools

Tool What it does
list_datasets Lists the available census datasets (CA21, CA16, …)
search_variables Finds census variables (vectors) by keyword
search_regions Finds regions by name and returns their IDs
get_child_vectors Lists the variables below a variable in the hierarchy
estimate_cost Shows what a data request would cost in API points
get_census_data Downloads census values for regions
get_geo_boundaries Downloads region boundaries as GeoJSON
search_maps Searches public CensusMapper maps
get_map Reads a map’s settings
list_my_maps Lists your own maps, including private ones
create_map Creates a new private map
update_map Changes one of your maps
get_map_r_code Writes R code that downloads a map’s data with cancensus and recomputes it
get_skill Gives the assistant detailed guidance for making maps or analysing census data in R

A word of caution

Assistants make mistakes. Check numbers that matter against the map or the data itself. Map titles and descriptions are written by CensusMapper users; the assistant treats them as information, and their numbers haven’t been checked.