Connect
Connect MapleStats to your agent
The easiest way is to let your agent do it: paste one prompt and it installs the server and connects it. If you would rather do it yourself, it takes two steps by hand. Either way there is no account and no API key.
The easiest way: ask your agent The agent reads the setup steps from the repository, installs uv if it is missing, adds MapleStats to its own settings and tells you when to restart.
Install the MapleStats MCP server and connect it to this agent. Follow the setup steps in https://github.com/dsanchezp18/maplestats-mcp- Copy the prompt.
- Paste it into Claude Code, Codex, Cursor or any agent that can run commands on your computer.
- Restart the agent when it says so, then ask for data.
Or set it up by hand
01
Install uv
uv runs Python tools without a separate install step. Skip this if uv --version already works.
curl -LsSf https://astral.sh/uv/install.sh | sh
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.
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.
{
"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.
{
"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.
{
"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.
codex mcp add maplestats -- uvx maplestats-mcp
[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.
gemini mcp add -s user maplestats uvx maplestats-mcp
{
"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.
{
"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. For eight worked examples, from census microdata to credit-card pricing, see the case studies.
- 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 ?
Other ways to install
Install the command once
If you prefer a fixed install to uvx, install the command and point your client at maplestats-mcp directly.
# 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.
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
| Variable | Default | Purpose |
|---|---|---|
MAPLE_TRANSPORT | stdio | stdio for local clients, http for hosting |
MAPLE_HOST, MAPLE_PORT | 127.0.0.1, 8000 | HTTP bind address |
MAPLE_AUTH_TOKEN | unset | Bearer token required on /mcp when set |
MAPLE_REQUIRE_AUTH | 0 | Refuse to start without a token when 1 |
MAPLE_RATE_LIMIT_REQUESTS, MAPLE_RATE_LIMIT_WINDOW_SECONDS | 120, 60 | Per-client sliding-window rate limit |
MAPLE_MAX_CONCURRENT_REQUESTS | 8 | In-flight MCP requests; extra requests wait up to 5 s, then get HTTP 503 |
MAPLE_TOOL_TIMEOUT_SECONDS | 120 | Longest a tool call may run before it fails with a named error |
MAPLE_CACHE_MAX_ENTRIES | 2000 | Entries per cache bucket in memory |
MAPLE_PUMF_CACHE_DIR, MAPLE_PUMF_CACHE_MAX_GB | system temp, 5 | Where downloaded microdata is kept, and its size cap |
MAPLE_IP_HORIZONS_CACHE_DIR, MAPLE_IP_HORIZONS_CACHE_MAX_GB | system temp, 3 | Where CIPO patent tables are kept as Parquet, and the size cap |
MAPLE_SSL_CERTFILE, MAPLE_SSL_KEYFILE | unset | Terminate TLS in the server process |
MAPLE_TRUST_PROXY_HEADERS | 0 | Key rate limits on X-Forwarded-For; enable only behind a proxy that sets it |
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.
Two named volumes keep downloaded microdata and patent tables across restarts. The variables in the table above can be set the same way as the token.
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 fromwhich uvx(macOS, Linux) orwhere uvx(Windows) as the command, then restart the client. - A microdata or patent call times out
- The first
statcan_pumf_tabulatecall on a file downloads it, which can take a minute or two; later calls use the cache. RaiseMAPLE_TOOL_TIMEOUT_SECONDSif your connection is slow. - The agent does not use the tools
- Check that the client lists three MapleStats tools: plan_query, search_tools and call_tool. The rest are found through search, so they do not appear in the client's tool list.