Weather MCP Server
# Weather MCP Server
An [MCP](https://modelcontextprotocol.io/) server that exposes US weather data from the [National Weather Service](https://www.weather.gov/documentation/services-web-api) as tools for Cursor (or any MCP client).
## Tools
| Tool | Arguments | Description |
| --- | --- | --- |
| `get_alerts` | `state` (e.g. `CA`, `NY`) | Active weather alerts for a US state |
| `get_forecast` | `latitude`, `longitude` | Next five forecast periods for a US location |
NWS coverage is US-only. Use a two-letter state code for alerts and US coordinates for forecasts.
## Requirements
- [uv](https://docs.astral.sh/uv/)
- Python 3.14+ (this project pins `>=3.14`)
## Setup
```powershell
git clone <your-repo-url>
cd weather
uv sync
```
## Run
The server speaks MCP over stdio:
```powershell
uv run weather.py
```
## Use with Cursor
1. Copy [`.cursor/mcp.json.example`](.cursor/mcp.json.example) to `.cursor/mcp.json`.
2. Replace the `uv` path and `--directory` path with absolute paths on your machine.
3. Open **Cursor Settings → MCP**, enable the `weather` server, and reload the window if it does not connect.
Example prompts after it is connected:
- Get weather alerts for CA
- What’s the forecast for 37.7749, -122.4194?
On Windows, `uv` is often not on Cursor’s PATH, so use the full path from `where.exe uv`. Keep `--directory` as an absolute project path.
## Project layout
```
weather.py # MCP server (tools + NWS client)
src/weather/ # Package entrypoint used by `uv run weather`
pyproject.toml # Dependencies (`mcp[cli]`)
.cursor/ # Cursor MCP config (local `mcp.json` is gitignored)
```
TDQS
Scored across 2 tools
get_alerts and get_forecast have clearly distinct purposes: one returns alerts for a US state, the other returns a forecast for coordinates. There is no ambiguity between the two.
Both tools follow the same get_ noun pattern, making the naming predictable and consistent. The singular/plural difference (forecast vs. alerts) is semantically appropriate.
With only two tools, the server feels thin for a weather domain, but it is still within a borderline range. Each tool provides a distinct core weather function, so the count is not unreasonable.
The weather domain typically includes current conditions, forecasts, and alerts. This server lacks current weather data and only handles forecasts and alerts, which is a significant gap for general weather use.