Skip to main content
Glama

Weather MCP Learning

This repository is an educational project created only to learn more about the Model Context Protocol (MCP). It is not intended to be a production weather service.

MCP is an open protocol that gives AI applications a standard way to connect to external tools and data sources. An MCP server exposes capabilities such as tools, resources, or prompts, while an MCP client—such as Claude Desktop—discovers and uses those capabilities through a defined interface.

This project implements a small Python MCP server that retrieves weather information from the United States National Weather Service (NWS) API.

Available tools

  • get_alerts(state): Returns active weather alerts for a two-letter US state code, such as CA or NY.

  • get_forecast(latitude, longitude): Returns a short forecast for a location in the United States.

The NWS API primarily covers locations in the United States and its territories.

Related MCP server: MCP Weather Server

Requirements

  • Python 3.12 or later

  • uv

  • An MCP client, such as Claude Desktop

Run locally

Clone the repository and start the server with the stdio transport:

git clone https://github.com/hienguyenUET/weather_mcp_learning.git
cd weather_mcp_learning
uv sync
uv run weather.py

Configure Claude Desktop

Add the server to the mcpServers object in your Claude Desktop configuration file:

{
  "mcpServers": {
    "weather": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/weather_mcp_learning",
        "run",
        "weather.py"
      ]
    }
  }
}

Restart Claude Desktop after saving the configuration. Claude should then discover the get_alerts and get_forecast tools.

Example prompts

  • "Are there any active weather alerts in California?"

  • "What is the weather forecast for latitude 34.0522 and longitude -118.2437?"

Project structure

weather_mcp_learning/
├── weather.py       # MCP server and weather tools
├── pyproject.toml   # Project metadata and dependencies
└── uv.lock          # Locked dependency versions

Data source

Weather data is provided by the public National Weather Service API. No API key is required.

Available Tools

2 tools
get_alertsD

Inputs: state (required). Returns: result

get_forecastD

Inputs: latitude (required), longitude (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    D1.9/5.0

    Scored across 2 tools

    Disambiguation5/5

    get_alerts and get_forecast clearly correspond to distinct weather data types—alerts versus forecast—with no semantic overlap. An agent can easily select the right tool based on the resource name alone.

    Naming Consistency5/5

    Both tools follow the identical verb_noun pattern get_<noun>, using snake_case consistently. The naming convention is uniform and predictable.

    Tool Count3/5

    Two tools is at the lower boundary for a useful server. While a minimal weather server could get by with forecast and alerts, the count feels thin for a general-purpose weather service.

    Completeness3/5

    The set covers forecast and alerts but lacks common weather operations such as current conditions, historical data, or location-based weather search. These are notable gaps for the apparent domain.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to access real-time US weather forecasts and alerts through the National Weather Service API.
      2
      13 npm
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides weather information using the US National Weather Service API, including active weather alerts for US states and location-specific forecasts based on latitude and longitude coordinates.
      79 npm
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables users to get weather forecasts and alerts for any US city and state through natural language queries using the National Weather Service API.
      -
    • F
      license
      B
      quality
      D
      maintenance
      Provides real-time US weather alerts and forecasts by integrating with the National Weather Service API. It enables AI assistants to fetch state-specific alerts and detailed local forecasts using geographic coordinates.
      2
      1
      -