Skip to main content
Glama

🌦️ Weather MCP β€” Israel via Browser Automation, USA via API

An MCP (Model Context Protocol) project demonstrating two ways to extend an LLM's context with live weather data:

  • weather_USA.py β€” a "classic" MCP server: fetches forecasts and alerts from the US National Weather Service API (api.weather.gov).

  • weather_Israel.py β€” an MCP server that puts the LLM's hand on the mouse πŸ–±οΈ: it launches a real Chromium browser with Playwright, navigates to weather2day.co.il, types a city name into the search box, picks it from the autocomplete list β€” and extracts the page content so the LLM can answer the question itself (RAG).

🧩 Project Structure

β”œβ”€β”€ client.py           # Generic MCP client β€” connects to any MCP server over stdio
β”œβ”€β”€ host.py             # Terminal chat: connects Gemini to all MCP servers
β”œβ”€β”€ weather_USA.py      # MCP server for US forecasts (API)
β”œβ”€β”€ weather_Israel.py   # MCP server for Israeli forecasts (Playwright)
└── test_israel_flow.py # Smoke test for the full Israeli flow

The Israeli Server's Tools

Tool

What it does

open_weather_forecast_israel

Opens a browser and navigates to the forecast page

enter_weather_forecast_city_israel

Types a city name into the search field (and reports the suggestions)

select_weather_forecast_city_israel

Selects the first item in the autocomplete list

get_weather_forecast_content_israel

Extracts the forecast page content and feeds it to the LLM

Related MCP server: Israel Weather MCP

πŸš€ Setup & Run

Prerequisites: Python 3.11+, uv.

# 1. Install dependencies
uv sync

# 2. Install Chromium for Playwright
uv run playwright install chromium

# 3. Gemini API key (free, no credit card) β€” https://aistudio.google.com/apikey
copy .env.example .env    # then edit: GEMINI_API_KEY=...

# 4. Run the chat
uv run host.py

Quick check of the Israeli server without an LLM:

uv run test_israel_flow.py

πŸ’¬ Example Questions

  • ΧžΧ” Χ”ΧͺΧ—Χ–Χ™Χͺ ΧœΧ”Χ™Χ•Χ Χ‘Χͺל אביב? (What's today's forecast in Tel Aviv?)

  • כדאי ΧœΧ§Χ—Χͺ ΧžΧ˜Χ¨Χ™Χ” ΧžΧ—Χ¨ Χ‘Χ™Χ¨Χ•Χ©ΧœΧ™Χ? (Should I take an umbrella tomorrow in Jerusalem?)

  • ΧžΧ” ΧžΧ–Χ’ האוויר Χ‘Χ—Χ™Χ€Χ” Χ‘Χ‘Χ•Χ£ Χ”Χ©Χ‘Χ•Χ’? (What's the weather in Haifa this weekend?)

  • What's the forecast in Chicago? (routed to the US server)

  • Are there weather alerts in California?

While the question is being processed you'll see the browser open, type the city name, and select it from the list β€” then the model answers based on the page content.

βš™οΈ How It Works

  1. The Host (host.py) launches each MCP server as a child process and opens a stdio session with it (via the generic Client in client.py).

  2. The Host discovers each server's tools and attaches them to every LLM (Gemini) call.

  3. When the model detects a question about weather in Israel, it invokes the four tools one after another: open browser β†’ type city β†’ select from list β†’ extract content.

  4. The page content comes back to the model as a tool result, and it composes an answer from it β€” RAG over a live web page.

πŸ”— Connecting to Other Hosts (e.g. ChatBox)

The MCP servers are host-agnostic. Connect one to any MCP-capable app with a command like:

uv --directory C:\path\to\project run weather_Israel.py

Available Tools

4 tools
enter_weather_forecast_city_israelB

Type a city name into the search field on the forecast page.

Args: city: City name in Hebrew (e.g. 'Χͺל אביב', 'Χ™Χ¨Χ•Χ©ΧœΧ™Χ', 'Χ—Χ™Χ€Χ”')

Inputs: city (required). Returns: result

get_weather_forecast_content_israelA

Extract the forecast content from the currently open city forecast page, so it can be used to answer the user's weather question directly.

Inputs: no named parameters. Returns: result

open_weather_forecast_israelA

Open a browser and navigate to the Israeli weather forecast site (weather2day.co.il). This must be called first, before entering or selecting a city.

Inputs: no named parameters. Returns: result

select_weather_forecast_city_israelA

Select the first city in the autocomplete suggestions list and load its forecast page.

Inputs: no named parameters. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool handles a distinct, sequential step: open site, enter city, select suggestion, extract content. No overlap or ambiguity between them.

    Naming Consistency5/5

    All names follow a predictable action_weather_forecast_..._israel pattern with snake_case. The pattern is consistent and readable.

    Tool Count5/5

    4 tools perfectly cover the browser-based workflow for this narrow purpose. Not too sparse, not bloated.

    Completeness5/5

    The tool set forms a complete, linear workflow from opening the site to extracting forecast content. No obvious gaps for the stated domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers