weather-mcp-playwright

weather-mcp-playwright

An MCP server that fetches US weather forecasts via API and Israel weather forecasts by automating a browser with Playwright to scrape a weather website.

Category
Visit Server

README

šŸŒ¦ļø 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

šŸš€ 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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured