real-weather-mcp-server

sponkrashin/real-weather-mcp-server

3.1

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

The Real Weather MCP Server is a Model Context Protocol server that provides real-time weather data and forecasts using the OpenWeather API, designed for integration with AI agents and IDEs.

Tools
2
Resources
0
Prompts
0

Real Weather MCP Server

A Model Context Protocol (MCP) server that fetches real weather data using the OpenWeather API and exposes two tools for AI agents and IDEs to consume: current weather and forecast.

  • .NET target: net9.0
  • Transport: stdio
  • Tools: get_city_weather, get_city_weather_forecast

Installation and Configuration

Create an MCP configuration file for your IDE and provide your OpenWeather API key.

  • VS Code: create <WORKSPACE DIRECTORY>/.vscode/mcp.json
  • Visual Studio / JetBrains Rider: create <SOLUTION DIRECTORY>/.mcp.json

You must sign up at OpenWeather and obtain an API key: https://openweathermap.org/api.

Run from source (recommended for development)

Configure your IDE to run the project via dotnet run and pass the API key as an environment variable.

{
  "servers": {
    "RealWeatherMcpServer": {
      "type": "stdio",
      "command": "dotnet",
      "args": [
        "run",
        "--project",
        "<PATH TO src/RealWeatherMcpServer>"
      ],
      "env": {
        "OPENWEATHER_API_KEY": "<YOUR OPENWEATHER API KEY HERE>"
      }
    }
  }
}

Environment variables used by the server:

  • OPENWEATHER_API_KEY (required): the OpenWeather API key. The process will fail to start if this is missing.

Using the MCP server

Once configured, ask Copilot Chat or another MCP-capable client about the weather. The server exposes two tools.

1) Current weather: get_city_weather

  • Parameters:
    • query (string, required): City name with optional country code, or a zip code. Examples: London, London,UK, 94040,US
    • units (string, optional): metric or imperial. Defaults to metric.
  • Example prompts: What's the weather in London? What's the current weather in 94040 in imperial system?

2) Weather forecast: get_city_weather_forecast

  • Parameters:
    • query (string, required): City name with optional country code, or a zip code.
    • date (ISO 8601, required): Desired date/time. The server will pick the closest available forecast to this timestamp (3-hour granularity from OpenWeather).
    • units (string, optional): metric or imperial. Defaults to metric.
  • Example prompts: What will be the weather in New York tomorrow at 9am? What's the weather forecast for 94040 for the next 3 days at noon in imperial units?

Notes:

  • If units are not one of metric or imperial, the server will default to metric.
  • You can disambiguate cities by adding a country code (e.g., London,CA vs London,UK).
  • Pressure and wind units are converted appropriately: °C/°F for temperature, m/s or mph for wind, mmHg/inHg for pressure.

Checklist before publishing to NuGet

  • Test the server locally using the steps above.
  • Update the package metadata in the .csproj file (e.g., <PackageId> if publishing under a different ID).
  • Ensure .mcp/server.json declares your inputs correctly (see https://aka.ms/nuget/mcp/guide/configuring-inputs).
  • Create the package: dotnet pack -c Release.
  • Publish: dotnet nuget push bin/Release/*.nupkg --api-key <your-api-key> --source https://api.nuget.org/v3/index.json.

The bin/Release directory will contain the .nupkg file ready to publish.

NuGet package usage

After publishing the package in NuGet, IDEs can bootstrap with the dnx command. Use the package name and version below.

{
  "servers": {
    "RealWeatherMcpServer": {
      "type": "stdio",
      "command": "dnx",
      "args": [
        "Sponkrashin.RealWeatherMcpTool",
        "--version",
        "0.1.0-beta",
        "--yes"
      ],
      "env": {
        "OPENWEATHER_API_KEY": "<YOUR OPENWEATHER API KEY HERE>"
      }
    }
  }
}

This matches the package declaration in .mcp/server.json.

Troubleshooting and limitations

  • Rate limits: OpenWeather enforces rate limits. If you hit them, wait a bit and retry.
  • Forecast granularity: Forecasts are provided in 3-hour intervals. The server tries to find the closest forecast by date difference. If the requested time is more than 24 hours from the nearest data point, the server will report that no suitable forecast is available.
  • City not found: The tools return a clear "City not found" message when the provider responds with 404.
  • Logs: Diagnostic logs are written to stderr; stdout is reserved for MCP messages.