Skip to main content
Glama
atharvawadekar

Weather MCP Server

README.md
# Weather MCP Server

An MCP (Model Context Protocol) server that provides weather forecasts using OpenStreetMap Nominatim for geocoding and the National Weather Service (Weather.gov) API for forecast data.

## Features

- **Single tool**: `get_weather_forecast` - Get weather forecasts for any city, state, or address
- Uses OpenStreetMap Nominatim for free geocoding (no API key required)
- Uses Weather.gov API for accurate, free weather data (US locations only)
- Returns detailed forecast periods with temperature, wind, and conditions

## Installation

1. Install dependencies:
```bash
npm install
```

2. Build the project:
```bash
npm run build
```

## Configuration

Add this server to your Claude Desktop config file:

**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`  
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`

```json
{
  "mcpServers": {
    "weather": {
      "command": "node",
      "args": ["/Users/atharvawadekar/Desktop/Projects/WeatherMCP/dist/index.js"]
    }
  }
}
```

## Usage

Once configured, you can ask Claude:

- "What's the weather in Seattle?"
- "Get me the forecast for Miami, FL"
- "What's the weather like in Portland, Oregon?"
- "Tell me the weather for 1600 Pennsylvania Ave, Washington DC"

## Tool Details

### `get_weather_forecast`

**Input:**
- `location` (string): City name, state, or full address

**Output:**
- Location name and coordinates
- NWS forecast office
- Multiple forecast periods with:
  - Period name (Today, Tonight, Tomorrow, etc.)
  - Temperature
  - Wind speed and direction
  - Short and detailed forecast descriptions

## How It Works

1. Takes a location string (city, state, or address)
2. Geocodes it using OpenStreetMap Nominatim to get latitude/longitude
3. Calls Weather.gov `/points/{lat},{lon}` to get grid data
4. Fetches the forecast from the returned forecast URL
5. Formats and returns the weather data

## Limitations

- **US locations only**: Weather.gov only provides data for US locations
- **Rate limits**: Be respectful of Nominatim's usage policy (max 1 request/second)
- **Geocoding accuracy**: Results depend on OpenStreetMap's geocoding quality

## Development

Run in development mode with auto-rebuild:
```bash
npm run dev
```

## License

MIT