
天气
STDIO提供美国天气预警和预报的MCP服务器
提供美国天气预警和预报的MCP服务器
A Model Context Protocol (MCP) server that provides weather information services using the National Weather Service (NWS) API. This server implements a set of tools that can be used by AI models to fetch weather alerts and forecasts for locations in the United States.
npm install npm run build
This server is designed to be used as a CLI tool and can be installed globally:
npm install -g . weather
The server runs on stdio and provides two main tools:
Retrieves active weather alerts for a specified US state.
Example parameters:
{ "state": "CA" // Two-letter state code }
Retrieves weather forecast for a specific location using coordinates.
Example parameters:
{ "latitude": 37.7749, "longitude": -122.4194 }
@modelcontextprotocol/sdk
for MCP implementation@modelcontextprotocol/sdk
: ^1.12.1zod
: ^3.25.41typescript
: ^5.8.3 (dev dependency)@types/node
: ^22.15.26 (dev dependency)npm install
npm run build
The server uses the National Weather Service (NWS) API with the following endpoints:
https://api.weather.gov/alerts
https://api.weather.gov/points/{lat},{lon}
The server includes robust error handling for: