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.
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
- The Host (
host.py) launches each MCP server as a child process and opens a stdio session with it (via the generic Client inclient.py). - The Host discovers each server's tools and attaches them to every LLM (Gemini) call.
- 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.
- 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
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.