weather-mcp

arjones/weather-mcp

3.2

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

The Weather MCP Server provides weather data using the National Weather Service (NWS) API, offering comprehensive weather alerts and forecasts across the United States.

Tools
  1. get_alerts

    Get weather alerts for a US state.

  2. get_forecast

    Get weather forecast for specific coordinates.

Weather MCP Server

A Model Context Protocol (MCP) server that provides weather data using the National Weather Service (NWS) API. Source MCP / For Server Developers / Quickstart

Features

  • Weather Alerts: Get active weather alerts for any US state
  • Weather Forecast: Get detailed weather forecasts for specific coordinates
  • US Coverage: Full coverage of United States territories

Project Structure

src/
ā”œā”€ā”€ index.ts      # MCP server configuration and main entry point
ā”œā”€ā”€ types.ts      # TypeScript interfaces and type definitions
ā”œā”€ā”€ api.ts        # NWS API client and request handling
└── forecast.ts   # Business logic for alerts and forecast processing

Architecture Overview

  • index.ts: MCP server setup, tool registrations, and main function
  • types.ts: All TypeScript interfaces (AlertFeature, ForecastPeriod, etc.)
  • api.ts: HTTP client for NWS API with error handling
  • forecast.ts: Core business logic for formatting and processing weather data

Setup

  1. Install dependencies:

    npm install
    
  2. Build the project:

    npm run build
    

Available Tools

get_alerts

Get weather alerts for a US state.

Parameters:

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

Example:

{
  "state": "CA"
}

get_forecast

Get weather forecast for specific coordinates.

Parameters:

  • latitude (number): Latitude (-90 to 90)
  • longitude (number): Longitude (-180 to 180)

Example:

{
  "latitude": 37.7749,
  "longitude": -122.4194
}

Debugging with MCP Inspector

The MCP Inspector is a powerful tool for debugging and testing MCP servers.

Installation

Use it directly with npx:

npx @modelcontextprotocol/inspector node build/index.js

Usage

Connect to your server:

  • Server type: stdio
  • Command: node
  • Arguments: build/index.js
  • Click Connect