Skip to main content
Glama
pragaurav44

WeatherMCP

by pragaurav44
README.md
# WeatherMCP

This project is an **MCP server** built as a hands-on exercise. It provides weather data and alerts from the US National Weather Service (NWS) via a simple API using the [FastMCP](https://github.com/multiprocessio/fastmcp) framework.

## Features
- **Weather Alerts**: Get active weather alerts for any US state.
- **Forecast**: Retrieve weather forecasts for a specific latitude and longitude.

## Requirements
- Python 3.8+
- [uv](https://github.com/astral-sh/uv) (for dependency management and running)

## Installation

1. **Install dependencies using uv:**
   ```sh
   uv pip install -r requirements.txt
   ```
   Or, if you use `pyproject.toml`:
   ```sh
   uv pip install -r pyproject.toml
   ```

2. **(Optional) Create a virtual environment:**
   ```sh
   uv venv .venv
   source .venv/bin/activate
   ```

## Running the MCP Server

To start the server using `uv`:

```sh
uv pip install -e .  # if you want to install as editable, or just ensure dependencies are installed
uv python weather.py
```

The server will start and listen for MCP requests via stdio.

## Available Tools

### 1. `get_alerts(state: str)`
- **Description:** Get active weather alerts for a US state.
- **Argument:** `state` — Two-letter US state code (e.g., `CA`, `NY`).
- **Returns:** Formatted string of current alerts or a message if none are found.

### 2. `get_forecast(latitude: float, longitude: float)`
- **Description:** Get weather forecast for a specific location.
- **Arguments:**
  - `latitude` — Latitude of the location (float)
  - `longitude` — Longitude of the location (float)
- **Returns:** Formatted string with the next 5 forecast periods.

## Notes
- This project is for educational and hands-on purposes.
- Data is sourced from the [National Weather Service API](https://www.weather.gov/documentation/services-web-api).

---

Feel free to extend or modify the project for your own experiments!

TDQS

B3.1/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: get_alerts retrieves weather alerts for US states, while get_forecast provides forecasts for geographic coordinates. There is no overlap in functionality or ambiguity between them.

Naming Consistency5/5

Both tools follow a consistent verb_noun naming pattern (get_alerts, get_forecast) with identical verb usage and snake_case formatting. The naming is perfectly predictable and uniform.

Tool Count2/5

With only 2 tools, this server feels thin for a weather domain. It lacks basic operations like current conditions, historical data, or broader geographic coverage, making it insufficient for comprehensive weather-related tasks.

Completeness2/5

The tool surface is severely incomplete for weather functionality. It misses core operations such as current weather, historical data, multi-day forecasts, or international coverage, leaving significant gaps that will limit agent effectiveness.

Maintenance

ActivityInactive
ResponsivenessNo issues