Skip to main content
Glama
newcoast27-hub

Weather MCP Server

README.md
# Weather MCP Server

An MCP server providing worldwide weather via the free [Open-Meteo](https://open-meteo.com/) APIs (no API key needed). Runs fully self-contained in Docker as a streamable-HTTP MCP service.

## Tools

| Tool | Description |
|------|-------------|
| `get_weather(city, units)` | Current conditions for any city |
| `get_forecast(city, days, units)` | 1–16 day daily forecast |
| `search_city(city, count)` | Disambiguate cities sharing a name |

## Run with Docker

```sh
docker compose up -d --build
```

The MCP endpoint is then at **`http://localhost:8100/mcp`** and a liveness probe at `http://localhost:8100/health`. (Host port defaults to 8100 since 8000 is often taken by other MCP containers; override with `MCP_HOST_PORT`.)

Check status / logs:

```sh
docker compose ps          # health column shows "healthy" once up
docker compose logs -f weather-mcp
```

Stop:

```sh
docker compose down
```

### Configuration (environment variables)

| Variable | Default | Notes |
|----------|---------|-------|
| `MCP_TRANSPORT` | `streamable-http` in Docker (`stdio` outside) | Also supports `sse` |
| `MCP_HOST` | `0.0.0.0` | Bind address for HTTP transports |
| `MCP_PORT` | `8000` | Port inside the container |
| `MCP_HOST_PORT` | `8100` | Host-side port mapping (compose only): `MCP_HOST_PORT=9000 docker compose up -d` |
| `LOG_LEVEL` | `INFO` | Standard Python log levels |

## Connect an MCP client

**Claude Code:**

```sh
claude mcp add --transport http weather http://localhost:8100/mcp
```

**Claude Desktop** (`claude_desktop_config.json`), via `mcp-remote`:

```json
{
  "mcpServers": {
    "weather": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "http://localhost:8100/mcp"]
    }
  }
}
```

## Run locally without Docker (stdio)

```sh
pip install -r requirements.txt
python weather_server.py
```

With the default `MCP_TRANSPORT=stdio`, an MCP client launches the script itself:

```json
{
  "mcpServers": {
    "weather": {
      "command": "python",
      "args": ["D:/Local Development/Weather MCP Server/weather_server.py"]
    }
  }
}
```