About Toronto Open Data MCP Server
Toronto Open Data MCP Server gives LLM agents access to Toronto's public datasets through the CKAN API. It combines dataset discovery with data retrieval for both API and CSV sources.
Key features
- 01Search Toronto public datasets
- 02Retrieve API and CSV data
- 03Filter, sort, and select API fields
- 04Preview downloadable CSV files
- 05View dataset schemas
Use cases
- 01Find data about restaurant inspections
- 02Query Toronto datasets by fields or filters
- 03Preview data from downloadable CSV files
MCP support
Exposes tools for MCP clients to search and query Toronto Open Data, inspect schemas, and retrieve or preview dataset contents.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEToronto Open Data MCP Server
An MCP (Model Context Protocol) server that provides direct access to Toronto's Open Data through the CKAN API. This server allows LLM agents to efficiently discover, explore, and query Toronto's 500+ public datasets.
Features
- 🔍 Smart Dataset Discovery: Search through 500+ Toronto datasets with intelligent suggestions
- 🧠 Intelligent Data Helper: Automatically handles both API and CSV data sources
- 📊 Flexible Querying: Support for filtering, sorting, and field selection on API datasets
- 📁 CSV Support: Automatic fetching and preview of downloadable CSV datasets
- 🤝 LLM-Friendly: Designed for collaborative use with web search when additional context is needed
- ✅ Robust Error Handling: Clear error messages with actionable suggestions
Installation
Option 1: Using uvx (Recommended for MCP)
The easiest way to use this server with any MCP client:
brew install uv
# No installation needed! uvx will handle everything
# Just use in your MCP client configuration:
uvx toronto-open-data-mcp-server
Option 2: Development Installation
-
Clone the repository:
git clone https://github.com/yourusername/toronto-open-data-mcp-server.git cd toronto-open-data-mcp-server -
Install dependencies:
# Install main dependencies pip install -e . # Install test dependencies (optional) pip install -e ".[test]" -
Run the server:
python main.py
MCP Client Configuration
Using uvx (Easiest Method)
Add this to your MCP client configuration:
{
"mcpServers": {
"Toronto Open Data Server": {
"command": "uvx",
"args": ["toronto-open-data-mcp-server"]
}
}
}
Configuration File Locations
- Claude Desktop:
~/Library/Application Support/Claude/claude_desktop_config.json - Cursor: Check Cursor's MCP documentation for config location
- Other MCP clients: Refer to your client's documentation
Usage
Quick Start
The server provides several tools designed for LLM agents:
toronto_start_here()- Essential first call that explains the workflowtoronto_search_datasets(query)- Find relevant datasets by keywordstoronto_smart_data_helper(dataset_id, user_question)- Intelligent data retrievaltoronto_popular_datasets()- Quick access to commonly used datasets
Example Workflow
# 1. Start with guidance
toronto_start_here()
# 2. Search for relevant data
toronto_search_datasets("restaurant inspection")
# 3. Get data intelligently
toronto_smart_data_helper("dinesafe", "recent restaurant inspection failures")
# 4. Advanced filtering (if needed)
toronto_query_dataset_data("dinesafe",
filters={"establishment_status": "Conditional Pass"},
sort="inspection_date desc",
limit=10)
Popular Datasets
dinesafe- Restaurant inspections and health scorestraffic-signals- Traffic light locations and timingparks-facilities- Parks, pools, and recreation facilitiesbusiness-licences- Licensed businesses in Torontobuilding-permits- Construction and renovation permits
Testing
This project includes comprehensive tests covering unit tests, integration tests, and workflow tests.
Prerequisites
Install test dependencies:
pip install -e ".[test]"
Running Tests
Quick Test Commands
# Run unit tests only (recommended for development)
python run_tests.py
# Run with verbose output
python run_tests.py --verbose
# Run with coverage report
python run_tests.py --coverage
# Run integration tests (hits real Toronto API)
python run_tests.py --integration
# Run all tests (unit + integration)
python run_tests.py --all
API Reference
Core Tools
toronto_start_here() -> str
Essential first call that provides workflow guidance and server capabilities.
toronto_search_datasets(query: str, limit: int = 10) -> str
Search Toronto datasets by keywords.
toronto_smart_data_helper(dataset_id: str, user_question: str, limit: int = 10) -> str
Intelligent helper that automatically handles both API and CSV data sources.
toronto_query_dataset_data(dataset_id: str, filters: Dict = None, fields: List = None, limit: int = 10, sort: str = None) -> str
Advanced querying with filtering and sorting for API datasets.
Utility Tools
toronto_popular_datasets() -> str
Quick access to commonly used datasets.
toronto_get_dataset_schema(dataset_id: str) -> str
Get field names and types for API datasets.
toronto_fetch_csv_data(csv_url: str, max_lines: int = 50) -> str
Fetch and preview CSV file content.
Architecture
- FastMCP Framework: Built on the FastMCP framework for easy tool definition
- CKAN API: Direct integration with Toronto's CKAN-based Open Data portal
- Collaborative Design: Works alongside web search rather than replacing it
- Error Recovery: Intelligent error handling with actionable suggestions
Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Run the test suite:
python run_tests.py --all - Submit a pull request
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.