A Model Context Protocol (MCP) server that provides weather data and alerts using the National Weather Service (NWS) API. This server enables AI assistants to fetch real-time weather forecasts and alerts for locations within the United States.
- Weather Forecasts: Get detailed weather forecasts for any US location using latitude and longitude coordinates
- Weather Alerts: Retrieve active weather alerts for any US state using two-letter state codes
- Real-time Data: All data is fetched directly from the National Weather Service API
- MCP Compatible: Works seamlessly with Claude Desktop and other MCP-compatible clients
- Clone this repository:
git clone <repository-url>
cd weather
- Install dependencies:
npm install
- Build the project:
npm run build
Add this server to your Claude Desktop configuration file (claude_desktop_config.json
):
{
"mcpServers": {
"weather": {
"command": "node",
"args": ["/absolute/path/to/weather/build/index.js"]
}
}
}
Replace /absolute/path/to/weather
with the actual path to your weather project directory.
Get weather forecast for a specific location.
Parameters:
latitude
(number): Latitude of the location (-90 to 90)longitude
(number): Longitude of the location (-180 to 180)
Example:
Get forecast for latitude 40.7128, longitude -74.0060 (New York City)
Get active weather alerts for a US state.
Parameters:
state
(string): Two-letter state code (e.g., "CA", "NY", "TX")
Example:
Get alerts for California (CA)
weather/
├── src/
│ └── index.ts # Main server implementation
├── build/
│ └── index.js # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.md
npm run build
This compiles the TypeScript source code and makes the executable file at build/index.js
executable.
You can test the server by running it directly:
node build/index.js
The server will start and listen for MCP protocol messages on stdin/stdout.
This server uses the National Weather Service API:
- Base URL: https://api.weather.gov
- Coverage: United States only
- Data Source: Official NWS weather data
- Rate Limits: Follow NWS API guidelines
@modelcontextprotocol/sdk
: MCP protocol implementationzod
: Schema validation and type safetytypescript
: TypeScript compiler@types/node
: Node.js type definitions
ISC
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
For issues related to:
- MCP Protocol: Visit Model Context Protocol documentation
- Weather Data: Check the National Weather Service API documentation
- This Server: Open an issue in this repository