MapleStatsMCP

Connect

Connect MapleStats to your agent

Use the hosted server: add one address to your client, or paste one prompt and let your agent add it. It needs no install, account or API key. To keep everything on your machine, run it locally. You can also try the chat demo in your browser first.

The easiest way: ask your agent It reads the setup steps from the repository, adds the hosted server to its settings and tells you when to restart.

Connect the MapleStats MCP server to this agent. Follow the setup steps in https://github.com/dsanchezp18/maplestats-mcp
  1. Copy the prompt.
  2. Paste it into Claude Code, Codex, Cursor or any agent that can run commands on your computer.
  3. Restart the agent when it says so, then ask for data.

Recommended: no install

Use the hosted server

A public copy runs at https://mcp.maplestats.danielstats.io/mcp. Any client that supports remote (HTTP) MCP servers can use it, with no account or token.

The maintainer pays for the hosted server. Limits: 60 requests a minute per client, and a tool call can run for up to 230 seconds before it is stopped. The first microdata table from a file (statcan_pumf_tabulate) downloads that file and can time out; a retry a few minutes later uses the copy the server kept. For heavier use, install it locally: a local copy has no limit of its own beyond each publisher's.

Your agent's tool calls, such as a search phrase or a table number, reach the server and its host. The code keeps no log of them, but its in-memory cache can hold a search phrase until the entry expires or the server restarts (see the FAQ). The host, Microsoft Azure, keeps its own logs; see Microsoft's terms and privacy policy. For full privacy, install it locally.

What a result contains. Every result carries a provenance block: the source, the exact URL it was read from, when it was queried, the publisher's licence and whether it allows commercial use, plus any limits and fitness-for-use cautions. A Statistics Canada series adds a ready-to-quote citation (table, vector, release date) and its reference period, unit and scale, geography and a link to the table's page; quality flags such as "use with caution" stay on each value. A figure that is not published comes back as a plain no with the closest published figure, not as a guess. By default the result is brief: the values, the citation, the flags, caveats and limits, with long lists of rows as CSV text; detail="full" on call_tool returns the complete provenance block (query time, cache, schema) and every field.

To get better habits from your agent, give it the instruction file (Agent Skills format) as well: it tells the agent to plan first, ask for the latest periods, read the caveats, cite the table and vector, and check its figures before answering.

Claude Code
claude mcp add --transport http --scope user maplestats https://mcp.maplestats.danielstats.io/mcp
Codex CLI
codex mcp add maplestats --url https://mcp.maplestats.danielstats.io/mcp
Cursor, VS Code and other JSON clients
{
  "mcpServers": {
    "maplestats": {
      "url": "https://mcp.maplestats.danielstats.io/mcp"
    }
  }
}

VS Code uses "servers" in place of "mcpServers" and needs "type": "http". Check it is up with curl https://mcp.maplestats.danielstats.io/health.

Claude (claude.ai and Claude Desktop)

  1. On claude.ai or in Claude Desktop, open Customize, then Connectors.
  2. Click Add, then Add custom connector.
  3. Enter a name, such as MapleStats, and the address https://mcp.maplestats.danielstats.io/mcp, then click Continue.
  4. If Claude asks how to authenticate, choose No sign in, then click Add. The server needs no OAuth client or header.
  5. In a chat, click the + button, then Connectors, and switch MapleStats on for that chat.

Custom connectors work on the Free (one connector), Pro, Max, Team and Enterprise plans. Claude connects from Anthropic's servers instead of your computer, so the address must be public, as this one is. Claude asks before each tool call by default. Every hosted MapleStats tool is read-only, so you can set them to always allow in the connector's tool permissions. Anthropic's guide to custom connectors has the current menu names.

ChatGPT (web)

  1. Turn on developer mode under Settings, then Apps, then Advanced settings, then Developer mode, or while creating the app in the next step.
  2. Under Settings, then Apps, click Create.
  3. Enter a name, such as MapleStats, and the address https://mcp.maplestats.danielstats.io/mcp. For authentication, choose No authentication.
  4. Click Scan Tools, wait for the scan, then click Create. The app appears under Enabled Apps with a Dev label.
  5. In a new chat, pick the MapleStats app from the tools menu, or mention it in your question.

Custom apps work in ChatGPT on the web only; the mobile apps do not support them. Pro accounts can connect read-only tools in developer mode, which covers every hosted MapleStats tool. Business, Enterprise and Edu workspaces get full MCP support once an admin turns on developer mode (see below). OpenAI's article on developer mode does not mention Plus, so check your plan there. OpenAI changes these menus often, so your labels may differ from those above.

Microsoft 365 Copilot (work account)

Check with your employer first. Microsoft 365 Copilot runs in your organization's tenant, and your IT department decides what it may connect to. MapleStats sends your agent's questions (search phrases, table numbers) to a server outside your organization, so confirm that your employer's policies allow outside AI tools before you add it. Your admins may also have turned off Copilot Studio, custom agents or outside connectors. If a step below is missing or blocked, your IT department chose that: ask them instead of looking for a way around it.

Copilot Chat does not take an MCP address directly. You build a small agent in Copilot Studio that uses MapleStats, then open it in Copilot Chat.

  1. At copilotstudio.microsoft.com, create an agent, for example MapleStats, and check that generative orchestration is on (MCP tools need it).
  2. Open the agent's Tools page, then Add a tool, then New tool, then Model Context Protocol.
  3. Enter a server name (MapleStats), a short description (Canadian official statistics), and the server URL https://mcp.maplestats.danielstats.io/mcp. For authentication, choose None, then click Create.
  4. In the Add tool dialog, create a new connection, then click Add to agent. Try a question in the test pane before publishing.
  5. Publish the agent. Then open Channels, choose Microsoft 365 and Microsoft Teams, make sure Make agent available in Microsoft Copilot is selected, and click Add channel.
  6. In Microsoft 365 Copilot Chat, type @, pick the MapleStats agent, and ask your question.

Building agents in Copilot Studio depends on your organization's licences and settings as well as your own Copilot seat. MCP tools go through Power Platform connectors, so your admins' data policies apply to them. To share the agent, use Availability options: share it with chosen colleagues, or submit it to the org catalog for an admin to approve in the Teams admin center. Microsoft renames these menus often. Its guides to connecting an agent to an existing MCP server and publishing to Teams and Microsoft 365 Copilot have the current labels.

With Claude, ChatGPT or Copilot, the first request after an idle spell can be slow. Opening the address in a browser shows a "Missing session ID" error; that is expected, since only MCP clients can use it.

For a whole organization: on Claude Team or Enterprise, an Owner adds the address once under Organization settings, then Connectors, then Add custom connector; each member then connects it from their own Connectors settings. On ChatGPT Business, Enterprise or Edu (web), a workspace admin turns on developer mode under Workspace settings, then Permissions & Roles, then Connected Data, creates the app with no authentication, and publishes it under Workspace settings, then Apps, then Drafts, with Publish. The hosted server is shared, and its 60-request limit applies per client address, so a large organization should run its own copy.

For analysts

Use it from R, Python or Julia

Three small clients call the hosted server from a script, with no agent in between, and return each result as a data frame with its citation. They are not on CRAN, PyPI or the Julia registry yet; install them from GitHub.

  • R: results as tibbles.
  • Python: results as polars data frames.
  • Julia: results as DataFrames.
R
pak::pak("dsanchezp18/maplestats-mcp/clients/r")
Python
pip install "git+https://github.com/dsanchezp18/maplestats-mcp#subdirectory=clients/python"
Julia
using Pkg
Pkg.add(; url="https://github.com/dsanchezp18/maplestats-mcp", subdir="clients/julia")

Or run it on your machine

01

Install uv

uv runs Python tools without a separate install step. Skip this if uv --version already works.

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"

02

Add the server to your client

Pick your client. Each entry runs uvx maplestats-mcp, which downloads the server the first time and reuses it afterwards.

Claude Code

Run this once in a terminal. --scope user makes the server available in every project; leave it out to add it to the current project only.

Terminal
claude mcp add --scope user maplestats -- uvx maplestats-mcp

Claude Desktop

In Claude Desktop, open Settings, then Developer, then Edit Config. Add the server to the file that opens, save it and restart Claude.

claude_desktop_config.json
{
  "mcpServers": {
    "maplestats": {
      "command": "uvx",
      "args": ["maplestats-mcp"]
    }
  }
}

The file lives at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS and %APPDATA%\Claude\claude_desktop_config.json on Windows.

Cursor

The link opens Cursor with the entry filled in. To add it by hand, put it in ~/.cursor/mcp.json for every project, or in .cursor/mcp.json for one project.

~/.cursor/mcp.json
{
  "mcpServers": {
    "maplestats": {
      "command": "uvx",
      "args": ["maplestats-mcp"]
    }
  }
}

VS Code

To add it by hand, note that VS Code uses a servers key, not mcpServers. Put this in .vscode/mcp.json in a workspace, or run MCP: Open User Configuration from the Command Palette to add it for every workspace.

.vscode/mcp.json
{
  "servers": {
    "maplestats": {
      "type": "stdio",
      "command": "uvx",
      "args": ["maplestats-mcp"]
    }
  }
}

Codex CLI

Add it from the terminal, or write the same entry into ~/.codex/config.toml yourself.

Terminal
codex mcp add maplestats -- uvx maplestats-mcp
~/.codex/config.toml
[mcp_servers.maplestats]
command = "uvx"
args = ["maplestats-mcp"]

Gemini CLI

Add it from the terminal (-s user for every project), or write the entry into ~/.gemini/settings.json next to any settings already there.

Terminal
gemini mcp add -s user maplestats uvx maplestats-mcp
~/.gemini/settings.json
{
  "mcpServers": {
    "maplestats": {
      "command": "uvx",
      "args": ["maplestats-mcp"]
    }
  }
}

Other clients

Most MCP clients accept this mcpServers entry. If you installed the command with uv tool install or pip, use "command": "maplestats-mcp" and drop args.

JSON
{
  "mcpServers": {
    "maplestats": {
      "command": "uvx",
      "args": ["maplestats-mcp"]
    }
  }
}

03

Ask a question

Restart the client if it was open, then ask for data. Naming the source is optional; asking for citations makes the agent quote each provenance block. The demos have nine worked examples, from census microdata to credit-card pricing.

  • What was the year-over-year change in Canada's consumer price index last month? Cite the table.
  • Compare the average rent of a two-bedroom apartment in Calgary and Edmonton since 2020, using CMHC data.
  • Using the Labour Force Survey public use microdata, estimate the employment rate by province, with its survey weights.
  • Quel est le taux directeur de la Banque du Canada, et depuis quand est-il à ce niveau ?

The instruction file for your agent, described under the hosted server, works the same with a local one.

Other ways to install

Install the command once

For a fixed install instead of uvx, install the command and point your client at maplestats-mcp.

Terminal
# with uv (upgrade later with: uv tool upgrade maplestats-mcp)
uv tool install maplestats-mcp

# or with pip
pip install maplestats-mcp

# or the development version, from GitHub
uv tool install git+https://github.com/dsanchezp18/maplestats-mcp.git

Hosting

Run it as an HTTP server

For a shared deployment, set the transport to HTTP. If the server is reachable beyond your machine, set a bearer token and require it. GET /health reports uptime and version and skips authentication.

Terminal
MAPLE_TRANSPORT=http MAPLE_HOST=0.0.0.0 MAPLE_PORT=8000 \
MAPLE_AUTH_TOKEN="$(openssl rand -hex 32)" MAPLE_REQUIRE_AUTH=1 \
uvx maplestats-mcp
All environment variables
Environment variables for a hosted server
VariableDefaultPurpose
MAPLE_TRANSPORTstdiostdio for local clients, http for hosting
MAPLE_HOST, MAPLE_PORT127.0.0.1, 8000HTTP bind address
MAPLE_AUTH_TOKENunsetBearer token required on /mcp when set
MAPLE_REQUIRE_AUTH0Refuse to start without a token when 1
MAPLE_RATE_LIMIT_REQUESTS, MAPLE_RATE_LIMIT_WINDOW_SECONDS120, 60Per-client sliding-window rate limit
MAPLE_MAX_CONCURRENT_REQUESTS8In-flight MCP requests; extra requests wait up to 5 s, then get HTTP 503
MAPLE_MAX_REQUESTS_PER_CLIENT0In-flight MCP requests one client (an IPv6 /64) may hold, then HTTP 429; 0 is off. Leave it off where many people share an address
MAPLE_TOOL_TIMEOUT_SECONDS120Longest a tool call may run before it fails with a named error
MAPLE_BREAKER1Pause requests to an upstream host after repeated failures; 0 sends every request
MAPLE_BREAKER_FAILURES, MAPLE_BREAKER_WINDOW_SECONDS, MAPLE_BREAKER_COOLDOWN_SECONDS5, 300, 60Failures in a row, within the window, that pause a host, and how long before one probe request is sent
MAPLE_ALLOWED_ORIGINSproject website, localhostBrowser origins allowed on /mcp, comma-separated (https://*.office.com for an Office add-in); other origins get HTTP 403, clients that send no origin are allowed
MAPLE_CACHE_MAX_ENTRIES2000Entries per cache bucket in memory
MAPLE_CACHE_MAX_MB128Estimated memory cap for the whole cache
MAPLE_LAST_GOOD_MB32Memory for the last good copy of each result, served (with its date) when a refresh meets a bot check; 0 turns it off
MAPLE_PARSE_WORKERS, MAPLE_PARSE_TIMEOUT_SECONDS4, 60Threads that read Excel and CSV files, and the longest one file may take
MAPLE_OCR, MAPLE_OCR_MEMORY_MB0, 10241 lets statcan_reference_get_section_text read the pages of a scanned PDF by OCR (when StatCan serves the guide: since November 2026 its site has answered scripts with a captcha). It needs the ocr extra and the tesseract program (the Docker image has both); without them those pages come back empty with a note. One page at a time, 10 pages a call at most. The memory value caps the tesseract process (enforced on Linux)
MAPLE_DUCKDB_MEMORY_LIMITunsetMemory limit for DuckDB queries over downloaded files (patents, open databases, microdata), such as 256MB; beyond it DuckDB spills to the temporary folder. Set it on a small hosted instance
MAPLE_DUCKDB_TEMP_DIR, MAPLE_DUCKDB_TEMP_MAX_GBsystem temp, 1Where DuckDB spills past its memory limit, one subfolder per query removed when it ends, and the most one query may spill
MAPLE_QUERY_MEMORY_MB, MAPLE_QUERY_MAX_CONCURRENT256, 2wds_query_series runs each SQL query in its own process: the memory it may use (enforced on Linux), and how many run at once
MAPLE_PUMF_CACHE_DIR, MAPLE_PUMF_CACHE_MAX_GBsystem temp, 5Where downloaded microdata is kept, and its size cap
MAPLE_STATCAN_FALLBACK1When StatCan's Web Data Service answers a series request with the Cloudflare challenge (and no last good copy is held), answer from another official source, labelled in provenance: StatCan's CCEI and shared SDMX spaces, the Bank of Canada's Valet API or the Alberta Economic Dashboard; StatCan is always asked first; 0 turns the substitutes off
MAPLE_PUMF_TABULATE10 switches off statcan_pumf_tabulate, which downloads whole microdata files; search, file lists and codebooks stay
MAPLE_QUERY_SERIES1 locally, 0 over HTTP0 switches off wds_query_series (server-side SQL over a few series). Off by default over HTTP, since one query could exceed a small instance's memory
MAPLE_GIS10 hides the 14 geospatial tools whose product is a shape, a map layer, a grid or a geocoding result (BC Geographic Warehouse, census boundaries, climate-projection grids, burned-area polygons, place names, fire perimeters), so one install can run as a statistics-only server. Tools that serve rows or figures from a map service (ArcGIS Hub, ECCC observations, fire points) stay. Nothing is hidden by default
MAPLE_PRELOAD0 locally, 1 over HTTP1 imports every module and builds the search index at startup, before the port opens, so the first calls after a start are not slow. Off locally, so desktop clients start fast
MAPLE_LODE_CACHE_DIR, MAPLE_LODE_CACHE_MAX_GBsystem temp, 3Where StatCan open-database (LODE) files are unpacked, and the size cap
MAPLE_LODE_MAX_DOWNLOAD_MB300Largest open-database archive one call may download; 0 turns downloads off
MAPLE_DELTA_MAX_SCAN_MB, MAPLE_DELTA_MAX_SCAN_SECONDS400, 75How much of a Delta File one statcan_delta_read_table call streams, in size and time (the time stays 30 s under the tool timeout)
MAPLE_DELTA_INDEX_DIRsystem tempWhere Delta File resume points are saved (a few MB a day); off keeps them in memory only
MAPLE_IP_HORIZONS_CACHE_DIR, MAPLE_IP_HORIZONS_CACHE_MAX_GBsystem temp, 3Where CIPO patent tables are kept as Parquet, and the size cap
MAPLE_CBSA_TARIFF_CACHE_DIRsystem tempWhere Customs Tariff editions are kept as Parquet (under 1 MB each)
MAPLE_CENSUS_CACHE_DIRsystem tempWhere census profile values are kept between restarts (one file of at most 8 MB, each value 14 days); off keeps them in memory only. Use a persistent volume when hosted
MAPLE_ON_FIR_CACHE_DIR, MAPLE_ON_FIR_CACHE_MAX_MBsystem temp, 500Where Ontario Financial Information Return years are kept as Parquet, and the size cap
MAPLE_EXPORT_DIRunset (no files saved)Folder where reproduce_workbook saves Excel workbooks on a local server; unset, every tool is read-only
MAPLE_GOATCOUNTER_URLunsetAn https GoatCounter site; with MAPLE_GOATCOUNTER_TOKEN also set, each counted tool call is sent there as the event mcp/<instance>/<tool>, in batches each minute, never with arguments or addresses
MAPLE_GOATCOUNTER_TOKENunsetA GoatCounter API token allowed to record pageviews
MAPLE_INSTANCE_NAMEserverThe <instance> label in those events, such as azure or render
MAPLE_OPENAI_APPS_CHALLENGEunsetToken served as plain text at /.well-known/openai-apps-challenge (no token needed), which OpenAI's plugin portal reads to verify the domain; unset, that path answers 404
MAPLE_USAGE_STATS1Counts calls and durations per tool name, and upstream errors per host, at /stats, in memory; 0 turns the counts off
MAPLE_USAGE_STATS_FILEunsetA JSON file where the /stats call counts are kept, read at startup and saved every minute and on exit, so a restart does not reset them; put it on a persistent volume
MAPLE_INTERNAL_TOKENunsetA secret that marks your own calls in the /stats counts: a client that sends it in an X-Maple-Internal header is counted as internal, so your use does not mix with other people's. Other calls are labelled by kind of client; neither the client's name nor the token is stored
MAPLE_SSL_CERTFILE, MAPLE_SSL_KEYFILEunsetTerminate TLS in the server process
MAPLE_TRUST_PROXY_HEADERS0Key rate limits on X-Forwarded-For; enable only behind a proxy that sets it
MAPLE_TRUSTED_PROXY_HOPS1Proxies that append to X-Forwarded-For; the client address is read that many entries from the right
MAPLE_CLIENT_IP_HEADERunsetHeader the outermost proxy sets to the caller's own address (Cloudflare's CF-Connecting-IP), used for the per-client rate limit when MAPLE_TRUST_PROXY_HEADERS is on; set it only when every request passes through that proxy

Hosting

Run it with Docker

The repository ships a Dockerfile and a docker-compose.yml that serve HTTP on port 8000. The compose file sets MAPLE_REQUIRE_AUTH=1, so the container refuses to start until MAPLE_AUTH_TOKEN is set. Keep the token: clients send it as Authorization: Bearer to http://localhost:8000/mcp.

Three named volumes keep downloaded microdata, patent tables and open-database (LODE) files across restarts. Set the variables in the table above the same way as the token.

Terminal
git clone https://github.com/dsanchezp18/maplestats-mcp
cd maplestats-mcp
export MAPLE_AUTH_TOKEN="$(openssl rand -hex 32)"
echo "$MAPLE_AUTH_TOKEN"
docker compose up -d --build
curl http://localhost:8000/health

Troubleshooting

When something does not connect

The client cannot find uvx
Desktop apps do not always read your shell's PATH. Use the full path from which uvx (macOS, Linux) or where uvx (Windows) as the command, then restart the client.
A microdata or patent call times out
The first statcan_pumf_tabulate call on a file downloads it, which can take a minute or two; later calls use the cache. Raise MAPLE_TOOL_TIMEOUT_SECONDS if your connection is slow.
The agent does not use the tools
The client should list three MapleStats tools: plan_query, search_tools and call_tool. The others are reached through search and do not appear in that list.