Israeli Weather MCP

Israeli Weather MCP

MCP server that lets users obtain current Israeli city weather forecasts. It uses Playwright to browse Weather2day, extract the forecast page, and feed the cleaned data back to the LLM for natural language responses.

Category
访问服务器

README

🇮🇱 Israeli Weather MCP with Playwright

📌 Overview

This project implements an MCP (Model Context Protocol) Server that allows an LLM to retrieve Israeli weather forecasts using Playwright browser automation.

Instead of using a weather API, the MCP opens the Weather2day website in a real browser, searches for the requested city, selects it, extracts the weather information from the page, and provides the extracted content back to the LLM.

The project demonstrates how MCP + Playwright + LLM can work together to give an AI agent browser-based capabilities.


🎯 Project Goals

The project was developed to practice:

  • Building an MCP Server independently.
  • Creating custom MCP Tools.
  • Using Playwright for browser automation.
  • Allowing an LLM to control a browser through MCP Tools.
  • Extracting and cleaning web page content.
  • Providing extracted page content back to the LLM so it can answer the user's question.

🛠️ Technologies

  • Python
  • MCP SDK / FastMCP
  • Playwright
  • uv
  • Weather2day
  • LLM

🧩 How It Works

The user asks the LLM for the weather in an Israeli city.

The LLM then uses the MCP Tools in the following order:

User
  ↓
LLM
  ↓
open_weather_forecast_israel
  ↓
enter_weather_forecast_city_israel
  ↓
select_weather_forecast_city_israel
  ↓
get_weather_forecast_content_israel
  ↓
Playwright extracts the page content
  ↓
Content is cleaned and returned to the LLM
  ↓
LLM answers the user

🔧 MCP Tools

1. open_weather_forecast_israel

Opens the Weather2day Israeli forecast page using Playwright.

https://www.weather2day.co.il/forecast

2. enter_weather_forecast_city_israel

Receives a city name and enters it into the Weather2day search field.

Example:

city = "בני ברק"

The Tool also waits for the city's autocomplete suggestions.


3. select_weather_forecast_city_israel

Selects the requested city from the visible autocomplete suggestions.

This completes the browser interaction required to reach the city's forecast page.


4. get_weather_forecast_content_israel

Extracts the visible content from the currently selected city's page.

The Tool:

  1. Reads the page content using Playwright.
  2. Removes empty lines.
  3. Removes duplicate lines.
  4. Limits the returned content size.
  5. Returns the cleaned information to the LLM.

This Tool implements the second stage of the project, where the LLM receives information extracted from the web page and uses it to formulate the final answer.


📂 Project Structure

mcp/
├── host.py
├── client.py
├── weather_Israel.py
├── pyproject.toml
└── README.md

weather_Israel.py

Contains the Israeli Weather MCP Server and its Playwright-based Tools.

host.py

Runs the terminal chat and connects the LLM to the MCP Tools.

client.py

Provides the MCP client functionality.


🚀 Installation

1. Install dependencies

From the project directory:

uv sync

2. Install the Playwright Chromium browser

uv run playwright install chromium

▶️ Running the Project

Start the Host:

uv run host.py

You should see:

Israeli Weather MCP is ready.
Type 'exit' to quit.

You can then ask questions about Israeli cities.


💬 Example

User

give me the weather in Bne Brak

MCP Tool calls

[CITY] Using city: בני ברק
[MCP] Calling open_weather_forecast_israel({})
[MCP] Calling enter_weather_forecast_city_israel({'city': 'בני ברק'})
[MCP] Calling select_weather_forecast_city_israel({})
[MCP] Calling get_weather_forecast_content_israel({})

Assistant

Current temperature in Bne Brak: 25°C.
Wind speed: 5 km/h from the southwest.
Humidity: 87%.
Last updated: 07:00.

The final answer is generated by the LLM using the weather information extracted from the browser page.


💡 Example Questions

The Agent can answer questions such as:

What is the weather in Jerusalem?
Give me the weather in Bne Brak.
What's the current temperature in Tel Aviv?
What is the humidity in Haifa?

🌐 Data Source

Weather information is retrieved from:

Weather2day – Israeli Weather Forecast

https://www.weather2day.co.il/forecast

The project intentionally uses browser automation with Playwright instead of a dedicated weather API.


🤖 Why Playwright?

Playwright allows the MCP Server to interact with a real browser programmatically.

In this project, Playwright is responsible for:

  • Opening the website.
  • Entering the city.
  • Finding the city suggestion.
  • Clicking the city.
  • Reading the resulting forecast page.

This allows the LLM to interact with a website through MCP Tools without requiring manual browser interaction.


🧠 MCP + Browser Automation

This project demonstrates how MCP can extend an LLM with capabilities beyond generating text.

The LLM decides which Tool to call, while the MCP Server handles the actual browser interaction.

This creates a simple architecture where:

LLM = decides what needs to be done
        ↓
MCP = provides the available Tools
        ↓
Playwright = performs the browser actions
        ↓
Weather2day = provides the weather data
        ↓
LLM = interprets the data and answers

📚 Learning Outcomes

Through this project I practiced:

  • Creating an MCP Server with FastMCP.
  • Defining MCP Tools using decorators.
  • Connecting an LLM to custom MCP Tools.
  • Automating browser interactions with Playwright.
  • Handling dynamic web pages and autocomplete suggestions.
  • Extracting and cleaning web page content.
  • Returning web content to an LLM for further reasoning.

👩‍💻 Project

Built as part of an MCP + Playwright learning project focused on giving LLMs browser automation capabilities.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选