Skip to main content

๐Ÿ mcp-canada

MCP server giving AI agents structured access to Canadian federal, provincial, and municipal government data

PyPI PyPI downloads CI Coverage 96% GitHub stars Python 3.12+ License: MIT MCP Compatible Built with FastMCP


295 tools, ~107 prompts, and ~141 resources across 9 federal APIs + 9 provincial APIs + 2 municipal APIs + 1 local SQLite datastore โ€” exchange rates, parliamentary data, product recalls, drug information, 80K+ open datasets, food nutrition data, real-time weather, immigration statistics, Ontario provincial data, Toronto municipal data, York Region ArcGIS Hub data, British Columbia CKAN + WFS geospatial data, Quebec Donnรฉes Quรฉbec CKAN + ArcGIS IQA data, Alberta open data + AER energy + WMBappServices wildfire + AHSGIS health + 511 Alberta transport, Manitoba geoportal (ArcGIS Hub) + 511 Manitoba transport, Saskatchewan geoportal (ArcGIS Hub) + WSA water infrastructure + SPSA fire bans, Nova Scotia Socrata SODA portal (data.novascotia.ca), New Brunswick federal-CKAN discovery + GeoNB bare ArcGIS Server geospatial data + gnb.socrata.com Socrata portal + key-gated 511 NB transport, and persistent local storage. All bilingual (English/French).

First ArcGIS Hub module โ€” shared infrastructure in shared/arcgis_hub.py is reusable for future Canadian municipal modules (BC, Calgary, Edmonton, and other cities publishing via ArcGIS Hub). First OGC WFS module โ€” BC introduces WFS 2.0 (OGC) support via shared/ogc.py, making WFS the third portal technology alongside CKAN and ArcGIS Hub. See docs://bc/wfs-query-guide for the CKANโ†’WFS two-step workflow.

Quick Start

# Auto-configure your platform (interactive)
uvx mcp-canada install

# Or name platforms directly
uvx mcp-canada install claude-desktop cursor vscode

Supports 14 platforms: Claude Desktop, Claude Code, Cursor, VS Code, Windsurf, Zed, Codex CLI, Gemini CLI, Amazon Q, OpenCode, Cline, Roo Code, Goose CLI, Junie CLI.

Manual Setup

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "mcp-canada": {
      "command": "uvx",
      "args": ["mcp-canada"]
    }
  }
}
Claude Code
claude mcp add mcp-canada -- uvx mcp-canada
From Source
git clone https://github.com/reyemtech/mcp-canada.git
cd mcp-canada
uv run mcp-canada

Options

Flag Description Example
--transport Transport protocol --transport sse
--port Port for SSE/HTTP --port 8000
--modules Load only specific modules --modules bank_of_canada,recalls
--verbose INFO-level logging --verbose
--debug DEBUG-level logging --debug

Environment variable: MCP_CANADA_MODULES=bank_of_canada,recalls

Examples

See the documentation site for cross-API intelligence scenarios โ€” from tracing prairie drought to the Canadian dollar, to building pharmaceutical safety audits, to assembling MP accountability briefs, to joining data from multiple APIs in a single SQL query. Each example includes the exact prompt and tool chain you can run today. The source remains in EXAMPLES.md.

How Discovery Works

With 250 tools, listing all of them would consume half an agent's context window. Instead, BM25 search lets agents find exactly what they need:

Agent: "What tools do you have for exchange rates?"

โ†’ discover_tools("exchange rate CAD")
โ†’ Returns: boc_get_exchange_rates, boc_get_observations

โ†’ call_tool("boc_get_exchange_rates", {"currency": "USD", "recent": 3})
โ†’ Returns: {"_meta": {...}, "data": [{"date": "2026-04-02", "value": 1.3918, ...}]}

Agents see 5 always-visible tools:

Tool Purpose
discover_tools BM25 natural language search across all tools
call_tool Execute any discovered tool by name
list_modules List available API modules with tool counts
plan_query Plan a multi-step query across Canadian government data APIs
execute_batch Run multiple tool calls in parallel with per-step error isolation

Modules

All tools accept lang: "en" | "fr" for bilingual support. Responses include a _meta envelope with source attribution and cache status. Browse the complete, searchable tool reference for current tool parameters and source APIs.

Module Level Tools Prompts Resources Description
Meta / Discovery โ€” 5 โ€” โ€” Always-visible orchestration tools (discover_tools, call_tool, list_modules, plan_query, execute_batch)
Bank of Canada Federal 8 5 7 Exchange rates, interest rates, commodity prices, inflation โ€” Valet API
CKAN Open Data Federal 7 5 7 80,000+ federal datasets โ€” open.canada.ca
Drug Database Federal 8 5 7 Drug products, ingredients, schedules โ€” Health Canada DPD
IRCC Immigration Federal 10 5 7 PR, study/work permits, Express Entry, asylum โ€” IRCC Open Data
Nutrient File Federal 8 5 7 Food nutrition data โ€” Canadian Nutrient File
Open Parliament Federal 10 5 7 Bills, MPs, votes, ballots, Hansard debates โ€” Open Parliament API
Recalls & Safety Federal 6 4 6 Food, vehicle, and health product recalls โ€” Healthy Canadians
Statistics Canada Federal 15 6 8 Time series, cube metadata, SDMX filtering โ€” StatCan WDS
Weather Federal 34 6 8 Conditions, climate, air quality, hydrology, marine, radar โ€” MSC GeoMet
Alberta Provincial 24 6 7 CKAN + AER energy + WMBappServices wildfire + AHSGIS health + 511 Alberta โ€” open.alberta.ca
British Columbia Provincial 20 6 7 CKAN + WFS geospatial โ€” BC Data Catalogue
Manitoba Provincial 20 6 7 ArcGIS Hub + 511 Manitoba โ€” geoportal.gov.mb.ca
Saskatchewan Provincial 13 6 7 ArcGIS Hub + WSA water + SPSA fire bans โ€” geohub.saskatchewan.ca
New Brunswick (new_brunswick/) Provincial 22 6 7 Federal CKAN + GeoNB bare ArcGIS Server + gnb.socrata.com Socrata + key-gated 511 NB transport โ€” geonb.snb.ca
Nova Scotia Provincial 16 6 7 Socrata SODA portal (aquaculture, environment, health) โ€” data.novascotia.ca
Ontario Provincial 6 4 6 3,000+ provincial datasets โ€” Ontario Open Data
Quebec Provincial 18 6 7 Federated CKAN (139 orgs) โ€” Donnรฉes Quรฉbec
Toronto Municipal 12 6 8 TTC, neighbourhoods, 311, RentSafe โ€” Toronto Open Data
York Region Municipal 27 5 8 4 ArcGIS Hub portals (York Region, Markham, Newmarket, Aurora)
Local Datastore Local 6 4 6 SQLite persistence for cross-API SQL JOINs โ€” ~/.mcp-canada/datastore.db
Total 295 ~107 ~141

Response Format

All tools return a consistent envelope:

{
  "_meta": {
    "source": {"api": "bank-of-canada-valet", "url": "https://..."},
    "cached": true,
    "lang": "en",
    "timestamp": "2026-04-04T12:00:00Z"
  },
  "data": [ ... ]
}

Errors return:

{
  "error": {
    "code": "INVALID_SERIES",
    "message": "Series 'FXXYZCAD' not found.",
    "suggestions": ["FXUSDCAD", "FXEURCAD"]
  }
}

Architecture

src/mcp_canada/
โ”œโ”€โ”€ server.py              # FastMCP entry point, transport, module loading
โ”œโ”€โ”€ shared/                # Cross-module utilities
โ”‚   โ”œโ”€โ”€ cache.py           # TTL-based in-memory cache (aiocache)
โ”‚   โ”œโ”€โ”€ envelope.py        # Response/error envelope (make_response/make_error)
โ”‚   โ”œโ”€โ”€ http.py            # Shared HTTP client with retry (tenacity)
โ”‚   โ”œโ”€โ”€ rate_limiter.py    # Per-source token bucket
โ”‚   โ””โ”€โ”€ i18n.py            # Bilingual error messages
โ”œโ”€โ”€ meta/
โ”‚   โ””โ”€โ”€ list_modules.py    # list_modules meta-tool
โ””โ”€โ”€ modules/
    โ”œโ”€โ”€ bank_of_canada/    # 8 tools โ€” Valet API
    โ”œโ”€โ”€ open_parliament/   # 10 tools โ€” Parliament API
    โ”œโ”€โ”€ recalls/           # 6 tools โ€” Healthy Canadians API
    โ”œโ”€โ”€ drug_database/     # 8 tools โ€” Health Canada DPD
    โ”œโ”€โ”€ ckan/              # 7 tools โ€” Open Data Portal
    โ”œโ”€โ”€ nutrient_file/     # 8 tools โ€” Canadian Nutrient File
    โ”œโ”€โ”€ datastore/         # 6 tools โ€” local SQLite persistence
    โ”œโ”€โ”€ ircc/              # 10 tools โ€” IRCC Immigration Open Data
    โ”œโ”€โ”€ ontario/           # 6 tools โ€” Ontario Open Data Catalogue
    โ”œโ”€โ”€ toronto/           # 12 tools โ€” City of Toronto Open Data Portal
    โ”œโ”€โ”€ york_region/       # 27 tools โ€” York Region ArcGIS Hub (4 portals)
    โ”œโ”€โ”€ british_columbia/  # 20 tools โ€” BC Data Catalogue + WFS
    โ”œโ”€โ”€ manitoba/          # 20 tools โ€” geoportal.gov.mb.ca ArcGIS Hub + 511 Manitoba
    โ”œโ”€โ”€ saskatchewan/      # 13 tools โ€” geohub.saskatchewan.ca ArcGIS Hub + WSA water + SPSA fire bans
    โ”œโ”€โ”€ quebec/            # 18 tools โ€” Donnรฉes Quรฉbec CKAN
    โ”œโ”€โ”€ alberta/           # 24 tools โ€” open.alberta.ca CKAN + AER + WMB + AHSGIS + 511
    โ”œโ”€โ”€ nova_scotia/       # 16 tools โ€” data.novascotia.ca Socrata SODA
    โ”œโ”€โ”€ statcan/           # 15 tools โ€” Statistics Canada WDS + SDMX
    โ””โ”€โ”€ weather/           # 34 tools โ€” MSC GeoMet OGC API
        โ”œโ”€โ”€ current/       # 5 tools โ€” realtime conditions, forecast, alerts
        โ”œโ”€โ”€ climate/       # 7 tools โ€” daily/monthly/normals/trends
        โ”œโ”€โ”€ aqhi/          # 3 tools โ€” air quality health index
        โ”œโ”€โ”€ hydro/         # 5 tools โ€” water levels, flow, flood risk
        โ”œโ”€โ”€ marine/        # 3 tools โ€” marine forecasts, hurricane tracks
        โ”œโ”€โ”€ severe/        # 3 tools โ€” radar, lightning, UV index
        โ”œโ”€โ”€ snow/          # 2 tools โ€” snow depth, snow water equivalent
        โ”œโ”€โ”€ collections/   # 2 tools โ€” collection browser and direct query
        โ””โ”€โ”€ summary/       # 4 tools โ€” composite summary, extremes, growing season, degree days

Each module follows a 7-file pattern:

File Purpose
__init__.py Module name and description
constants.py Base URL, rate limits, cache TTLs, API mappings
schemas.py Pydantic v2 response models (always flat)
client.py Async HTTP functions with caching and rate limiting
tools.py @tool decorated MCP tool functions
prompts.py @prompt functions โ€” guided workflows + quick lookups
resources.py @resource functions โ€” catalogs, docs, templates

New modules are auto-discovered โ€” drop a folder in modules/ and it registers via FileSystemProvider.

Development

# Install dependencies
uv sync

# Run tests (~2000 unit tests, ~15s)
uv run pytest

# Run integration tests against live APIs (~2min)
uv run pytest tests/integration/ -v -m integration --timeout=120

# Type check and lint
uv run pyright
uv run ruff check src/ tests/

# Coverage (must be โ‰ฅ95%)
uv run pytest --cov=src/mcp_canada --cov-fail-under=95

Contributing

Each module is self-contained. To add a new API:

  1. Create src/mcp_canada/modules/your_api/ with the 7-file pattern
  2. Add colocated __tests__/ with unit tests
  3. Add integration tests in tests/integration/test_tool_scenarios.py
  4. Add a module doc in docs/modules/ and update the Modules table in this README

See CLAUDE.md for coding conventions.

Changelog

See CHANGELOG.md for version-by-version changes, or browse GitHub Releases.

Security

Found a vulnerability? Please do not open a public issue. Email contact@reyem.tech with details and reproduction steps. We support the latest minor version on PyPI.

Community

License

MIT โ€” Reyem Tech

Data Attributions

Data from the following government sources is accessed by this library subject to their respective licences:

Star History

Star History Chart

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_canada-0.12.0.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_canada-0.12.0-py3-none-any.whl (600.7 kB view details)

Uploaded Python 3

File details

Details for the file mcp_canada-0.12.0.tar.gz.

File metadata

  • Download URL: mcp_canada-0.12.0.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mcp_canada-0.12.0.tar.gz
Algorithm Hash digest
SHA256 f72ee9a0195eedf3c70b1edf94cfb96768d5773b399b7b182fe6beef72776655
MD5 5f223b5ce20ff1f71f4c984e3e9c9981
BLAKE2b-256 c8db88fec76b1f06a985c2d64cc31d7b2c5a4fb9435af046e6640d68f79d7dfc

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_canada-0.12.0.tar.gz:

Publisher: release.yml on ReyemTech/mcp-canada

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_canada-0.12.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_canada-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 600.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mcp_canada-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2e1d3999f363ecdd9059a20a693fd515465d6e790b417b66781bfa1edc9ec59
MD5 074f42e935eb87004abc9bc2293d4ca9
BLAKE2b-256 33bfd1bcba1db76a8fa156f3e6f311d0802faeada26bc0a28749b308cde44e37

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_canada-0.12.0-py3-none-any.whl:

Publisher: release.yml on ReyemTech/mcp-canada

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.12.0 This release

2 files

0.11.0

2 files

0.10.4

2 files

0.10.3

2 files

0.10.2

2 files

0.10.1

2 files

0.10.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page