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
ParametersJSON Schema
NameRequiredDescriptionDefault
stateYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_forecastD
ParametersJSON Schema
NameRequiredDescriptionDefault
latitudeYes
longitudeYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 2 tool updatesv0.1.0
    • First observedget_alerts
    • First observedget_forecast

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

ActivityMaintained
ResponsivenessNo 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
    5 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.
    55 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
    -