weather-mcp-server
Weather MCP Server
A simple Model Context Protocol (MCP) server that exposes weather tools backed by the US National Weather Service (NWS) API.
The server runs over stdio and can be plugged into any MCP-compatible client (e.g. Cursor, Claude Desktop).
Tools
The server registers two tools:
get_alerts— Get active weather alerts for a US state.Input:
state— two-letter state code (e.g.CA,NY).
get_forecast— Get the weather forecast for a location.Input:
latitude(-90 to 90),longitude(-180 to 180).Note: Only US locations are supported by the NWS API.
Requirements
Node.js (with support for ES modules)
npm
Installation
npm installBuild
npm run buildThis compiles TypeScript into the build/ directory and marks build/index.js as executable.
Run
After building, run the server directly:
node build/index.jsYou should see:
Weather MCP Server running on stdioUsing with an MCP client
Configure your MCP client to launch this server. Example configuration:
{
"mcpServers": {
"weather": {
"command": "node",
"args": ["/absolute/path/to/weather/build/index.js"]
}
}
}Project structure
src/
index.ts # MCP server entry point, tool registration
utils/
helper.ts # NWS API helpers and alert formatting