Skip to content

Repository files navigation

🌤️ 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 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 installed on your machine.

2. Installation

Clone the repository and install dependencies:

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?"

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages