Skip to main content

MCP server for Ontario Open Data Catalogue

Project description

ontario-data-mcp

MCP server for searching, downloading, and analyzing datasets from Ontario's Open Data Catalogue. Caches data locally in DuckDB for fast SQL queries, statistical analysis, and geospatial operations.

Installation

With Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "ontario-data": {
      "command": "uvx",
      "args": ["ontario-data-mcp"]
    }
  }
}

Config file location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

With Claude Code

claude mcp add ontario-data -- uvx ontario-data-mcp

With VS Code

Add to .vscode/mcp.json:

{
  "mcpServers": {
    "ontario-data": {
      "command": "uvx",
      "args": ["ontario-data-mcp"]
    }
  }
}

From Source

git clone https://github.com/sprine/ontario-data-mcp
cd ontario-data-mcp
uv sync
uv run ontario-data-mcp

Tools

Discovery (6 tools)

Tool Description
search_datasets Search for datasets by keyword
list_organizations List Ontario government ministries with dataset counts
list_topics List all tags/topics in the catalogue
get_popular_datasets Get popular or recently updated datasets
search_by_location Find datasets covering a specific geographic area
find_related_datasets Find datasets related by tags and organization

Metadata (4 tools)

Tool Description
get_dataset_info Get full metadata for a dataset including all resources
list_resources List all files in a dataset with formats and sizes
get_resource_schema Get column schema and sample values for a datastore resource
compare_datasets Compare metadata side-by-side for multiple datasets

Retrieval & Caching (4 tools)

Tool Description
download_resource Download a resource and cache it locally in DuckDB (returns staleness info if already cached)
cache_info Cache statistics + list all cached datasets with staleness
cache_manage Remove single resource, clear all, or refresh (action enum)
refresh_cache Re-download cached resources with latest data

Querying (4 tools)

Tool Description
query_resource Query a resource via CKAN Datastore API (remote)
sql_query Run SQL against the CKAN Datastore (remote)
query_cached Run SQL against locally cached data in DuckDB
preview_data Quick preview of first N rows of a resource

Data Quality (3 tools)

Tool Description
check_data_quality Analyze nulls, type consistency, duplicates, outliers
check_freshness Check if a dataset is current vs. its update schedule
profile_data Statistical profile using DuckDB SUMMARIZE

Geospatial (3 tools)

Tool Description
load_geodata Cache a geospatial resource (SHP, KML, GeoJSON) into DuckDB
spatial_query Run spatial queries against cached geospatial data
list_geo_datasets Find datasets containing geospatial resources

Prompts

Context-aware guided workflow prompts:

  • explore_topic — Guided exploration of a topic (fetches live catalogue context)
  • data_investigation — Deep dive into a specific dataset: schema, quality, statistics
  • compare_data — Side-by-side analysis of multiple datasets

Resources

  • ontario://cache/index — List all locally cached datasets with freshness info
  • ontario://dataset/{dataset_id} — Full metadata for a specific dataset
  • ontario://portal/stats — Overview statistics about the Ontario Data Catalogue
  • ontario://guides/duckdb-sql — DuckDB SQL reference with tips for Ontario data analysis

Environment Variables

Variable Default Purpose
LOG_LEVEL WARNING Python logging level
ONTARIO_DATA_CACHE_DIR ~/.cache/ontario-data DuckDB storage + log file location
ONTARIO_DATA_TIMEOUT 30 HTTP timeout in seconds
ONTARIO_DATA_RATE_LIMIT 10 Max CKAN requests per second

How It Works

  1. Search the Ontario Data Catalogue using CKAN API tools
  2. Download resources into a local DuckDB database for fast access
  3. Query cached data with full DuckDB SQL (time series, correlations, pivots, window functions)
  4. Analyze with statistical profiling, data quality checks, and geospatial queries

Data is cached at ~/.cache/ontario-data/ontario_data.duckdb. No API keys required — the Ontario Data Catalogue is fully public.

Development

uv sync
uv run python -m pytest tests/ -v

License

MIT

Project details


Download files

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

Source Distribution

ontario_data_mcp-0.1.5.tar.gz (121.0 kB view details)

Uploaded Source

Built Distribution

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

ontario_data_mcp-0.1.5-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file ontario_data_mcp-0.1.5.tar.gz.

File metadata

  • Download URL: ontario_data_mcp-0.1.5.tar.gz
  • Upload date:
  • Size: 121.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.9

File hashes

Hashes for ontario_data_mcp-0.1.5.tar.gz
Algorithm Hash digest
SHA256 d3dfbd268e628d057bea27c5e81d7117a3f740df43d277ed3804b3b050f9b331
MD5 48fa19d633a37d0fd35c8a9ca2bc84be
BLAKE2b-256 7ca798073bb3f3780d8ec87e08d5c5d78a07f2a2d0cdb72c9e2c5adb98f8d380

See more details on using hashes here.

File details

Details for the file ontario_data_mcp-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for ontario_data_mcp-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5c50b0fdf4dc30fe985c3ba194fe7e45abaed1d8df8ae640f19807674d2edfd4
MD5 6d1b022407853169a6f552aa57d5d898
BLAKE2b-256 14d9ddcab3966a7bdab2322cb0b094a3337fa8c81b41c45277a30b2e4695ddd6

See more details on using hashes here.

Supported by

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