weather-mcp-server

jrork/weather-mcp-server

3.1

If you are the rightful owner of 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 Weather MCP Server provides weather information using the National Weather Service API, offering tools for weather alerts and forecasts.

Tools
2
Resources
0
Prompts
0

Weather MCP Server

An MCP (Model Context Protocol) server that provides weather information using the National Weather Service API.

This project was created following the MCP Server Quickstart Tutorial as a learning exercise.

Features

This server provides two main tools:

  • get_alerts: Get active weather alerts for any US state
  • get_forecast: Get detailed weather forecasts for specific coordinates

Installation

This project uses uv for dependency management.

# Clone the repository
git clone <repository-url>
cd weather

# Install dependencies
uv sync

# Run the server
uv run python weather.py

Usage

Running as an MCP Server

The server communicates via stdio and can be integrated with MCP-compatible clients:

uv run python weather.py

Available Tools

get_alerts

Get active weather alerts for a US state.

Parameters:

  • state (string): Two-letter US state code (e.g., "CA", "NY", "TX")

Example:

await get_alerts("CA")
get_forecast

Get a detailed weather forecast for specific coordinates.

Parameters:

  • latitude (float): Latitude of the location
  • longitude (float): Longitude of the location

Example:

await get_forecast(37.7749, -122.4194)  # San Francisco coordinates

Development

Dependencies

  • httpx: HTTP client for API requests
  • mcp: Model Context Protocol framework
  • FastMCP: Fast MCP server implementation

API Usage

This server uses the National Weather Service API, which:

  • Requires no API key
  • Is free to use
  • Covers locations within the United States
  • Returns data in GeoJSON format

Error Handling

The server includes robust error handling:

  • Network timeouts (30 seconds)
  • HTTP error responses
  • Malformed API responses
  • Missing location data

License

[Add your license here]

Contributing

[Add contributing guidelines here]