WeatherMcpServer

Omarigato/WeatherMcpServer

3.1

If you are the rightful owner of WeatherMcpServer and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Model Context Protocol (MCP) server is a framework for creating and managing protocol servers using C# and publishing them as NuGet packages.

Real Weather MCP Server ๐ŸŒค๏ธ

A comprehensive Model Context Protocol (MCP) server that provides real-time weather information, forecasts, alerts, air quality data, and intelligent recommendations through AI assistants like Claude.

๐ŸŒŸ Features

Core Weather Functionality โœ…

  • Current Weather - Real-time conditions for any city worldwide
  • Weather Forecasts - Up to 5-day detailed forecasts
  • Weather Alerts - Active warnings and severe weather notifications
  • Air Quality - Comprehensive air pollution data with health recommendations

Advanced Features ๐Ÿš€

  • Multi-City Comparison - Compare weather across up to 5 cities
  • Historical Weather - Access past weather data (last 5 days)
  • Activity Recommendations - Smart suggestions for outdoor activities, sports, travel, and photography
  • Comprehensive Summaries - All-in-one weather reports
  • Coordinates Support - Query by latitude/longitude
  • JSON Export - Structured data for integrations

๐Ÿ› ๏ธ Setup Instructions

Prerequisites

Environment Setup

  1. Get API Key

    # Windows
    set OPENWEATHER_API_KEY=your_actual_api_key_here
    
    # macOS/Linux
    export OPENWEATHER_API_KEY=your_actual_api_key_here
    
  2. Configure VS Code Create .vscode/mcp.json:

    {
      "servers": {
        "weather-server": {
          "type": "stdio",
          "command": "dotnet",
          "args": [
            "run",
            "--project",
            "C:\\Your\\Project\\Path\\WeatherMcpServer.csproj"
          ]
        }
      }
    }
    
  3. Test the Server

    cd WeatherMcpServer
    dotnet build
    dotnet run
    

๐ŸŽฏ Available Tools

Basic Weather Tools

  • GetCurrentWeather - Current conditions for any city
  • GetWeatherByCoordinates - Weather data by lat/lng
  • GetWeatherForecast - Multi-day weather forecasts

Advanced Tools

  • GetWeatherAlerts - Active weather warnings
  • GetAirQuality - Air pollution and health data
  • CompareWeather - Multi-city weather comparison
  • GetHistoricalWeather - Past weather data
  • GetWeatherWithRecommendations - Weather + activity advice
  • GetWeatherSummary - Comprehensive weather report
  • GetWeatherJson - Structured data export

๐Ÿ“– Usage Examples

Basic Weather Query

Get current weather for Tokyo

Advanced Queries

Compare weather between London, Paris, and Berlin
Get air quality for coordinates 40.7128, -74.0060
Get weather forecast for Moscow for 3 days
Get weather with outdoor activity recommendations for Sydney
Get historical weather for Rome on 2024-08-10

๐Ÿ—๏ธ Project Structure

WeatherMcpServer/
โ”œโ”€โ”€ Models/
โ”‚   โ”œโ”€โ”€ WeatherInfo.cs
โ”‚   โ”œโ”€โ”€ WeatherForecast.cs
โ”‚   โ”œโ”€โ”€ WeatherAlert.cs
โ”‚   โ”œโ”€โ”€ AirQuality.cs
โ”‚   โ””โ”€โ”€ OpenWeatherMapModels.cs
โ”œโ”€โ”€ Services/
โ”‚   โ”œโ”€โ”€ IWeatherService.cs
โ”‚   โ””โ”€โ”€ WeatherService.cs
โ”œโ”€โ”€ Tools/
โ”‚   โ”œโ”€โ”€ WeatherTools.cs
โ”‚   โ””โ”€โ”€ RandomNumberTools.cs
โ”œโ”€โ”€ Extensions/
โ”‚   โ””โ”€โ”€ WeatherExtensions.cs
โ”œโ”€โ”€ Program.cs
โ””โ”€โ”€ WeatherMcpServer.csproj

๐Ÿงช Testing Checklist

Core Requirements โœ…

  • Real Weather Data (OpenWeatherMap API)
  • Current Weather by city
  • Weather Forecast (up to 5 days)
  • Multiple Locations support
  • Error Handling
  • Weather Alerts (bonus feature)

Advanced Features โœ…

  • Air Quality monitoring
  • Historical weather data
  • Multi-city comparisons
  • Activity-based recommendations
  • Comprehensive weather summaries
  • JSON data export
  • Coordinate-based queries

๐ŸŽจ Cool Features That Make People Say "Wow!"

  1. Smart Activity Recommendations ๐ŸŽฏ

    • Outdoor activities, sports, travel, photography advice
    • Weather-based suggestions for optimal timing
  2. Multi-City Weather Battles ๐ŸŒ

    • Compare weather across multiple cities
    • Temperature rankings with medals
    • Wind and humidity comparisons
  3. Air Quality Health Advisor ๐ŸŒฌ๏ธ

    • Real-time pollution levels
    • Health recommendations based on air quality
    • Detailed pollutant breakdowns
  4. Historical Weather Detective ๐Ÿ“Š

    • Access past weather data
    • Compare historical vs current conditions
    • Perfect for research and planning
  5. Comprehensive Weather Command Center ๐Ÿ“‹

    • All-in-one weather reports
    • Current + forecast + air quality in one view
    • Professional-grade weather intelligence

๐Ÿš€ Performance Features

  • Async/Await - Non-blocking operations
  • HTTP Client Pooling - Efficient API calls
  • Error Resilience - Graceful failure handling
  • Logging - Comprehensive error tracking
  • Clean Architecture - Separated concerns

๐Ÿ“Š Technical Excellence

  • SOLID Principles - Clean, maintainable code
  • Dependency Injection - Testable architecture
  • Extension Methods - Reusable formatting logic
  • Type Safety - Strong typing throughout
  • API Integration - Professional external service handling

๐ŸŒŸ What Makes This Special

This isn't just another weather app - it's a comprehensive weather intelligence platform that:

  • Provides actionable insights, not just data
  • Offers multiple perspectives on weather conditions
  • Includes health and safety recommendations
  • Supports professional use cases like photography and agriculture
  • Delivers beautiful, formatted output that's easy to read
  • Maintains enterprise-grade code quality

๐Ÿ“ Assignment Completion

Requirements Met โœ…

  1. Real Weather Data โœ… - OpenWeatherMap integration
  2. Current Weather โœ… - Multiple query methods
  3. Weather Forecast โœ… - Up to 5-day forecasts
  4. Multiple Locations โœ… - City names and coordinates
  5. Error Handling โœ… - Comprehensive error management
  6. Weather Alerts โœ… - Bonus feature implemented

Code Quality โœ…

  • Clean, readable, maintainable code
  • Proper separation of concerns
  • SOLID principles applied
  • Comprehensive error handling
  • Professional logging

MCP Integration โœ…

  • Proper tool attributes
  • Excellent descriptions
  • Parameter validation
  • Server configuration

Documentation โœ…

  • Clear setup instructions
  • Usage examples
  • Feature documentation
  • Technical architecture overview

Built with โค๏ธ for FastMCP.me - Making AI Weather Intelligence Accessible to Everyone!