Skip to main content
Glama
bhujangarao-db

weather-mcp-server

README.md
# Weather MCP Server

A Python [Model Context Protocol](https://modelcontextprotocol.io/) server that gives an AI current weather and forecasts. It geocodes locations and reads forecast data from [Open-Meteo](https://open-meteo.com/), then optionally uses Groq to explain the result naturally.

## Requirements

- Python 3.11 or newer
- A Groq API key for AI-generated summaries
- Internet access for Open-Meteo and Groq requests

## Setup

PowerShell:

```powershell
py -3.11 -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
Copy-Item .env.example .env
```

Open `.env` and set `GROQ_API_KEY`. The server still works without the key, but it returns structured JSON instead of an AI summary.

## Run

### Browser UI

Start the user-facing weather chat:

```powershell
python -m weather_mcp_server.web
```

Then open <http://127.0.0.1:8000>. Ask questions such as “Will it rain in London tomorrow?” The browser sends the question to the web adapter, which invokes the same `get_weather` tool exposed by the MCP server.

Run the server directly:

```powershell
python -m weather_mcp_server.server
```

MCP clients can use the checked-in `.vscode/mcp.json` configuration. In VS Code, open this folder as the workspace, install the Python extension if prompted, and start the `weather-mcp-server` MCP server from the MCP controls.

The server exposes one tool:

- `get_weather(location, forecast_days=3)`: returns current conditions and 1-7 days of forecast data.

## Test

```powershell
python -m pytest
```

The tests mock Open-Meteo, so they do not require network access or a Groq key.

TDQS

A4/5.0

Scored across 1 tool

Disambiguation5/5

Only one tool exists, so there is no possibility of confusing it with another. The tool's purpose is clearly defined and distinct.

Naming Consistency5/5

The single tool uses a clear, conventional verb_noun pattern (get_weather), which is consistent and intuitive. There are no naming inconsistencies to evaluate.

Tool Count3/5

A single tool for a weather server is minimal but borderline acceptable because it combines current conditions and forecast. However, it feels thin compared to the typical scope of a weather-focused MCP server.

Completeness4/5

The tool covers the core weather needs—current conditions and forecast—with configurable forecast days. Missing features like alerts or historical data are minor gaps that agents can work around for basic weather queries.

Maintenance

ActivityMaintained
ResponsivenessNo issues