Skip to main content
Glama
mcp-playwright-weather-israel

mcp-playwright-weather-israel

by shoshi-raz

mcp-playwright-weather-israel

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


מטרת הפרויקט

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

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


Related MCP server: MCP Playwright Weather Israel

ארכיטקטורת 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 לפונקציית הניקוי

רישיון

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

Available Tools

4 tools
enter_weather_forecast_city_israelB

Enters city name in the search field and waits for dropdown to appear.

Args: city_name: Name of the city to search for.

Returns: Success message if city entered and dropdown appeared, error message otherwise.

Inputs: city_name (required). Returns: result

get_weather_forecast_content_israelA

Extracts and cleans the weather forecast content from the page.

Returns: Cleaned weather forecast text content, error message otherwise.

Inputs: no named parameters. Returns: result

open_weather_forecast_israelA

Opens browser and navigates to Israeli weather forecast site.

Returns: Success message if browser opened and page loaded, error message otherwise.

Inputs: no named parameters. Returns: result

select_weather_forecast_city_israelA

Selects the first item from the dropdown and waits for forecast page to load.

Returns: Success message with selected city name, error message otherwise.

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/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a distinct role in a sequential workflow: opening the site, entering a city, selecting from dropdown, and extracting content. No two tools overlap in purpose.

    Naming Consistency5/5

    All tools follow a consistent 'verb_weather_forecast_[specific]_israel' pattern with snake_case. The verbs clearly indicate the action, and the domain and location are uniformly included.

    Tool Count5/5

    With 4 tools, the server is well-scoped for a focused weather forecast workflow. Each tool is necessary for the sequence and there is no bloat.

    Completeness5/5

    The tool set covers the complete workflow from opening the site to retrieving the forecast content. No obvious dead ends or missing steps for its intended purpose.

    Related MCP Connectors

    Related MCP Servers