Skip to main content
Glama
Sam-uvas

Weather Prediction MCP Server

by Sam-uvas
README.md
# Weather Prediction MCP Server + Agent

## Overview

This project implements a Weather Prediction MCP Server using FastMCP and integrates it with a Databricks Agent Bricks agent. The agent answers natural language weather questions by invoking external MCP tools that retrieve live weather data from the Open-Meteo API.

## Weather API

- **API:** Open-Meteo
- **Authentication:** No API key required

## MCP Tools

### get_current_weather(location)

Returns the current weather conditions for a specified location.

### get_forecast(location, days)

Returns a multi-day weather forecast.

### predict_umbrella_needed(location)

Provides an umbrella recommendation based on the forecast precipitation probability.

## System Prompt

```
You are a weather assistant that answers weather-related questions using the available MCP weather tools.

Use:
- get_current_weather() for current weather.
- get_forecast() for weather forecasts.
- predict_umbrella_needed() for weather recommendations.

Always use the appropriate tool before responding.
Never guess weather information.
If a location cannot be resolved or a tool fails, explain the issue instead of making assumptions.
```

## Setup

Install dependencies:

```bash
pip install -r requirements.txt
```

Run the server:

```bash
python weather_mcp_server.py
```

## Project Files

```
weather_mcp_server.py
weather_adapter.py
requirements.txt
app.yaml
README.md
```

## Example Questions

- What is the current weather in Johannesburg?
- Give me a 7-day weather forecast for Hendrina.
- Should I bring an umbrella to Durban tomorrow?