Israel Weather MCP Agent
by H-308
README.md
# š¤ļø Israel Weather MCP Agent with Playwright
An autonomous AI Agent built with the **Model Context Protocol (MCP)** and **Playwright**, designed to fetch real-time weather forecasts in Israel directly from [Weather2Day](https://www.weather2day.co.il/forecast) using browser automation.
---
## š Project Overview
Instead of relying on standard APIs, this project implements a custom **MCP Server** that places an LLM (Gemini) "in the driver's seat" of a real browser.
The agent can:
1. Open a Chromium browser via Playwright and navigate to the weather portal.
2. Locate the search input (`#city_search_forecast`) and type the requested Israeli city.
3. Select the city from the dropdown list.
4. Extract the forecast text from the resulting page and feed it back to the LLM (implementing a local RAG approach) so it can answer the user's question naturally.
---
## š ļø Tech Stack
* **Model Context Protocol (MCP)**: The official protocol for exposing local tools to LLMs.
* **Playwright**: Microsoft's browser automation library for handling UI interactions.
* **Google Gemini API (`google.generativeai`)**: The core LLM powering the agent's decision-making and response generation.
* **Python & Asyncio**: Managing asynchronous execution and server-client communication.
---
## š Getting Started
### 1. Prerequisites
Make sure you have [uv](https://github.com/astral-sh/uv) installed on your machine.
### 2. Installation
Clone the repository and install dependencies:
```bash
uv sync
```
Install the Playwright browser binaries:
Bash
uv run playwright install chromium
### 3. Environment Variables
Create a .env file in the root directory and add your Google Gemini API key:
×§××¢ ×§××
GOOGLE_API_KEY=your_gemini_api_key_here
ā¶ļø Running the Project
Start the terminal chat host:
Bash
uv run host.py
### Example Queries to Try:
"What is the weather like in Jerusalem?"
"Can you check the forecast for Tel Aviv?"This server cannot be deployed
Maintenance
ActivitySlowing
ResponsivenessNo issues