mcp-playwright-weather-israel

mcp-playwright-weather-israel

MCP server enabling LLMs to fetch Israeli weather forecasts by automating a browser with Playwright to scrape weather2day.co.il.

Category
Visit Server

README

mcp-playwright-weather-israel

פרויקט MCP Server לשליפת תחזית מזג אוויר ישראלית באמצעות Playwright.


מטרת הפרויקט

הפרויקט מממש MCP Server (Model Context Protocol) בשפת Python, המאפשר ל-LLM (Gemini של Google) לשלוף תחזית מזג אוויר ישראלית מהאתר weather2day.co.il — ללא תלות ב-API חיצוני.

השרת משתמש ב-Playwright לאוטומציה של דפדפן Chromium: פתיחת האתר, הזנת שם עיר, בחירה מהרשימה הנפתחת וחילוץ תוכן התחזית. ה-LLM מקבל את הטקסט המנוקה ומסכם אותו למשתמש.


ארכיטקטורת MCP

┌─────────────┐       ┌──────────────┐       ┌─────────────────────┐
│  המשתמש     │──────▶│   host.py    │──────▶│  weather_Israel.py  │
│  (client)   │       │  (MCP Host)  │       │   (MCP Server)      │
└─────────────┘       └──────────────┘       └─────────────────────┘
                             │                          │
                             │                          ▼
                             │               ┌─────────────────────┐
                             │               │  Playwright/Chromium│
                             │               │  weather2day.co.il  │
                             │               └─────────────────────┘
                             │
                             ▼
                      ┌──────────────┐
                      │  weather_    │
                      │  USA.py      │
                      │  (MCP Server)│
                      └──────────────┘

רכיבים

קובץ תפקיד
host.py MCP Host — מנהל את השיחה עם ה-LLM ומחבר בין מספר MCP Servers
client.py ממשק משתמש טקסטואלי לשיחה עם ה-LLM
weather_Israel.py MCP Server — חושף 4 כלים לשליפת תחזית ישראלית
weather_USA.py MCP Server קיים לתחזית אמריקאית

4 הכלים של weather_Israel.py

כלי תיאור
open_weather_forecast_israel פותח דפדפן Chromium ומנווט לאתר התחזית
enter_weather_forecast_city_israel מזין שם עיר בשדה החיפוש וממתין לרשימה הנפתחת
select_weather_forecast_city_israel בוחר את הפריט הראשון ברשימה ומנווט לדף התחזית
get_weather_forecast_content_israel מחלץ ומנקה את תוכן התחזית מהדף

התקנה

דרישות מקדימות

  • Python 3.11+
  • uv — מנהל חבילות Python

התקנת תלויות

# התקנת כל התלויות מ-pyproject.toml
uv sync

# התקנת דפדפן Chromium עבור Playwright
uv run playwright install chromium

הרצה

הפעלת המערכת המלאה (מומלץ)

uv run python host.py

הפקודה מפעילה את ה-MCP Host, שבתורו מאתחל את כל ה-MCP Servers (כולל weather_Israel.py) ופותח ממשק שיחה עם ה-LLM.

הפעלת שרת מזג האוויר הישראלי בנפרד

uv run python weather_Israel.py

מפעיל את weather_Israel.py כ-MCP Server עצמאי (בדרך כלל לצורך פיתוח ובדיקות).

הרצת בדיקות

# כל הבדיקות
uv run pytest tests/ --tb=short

# עם פירוט מלא
uv run pytest tests/ -v

# בדיקות property בלבד (hypothesis)
uv run pytest tests/ -v -m "hypothesis"

דוגמאות שאלות ל-LLM

לאחר הפעלת host.py, ניתן לשאול את ה-LLM שאלות כגון:

  1. תחזית כללית לעיר:

    "מה מזג האוויר בתל אביב היום?"

  2. השוואה בין ערים:

    "מהי התחזית לירושלים לסוף השבוע, ואיך היא שונה מחיפה?"

  3. תכנון פעילות חוצות:

    "האם מומלץ לצאת לטיול בפארק ביום ראשון הקרוב באילת?"

  4. תחזית גשם:

    "מתי צפוי גשם בחדרה השבוע?"

  5. מזג אוויר בצפון הארץ:

    "מה הטמפרטורות הצפויות בצפת ובטבריה בשלושת הימים הקרובים?"


מבנה הפרויקט

.
├── host.py                # MCP Host
├── client.py              # ממשק משתמש
├── weather_Israel.py      # MCP Server — תחזית ישראל
├── weather_USA.py         # MCP Server — תחזית ארה"ב
├── pyproject.toml         # הגדרות הפרויקט ותלויות
├── uv.lock                # קובץ נעילת גרסאות
├── README.md              # תיעוד זה
└── tests/
    ├── conftest.py                    # fixtures משותפות
    ├── test_weather_israel_tools.py   # unit tests לכלים
    └── test_weather_israel_cleanup.py # tests לפונקציית הניקוי

רישיון

פרויקט זה פתוח לשימוש חופשי לצרכי לימוד ופיתוח.

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