Skip to main content
Glama
jakebailey15

MCP Weather Server

by jakebailey15
README.md
# MCP Weather Server

A [Model Context Protocol](https://modelcontextprotocol.io) server exposing three
weather tools over the free Open-Meteo API, for use with Claude Desktop or any
MCP client.

## Tools

| Tool | Description |
|---|---|
| `get_current_weather(city)` | Current temperature, feels-like, precipitation, wind |
| `get_forecast(city, days)` | Daily highs, lows, and precipitation, 1–16 days ahead |
| `get_historical(city, date)` | Past conditions for a given date (archive lags ~5 days) |

City names are resolved to coordinates via Open-Meteo's geocoding endpoint, so
tools take plain names rather than lat/long. No API key required.

## Setup

```bash
uv venv
source .venv/bin/activate
uv add "mcp[cli]" httpx
```

## Use with Claude Desktop

Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "weather": {
      "command": "/absolute/path/to/.venv/bin/python",
      "args": ["/absolute/path/to/weather.py"]
    }
  }
}
```

Restart Claude Desktop. Both paths must be absolute.

## Notes

Built against MCP Python SDK v2 (`MCPServer`, formerly `FastMCP`). Runs over
stdio, so the client launches the server as a subprocess.

## Known limitations

- No retry or timeout handling on the upstream API; a network failure surfaces
  as a tool error rather than a graceful message.
- Unknown city names return a message, but ambiguous ones silently take the
  first geocoding match.