mcp-weather-server

JohnnieEmmanuel/mcp-weather-server

3.3

If you are the rightful owner of mcp-weather-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 henry@mcphub.com.

The MCP Weather Server is a ModelContextProtocol compatible server that provides real-time weather alerts and forecasts from the U.S. National Weather Service.

Tools
  1. get-alerts

    Fetches active weather alerts for a specified U.S. state.

  2. get-forecast

    Provides a 7-day weather forecast for given latitude and longitude.

MCP Weather Server

This project is a ModelContextProtocol (MCP) compatible weather server that fetches real-time alerts and forecasts from the U.S. National Weather Service (NWS) and exposes them as tools via MCP. It is built with Node.js, TypeScript, and the official @modelcontextprotocol/sdk.

🔧 Features

  • get-alerts: Get active weather alerts for any U.S. state.
  • get-forecast: Get a 7-day weather forecast for a given latitude and longitude in the U.S.
  • Uses fetch with custom headers to communicate with the NWS API.
  • Runs over standard input/output (STDIO) transport using MCP.

📦 Installation

git clone https://github.com/JohnnieEmmanuel/mcp-weather-server.git
cd mcp-weather-server
npm install

🚀 Usage

Build the project:

npm run build

Run the server:

node build/index.js

Ensure the MCP consumer you're connecting to is set up to use STDIO transport.

🛠 Tools

🔔 get-alerts

Fetches active alerts for a U.S. state.

Input:

{
  "state": "CA"
}

Output (MCP):

  • Text block summarizing active alerts.

🌦 get-forecast

Fetches weather forecast for a given latitude and longitude.

Input:

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

Output (MCP):

  • Text block summarizing forecast periods including temperature, wind, and short description.

🧱 Tech Stack

  • Node.js + TypeScript
  • Zod for schema validation
  • node-fetch for HTTP requests
  • MCP SDK for server integration and transport

📄 License

MIT License


🧠 Credits

Built by John Emmanuel (REDJOHN) using the ModelContextProtocol SDK.

📢 Disclaimer

This server only supports U.S. locations as it uses the api.weather.gov, which is limited to U.S. data.


✨ Example

> get-alerts { "state": "TX" }

Active alerts for TX:

Event: Excessive Heat Warning
Area: Central Texas
Severity: Severe
Status: Actual
Headline: Dangerously hot conditions expected
---
...