Toronto Open Data Tools
About
Query, analyze, and retrieve datasets from Toronto's CKAN-powered open data portal.
Details
- Author
- toronto-inc
- Categories
- Database, Other, API
Jump to
Setup
Install Toronto Open Data Tools in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/toronto-inc/toronto-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
Toronto MCP Server: Toronto Open Data Tools
This project implements a Model Context Protocol (MCP) server for Toronto Open Data, deployable on Cloudflare Workers. It exposes a comprehensive set of tools for intelligently querying, analyzing, and retrieving datasets from Toronto's CKAN-powered open data portal, making them accessible to MCP-compatible clients like Claude Desktop, Cursor, and other AI assistants.
Deployed at:https://toronto-mcp.s-a62.workers.dev
- SSE Endpoint:https://toronto-mcp.s-a62.workers.dev/sse(for Claude Desktop)
- MCP Endpoint:https://toronto-mcp.s-a62.workers.dev/mcp(for other clients)
- Provides a remote MCP serverexposing tools for Toronto's Open Data via the CKAN API
- Intelligently discovers relevant datasetsusing advanced relevance scoring
- Analyzes data freshness patternswith comprehensive update frequency tracking
- Provides deep data structure insightsincluding field analysis and schema information
- Enables natural language queryingof Toronto's 500+ open datasets
- Supports comprehensive data analysiscombining multiple analytical dimensions
- list_datasets: List all available datasets
- search_datasets: Search datasets by keyword
- get_package: Retrieve complete metadata for a dataset
- get_first_datastore_resource_records: Get records from the first active resource
- get_resource_records: Get records from a specific resource by ID
- find_relevant_datasets: Intelligently find and rank datasets using relevance scoring (title, description, tags, organization)
- analyze_dataset_updates: Analyze update frequencies with categorization (daily, weekly, monthly, quarterly, annually, irregular)
- analyze_dataset_structure: Deep-dive into dataset structure with field definitions, data types, record counts, and optional data previews
- get_data_categories: Explore all available organizations and topic groups
- get_dataset_insights: Comprehensive analysis combining relevance ranking, update frequency, and data structure insights
- "What traffic data is available in Toronto?"→ Ranked datasets with relevance scores and update frequencies
- "How current is Toronto's environmental data?"→ Update frequency analysis across environmental datasets
- "What fields are in the building permits dataset?"→ Complete schema analysis with data types and sample records
- "Give me insights about Toronto's budget data"→ Comprehensive analysis with relevance, freshness, and structure
- "Which datasets update daily?"→ Frequency-based filtering and categorization
- Discover datasets relevant to specific research questions
- Assess data quality and reliability through update patterns
- Understand data structure before detailed analysis
- Find related datasets across different city departments
- Evaluate data completeness and field availability
- Cloudflare Workers: Serverless deployment platform
- Model Context Protocol (MCP): Standard for AI tool integrations
- TypeScript: Type safety and modern development
- Zod: Runtime parameter validation
- CKAN API: Direct integration with Toronto Open Data
toronto-mcp/ ├── src/ │ ├── index.ts # MCP server setup and routing │ └── ckanTools.ts # Toronto Open Data tools implementation ├── test-runner.ts # Automated testing framework ├── test-deployment.ts # Deployment validation script ├── claude-mcp-config.json # Claude Desktop configuration ├── evaluation-guide.md # Comprehensive testing strategies ├── example-usage.md # Usage examples and patterns ├── testing-guide.md # Automated testing documentation └── README.md # This file
# Clone and deploy git clone <your-repo> cd toronto-mcp npm install wrangler deploy
# Install testing dependencies npm install tsx # Test your deployment npx tsx test-deployment.ts https://your-worker.workers.dev
Create or edit~/Library/Application Support/Claude/claude_desktop_config.json:
{ "mcpServers": { "toronto-mcp": { "command": "npx", "args": ["mcp-remote", "https://toronto-mcp.s-a62.workers.dev/sse"] } } }
Restart Claude Desktop and start asking questions about Toronto's open data!
npx tsx test-deployment.ts https://toronto-mcp.s-a62.workers.dev
# Run mock tests (validates framework) npm test # Test specific deployment npm run test:deployment https://your-url.workers.dev
Try these test queries to verify functionality:
- Basic Search: "Find datasets about parking in Toronto"
- Update Analysis: "How often does Toronto update traffic data?"
- Data Structure: "What fields are in Toronto's building permits data?"
- Comprehensive: "Give me insights about Toronto's environmental data"
- Categories: "What departments provide open data in Toronto?"
Your MCP server is working correctly when:
- ✅ Claude consistently selects appropriate tools for queries
- ✅ Results include relevance scores and rankings
- ✅ Update frequency information is categorized correctly
- ✅ Data structure analysis shows complete field information
- ✅ Response times are under 10 seconds for complex queries
- ✅ Error handling provides helpful messages
Concrete examples of how to use each MCP tool, including JSON parameters and expected responses. Essential for understanding tool capabilities and integration patterns.
Comprehensive testing strategies, quality metrics, and evaluation criteria. Includes manual test queries, performance benchmarks, and success metrics for validating MCP server functionality.
TypeScript test framework for programmatic validation, performance monitoring, and automated quality assurance. Includes executable test cases and CI/CD integration patterns.
Ready-to-use MCP server configuration for Claude Desktop integration.
Natural Language Queries (via AI Assistant)
"What traffic data is available in Toronto and how current is it?" "Find housing development datasets with field information" "Which Toronto datasets update daily?" "Give me insights about budget and financial data"
// Intelligent dataset discovery await find_relevant_datasets({ query: "traffic accidents", maxResults: 5, includeRelevanceScore: true, }); // Update frequency analysis await analyze_dataset_updates({ query: "transportation", groupByFrequency: true, }); // Complete data structure analysis await analyze_dataset_structure({ packageId: "building-permits", includeDataPreview: true, previewLimit: 10, }); // Comprehensive insights await get_dataset_insights({ query: "housing development", maxDatasets: 3, includeUpdateFrequency: true, includeDataStructure: true, });
npm run dev # Start development server npm run deploy # Deploy to Cloudflare Workers npm run test # Run automated tests npm run test:deployment # Test specific deployment npm run lint:fix # Fix linting issues npm run format # Format code
- Weighted algorithm: Title (10pts) > Description (5pts) > Tags (3pts) > Organization (2pts)
- Context-aware ranking: Matches user intent with appropriate datasets
- Multi-keyword support: Handles complex queries effectively
- Frequency categorization: Daily, weekly, monthly, quarterly, annually, irregular
- Metadata inference: Analyzes patterns when explicit schedules aren't available
- Quality assessment: Identifies stale vs. actively maintained datasets
- Complete schema analysis: Field names, types, constraints
- Record statistics: Counts, completeness, data quality indicators
- Sample data: Optional previews for quick assessment
- Multi-resource support: Handles datasets with multiple files/formats
- Editsrc/ckanTools.tsto add new tool functions
- Registernew tools insrc/index.ts
- Updatetype definitions and validation schemas
- Addcorresponding tests in the testing framework
server.tool("new_analysis_tool", { param: z.string() }, async ({ param }) => { // Implementation return { content: [{ type: "text", text: result }] }; });
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass:npm test
- Submit a pull request
MIT License - see LICENSE file for details.
Built for intelligent open data discovery• Powered by Toronto Open Data & CKAN API • Enhanced for AI assistant integration
Access Israeli Government Open Data from the data.gov.il portal.
A Centralized MCP Server for Fetching Data from Many Countries' Govs
Access Socrata Open Data APIs from government data portals.
An MCP server for accessing UK police crime data, deployable on Cloudflare Workers.
Official MCP server for dbt (data build tool) providing integration with dbt Core/Cloud CLI, project metadata discovery, model information, and semantic layer querying capabilities.
Provides AI assistants with a secure and structured way to explore and analyze data in GreptimeDB.
Build robust data workflows, integrations, and analytics on a single intuitive platform.
Query and analyze data with MotherDuck and local DuckDB
An MCP server that provides tools to interact with Powerdrill datasets, enabling smart AI data analysis and insights.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





