Skip to main content
Glama
MinhHieu-Nguyen-dn

Weather MCP Server

Weather MCP Server

A Model Context Protocol (MCP) server that provides weather forecasts and alerts using the National Weather Service API.

Built following the official Model Context Protocol server development guide

Quick Start (Mac/Linux)

1. Clone and Setup

# Clone the repository to your preferred location
git clone <repository-url> ~/weather-mcp
cd ~/weather-mcp

# Check the project structure
ls -la
# You should see: main.py, weather.py, pyproject.toml, README.md, etc.

2. Configure MCP Client

Add this configuration to your MCP client (e.g., Gemini CLI, Claude Desktop, etc.):

{
  "mcpServers": {
    "weather": {
      "command": "uv",
      "args": [
        "--directory",
        "~/weather-mcp",
        "run",
        "weather.py"
      ]
    }
  }
}

Important: Replace ~/weather-mcp with the actual path where you cloned the repository. For example:

  • If you cloned to your home directory: "/home/yourusername/weather-mcp"

  • If you cloned to a projects folder: "/home/yourusername/projects/weather-mcp"

3. Monitor Server Activity

The server logs all activity to help you understand what's happening:

# Navigate to your cloned repository
cd ~/weather-mcp

# Watch server logs in real-time
tail -f weather_mcp.log

Keep this terminal open while using the MCP server to see real-time logs of weather requests, API calls, and any errors.

Related MCP server: Weather MCP Server

How It Works

This MCP server acts as a bridge between your AI client and the National Weather Service API:

  1. Your AI client sends requests to the MCP server via stdio

  2. The MCP server processes requests and makes API calls to weather.gov

  3. Weather data is returned to your AI client in a structured format

  4. All activity is logged to weather_mcp.log for debugging and monitoring

Features

  • Weather Forecasts: Get detailed weather forecasts for any location using latitude/longitude coordinates

  • Weather Alerts: Retrieve active weather alerts for any US state

  • Server Information: Get details about the server configuration and capabilities

  • Comprehensive Logging: Built-in logging to both console and file with progress reporting

Development Setup

Prerequisites

  • Python 3.11+ installed

  • uv package manager (install uv)

Local Development

# 1. Clone the repository (if not already done)
git clone <repository-url> ~/weather-mcp-dev
cd ~/weather-mcp-dev

# 2. Install dependencies
uv sync

# 3. Test the server locally
uv run python weather.py

# 4. In another terminal, monitor logs
tail -f weather_mcp.log

Making Changes

  1. Edit the code: Modify weather.py or other files as needed

  2. Test your changes: Run uv run python weather.py to test locally

  3. Check logs: Monitor weather_mcp.log for any issues

  4. Update your MCP client: Restart your MCP client to pick up changes

Project Structure

weather-mcp/
├── weather.py          # Main MCP server implementation
├── main.py            # Alternative entry point
├── pyproject.toml     # Project configuration and dependencies
├── weather_mcp.log    # Server logs (created when running)
├── LOGGING.md         # Detailed logging documentation
└── README.md          # This file

Testing Tools

Once the server is running in your MCP client, you can test these tools:

get_forecast(latitude: float, longitude: float)

Get a detailed weather forecast for a specific location.

Example:

get_forecast(40.7128, -74.0060)  # New York City

get_alerts(state: str)

Get active weather alerts for a US state (2-letter state code).

Example:

get_alerts("CA")  # California alerts

server_info()

Get information about the server configuration and capabilities.

Configuration Details

The server uses the National Weather Service API with these settings:

  • User-Agent: weather-app/1.0

  • Base URL: https://api.weather.gov

  • Timeout: 30 seconds

  • Authentication: None required (public API)

Troubleshooting

Common Issues

  1. Server won't start: Check that uv is installed and the path in your MCP config is correct

  2. No weather data: Ensure you have internet connectivity and the weather.gov API is accessible

  3. MCP client can't connect: Verify the stdio connection and server logs

Debugging Steps

# Check if uv is installed
uv --version

# Test the server directly
cd ~/weather-mcp
uv run python weather.py

# Check recent logs
tail -20 weather_mcp.log

# Test with verbose logging
export MCP_LOG_LEVEL=debug
uv run python weather.py

Requirements

  • Python 3.11+

  • httpx>=0.28.1

  • mcp[cli]>=1.13.1

Contributing

  1. Fork the repository

  2. Create a feature branch: git checkout -b feature-name

  3. Make your changes and test locally

  4. Check logs for any issues: tail -f weather_mcp.log

  5. Commit and push: git commit -m "Description" && git push

  6. Submit a pull request

API Reference

This server uses the National Weather Service API:

Available Tools

3 tools
get_alertsB

Get weather alerts for a US state.

Args:
    state: Two-letter US state code (e.g. CA, NY)
ParametersJSON Schema
NameRequiredDescriptionDefault
stateYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves alerts but doesn't describe behavioral traits such as data freshness (e.g., real-time vs. cached), rate limits, error handling (e.g., for invalid state codes), or output format. The description is minimal and lacks essential context for safe and effective use.

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

Conciseness5/5

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

The description is appropriately sized and front-loaded: the first sentence states the purpose clearly, and the second provides parameter details in a structured 'Args:' format. There is no wasted text, and every sentence adds value. It efficiently communicates essential information without redundancy.

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

Completeness3/5

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

Given the tool's low complexity (one parameter) and the presence of an output schema (which handles return values), the description is minimally complete. It covers purpose and parameter semantics adequately but lacks behavioral context (e.g., permissions, rate limits) and usage guidelines. With no annotations, it should do more to compensate, but the output schema reduces the burden slightly.

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

Parameters4/5

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

The description adds significant meaning beyond the input schema, which has 0% description coverage. It explains that 'state' is a 'Two-letter US state code (e.g. CA, NY)', providing crucial semantics and examples that the schema's generic string type lacks. With only one parameter, this compensation is effective, though it doesn't cover edge cases like case sensitivity or invalid codes.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Get weather alerts for a US state.' It specifies the verb ('Get') and resource ('weather alerts') with geographic scope ('US state'), making it distinct from sibling tools like 'get_forecast' (which likely provides forecasts rather than alerts) and 'server_info' (which is unrelated). However, it doesn't explicitly differentiate from 'get_forecast' in terms of alert vs. forecast data, which prevents a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention 'get_forecast' as an alternative for non-alert weather data or specify scenarios where alerts are preferred over forecasts. The geographic constraint ('US state') is stated, but this is part of the purpose rather than usage context. No exclusions or prerequisites are provided.

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

get_forecastC

Get weather forecast for a location.

Args:
    latitude: Latitude of the location
    longitude: Longitude of the location
ParametersJSON Schema
NameRequiredDescriptionDefault
latitudeYes
longitudeYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't explain key behaviors: it doesn't specify the forecast timeframe (e.g., hourly, daily), data source, accuracy, rate limits, error handling, or authentication needs. This leaves significant gaps for an agent to understand how to use it effectively.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, with the main purpose stated first followed by parameter details. It avoids unnecessary fluff, but the parameter section could be more integrated into the flow rather than a separate list, slightly affecting structure.

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

Completeness3/5

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

Given the tool's moderate complexity (2 required parameters) and the presence of an output schema, the description is somewhat complete but has gaps. It covers the basic purpose and parameters but lacks behavioral details and usage guidelines. The output schema likely handles return values, so the description doesn't need to explain those, but it should still address other contextual aspects like when to use it.

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

Parameters3/5

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

The description adds minimal parameter semantics beyond the input schema. It lists 'latitude' and 'longitude' as arguments but doesn't explain their format (e.g., decimal degrees), valid ranges, or units. Since schema description coverage is 0%, the description partially compensates by naming the parameters, but it doesn't provide enough detail to fully understand their usage, aligning with the baseline for moderate coverage.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Get weather forecast for a location.' It specifies the verb ('Get') and resource ('weather forecast') with the target ('location'). However, it doesn't differentiate from sibling tools like 'get_alerts' which might also provide weather-related information, preventing a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'get_alerts' or other weather-related tools. It lacks context about prerequisites, such as needing valid coordinates, and doesn't mention any exclusions or specific scenarios for usage.

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

server_infoB

Get information about the current Weather MCP server configuration.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It indicates a read operation ('Get information'), which suggests non-destructive behavior, but doesn't specify details like authentication needs, rate limits, or what specific server info is returned. This is a minimal but adequate disclosure for a simple tool.

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

Conciseness5/5

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

The description is a single, clear sentence that directly states the tool's purpose without any wasted words. It is front-loaded and efficiently communicates the essential information, making it highly concise and well-structured.

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

Completeness3/5

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

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is complete enough for basic understanding. However, it lacks details on the return format or specific server configuration aspects, which could be helpful for an agent, keeping it at a minimum viable level.

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

Parameters4/5

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

The tool has 0 parameters, and the schema description coverage is 100%, so there are no parameters to document. The description doesn't need to add parameter semantics, earning a high baseline score as it avoids redundancy and is complete in this regard.

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

Purpose4/5

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

The description clearly states the action ('Get information') and target ('current Weather MCP server configuration'), making the purpose unambiguous. It doesn't distinguish from sibling tools like 'get_alerts' or 'get_forecast', which would require explicit comparison, so it falls short of a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'get_alerts' or 'get_forecast'. It implies usage for server configuration info but lacks explicit when/when-not instructions or prerequisites, leaving the agent to infer context.

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. Dates show when Glama detected each change.

  1. 3 tool updates
    • First observedget_alerts
    • First observedget_forecast
    • First observedserver_info

TDQS

B3.3/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: get_alerts retrieves alerts for a US state, get_forecast provides forecasts for geographic coordinates, and server_info returns server configuration details. There is no overlap in functionality, making tool selection straightforward for an agent.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with snake_case (get_alerts, get_forecast, server_info). The naming is predictable and readable, with no deviations in style or convention across the set.

Tool Count3/5

With only 3 tools, the server feels thin for a weather domain, as it lacks operations like historical data, radar imagery, or air quality. While the tools cover basic alerts and forecasts, the scope is limited, potentially requiring agents to work around missing functionality.

Completeness2/5

The tool set has significant gaps for a weather server. It provides alerts and forecasts but lacks update or delete operations, historical data access, or support for multiple locations. This incompleteness may lead to agent failures when more comprehensive weather data is needed.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides weather forecasts and alerts for US locations using the National Weather Service API. Supports getting detailed forecasts by coordinates and active weather alerts by state code.
    36
    GPL 3.0
  • F
    license
    B
    quality
    D
    maintenance
    Provides real-time weather forecasts and alerts for US locations using the National Weather Service API. Supports querying forecasts by coordinates and retrieving active weather alerts by state.
    2
    -

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MinhHieu-Nguyen-dn/weather-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server