MCP Weather Server
## MCP Weather Server
This repository provides a simple **Model Context Protocol (MCP)** server written in Python that exposes weather data as tools. It is packaged so it can be published to GitHub and (optionally) to PyPI.
The server is built on the official [`mcp` Python SDK](https://modelcontextprotocol.github.io/python-sdk/) and uses the free [Open‑Meteo](https://open-meteo.com/) APIs (no API key required).
### Features
- **MCP-compliant server** using `FastMCP`
- **Two tools**:
- `get_current_weather` – current conditions for a city
- `get_daily_forecast` – daily forecast for a city for the next N days
- **Runs locally in Python** (stdio transport by default)
### Installation
From the project root:
```bash
pip install -e .
```
Or, using `uv`:
```bash
uv sync
```
### Running the MCP server locally
You can run the server directly via the console script:
```bash
python -m mcp_weather_server.server
```
Or, if installed as a package:
```bash
mcp-weather-server
```
By default it uses the `stdio` transport, which works with MCP-compatible clients (e.g. IDE integrations or LLM apps that support MCP).
### Connecting with MCP Inspector (optional)
To experiment via HTTP instead of stdio, you can set the transport to `streamable-http` inside `server.py` and then run:
```bash
uv run --with mcp python -m mcp_weather_server.server
```
Then start the MCP Inspector:
```bash
npx -y @modelcontextprotocol/inspector
```
and connect to `http://localhost:8000/mcp`.
### Git conventions
- **Commit messages** must follow **Conventional Commits** (e.g. `feat: add daily forecast tool`, `fix(server): handle API errors`).
- A Cursor rule at `.cursor/rules/git-conventional-commits.mdc` documents the allowed types and format.
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: get_current_weather retrieves current conditions, while get_daily_forecast provides future predictions. There is no overlap in functionality, and an agent can easily differentiate between immediate weather data and multi-day forecasts.
Both tools follow a consistent verb_noun pattern with 'get_' prefix and descriptive names (current_weather, daily_forecast). The naming is uniform and predictable across the toolset, making it easy for agents to understand and use them.
With only 2 tools, the server feels under-scoped for a weather domain. A typical weather API would include more operations such as historical data, alerts, or hourly forecasts. This minimal set limits agent capabilities and may require workarounds for common weather-related tasks.
The toolset is severely incomplete for a weather server. It lacks essential operations like historical weather data, severe weather alerts, air quality information, and hourly forecasts. Agents will face significant gaps when trying to perform comprehensive weather analysis or respond to diverse user queries.