Weather MCP - Israel Edition
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Weather MCP - Israel Edition מה התחזית להיום בתל אביב?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Weather MCP - Israel Edition 🦚
MCP Server ישראלי לתחזית מזג אוויר, שבמקום להתבסס על API מובנה, פותח דפדפן אמיתי באמצעות Playwright וניגש לאתר weather2day.co.il בדיוק כמו משתמש/ת אנושי/ת: מזין שם עיר, בוחר אותה מתוך רשימת ההשלמה האוטומטית, וקורא את דף התחזית שנטען.
מטרת הפרויקט
הפרויקט נבנה כתרגול בפיתוח MCP Server עצמאי, ומדגים שתי יכולות מרכזיות:
מימוש MCP Server באמצעות ה-SDK הרשמי של Anthropic (
mcp[cli]/FastMCP), שחושף כלים (Tools) ל-LLM.שליטה בדפדפן ללא מגע יד אדם באמצעות Playwright, כדי לשלוף מידע מאתר שאין לו API ציבורי - על ידי אוטומציה של הפעולות שמשתמש/ת אנושי/ת היו מבצעים בעצמם.
בפרויקט שני שרתי MCP:
קובץ | תיאור |
| שרת "קלאסי" שמביא תחזית למדינות ארה"ב דרך ה-API הציבורי של NWS. |
| השרת המרכזי של הפרויקט - תחזית לערים בישראל, דרך אוטומציית דפדפן. |
ושני קבצי תשתית גנריים שמחברים ביניהם:
קובץ | תיאור |
| MCP Client גנרי - עוטף חיבור יחיד לשרת MCP (stdio) וקריאה לכלים שלו. |
| צ'אט טרמינל שמתחבר לכל שרתי ה-MCP, מריץ שיחה עם Claude, ומנתב קריאות לכלים לשרת המתאים. |
Related MCP server: Israel Weather MCP Server
איך זה עובד - weather_Israel.py
השרת חושף 4 כלים, המיועדים לשימוש ברצף על ידי ה-LLM:
open_weather_forecast_israel- פותח דפדפן כרום חדש (Chromium) ומנווט לדףhttps://www.weather2day.co.il/forecast.enter_weather_forecast_city_israel(city)- מקליד את שם העיר בשדה החיפוש שבדף, ומחכה שרשימת ההשלמה האוטומטית תיפתח.select_weather_forecast_city_israel- בוחר את הפריט הראשון ברשימה הנפתחת, וממתין לטעינת דף התחזית של אותה עיר.get_weather_forecast_content_israel- שולף ומנקה את תוכן הטקסט של דף התחזית שנטען (RAG פשוט), כדי שה-LLM יוכל לענות על שאלות לגבי התחזית ישירות בתוך השיחה, בלי שהמשתמש/ת יצטרכו להסתכל בעצמם על הדפדפן.
מכיוון שמבנה ה-HTML של אתרים חיצוניים יכול להשתנות, שני הכלים הראשונים (חיפוש ובחירת עיר) בנויים עם רשימת סלקטורים לפי סדר עדיפות: השרת מנסה כמה אסטרטגיות סבירות למציאת שדה החיפוש ופריטי הרשימה הנפתחת, כדי לשרוד שינויים קלים במבנה הדף.
הערה חשובה: קוד ה-Playwright פותח ונבדק במלואו (פתיחה → הזנת עיר → בחירה → חילוץ תוכן) מול עמוד HTML סינתטי שמדמה את זרימת האתר האמיתי - שדה חיפוש ורשימת השלמה אוטומטית שנפתחת ולוחצים עליה. לא ניתן היה להריץ בדיקה חיה מול
weather2day.co.ilעצמו מתוך סביבת הפיתוח שבה נכתב הקוד, בשל חסימת רשת (sandbox ללא גישה כללית לאינטרנט). לכן, בהרצה ראשונה שלך מומלץ לוודא שהבחירה בעיר אכן מצליחה, ובמידת הצורך לעדכן את רשימות הסלקטורים (SEARCH_INPUT_SELECTORS,SUGGESTION_ITEM_SELECTORS) בראש הקובץweather_Israel.pyלפי המבנה בפועל (ניתן להיעזר בפקודהuv run playwright codegen https://www.weather2day.co.il/forecastכדי לזהות את הסלקטורים הנכונים תוך כדי אינטראקציה עם האתר).
התקנה והרצה
דרישות מקדימות
Python 3.10+
מפתח API של Anthropic
שלבים
# 1. התקנת תלויות
uv sync
# 2. התקנת דפדפן Chromium עבור Playwright
uv run playwright install chromium
# 3. הגדרת מפתח ה-API
cp .env.example .env
# ולערוך את .env ולהוסיף את ANTHROPIC_API_KEY
# 4. הרצה
uv run host.pyבהרצה, host.py מתחבר לשני שרתי ה-MCP (weather_USA.py ו-weather_Israel.py)
כתת-תהליכים, אוסף את הכלים שהם חושפים, ופותח צ'אט בטרמינל. הקלידו שאלה, ו-Claude
יבחר בעצמו איזה שרת ואילו כלים להפעיל (ובאיזה סדר) כדי לענות עליה.
דוגמאות לשאלות
תחזית בישראל (weather_Israel.py):
"מה התחזית להיום בתל אביב?"
"איך מזג האוויר בחיפה מחר?"
"תבדקי לי את התחזית בבאר שבע ותגידי לי אם צריך מטרייה"
תחזית בארה"ב (weather_USA.py):
"What's the weather forecast for San Francisco (latitude 37.77, longitude -122.42)?"
"Are there any weather alerts in Texas right now?"
בכל שאלה על עיר בישראל, Claude יפעיל את שרשרת הכלים
open_weather_forecast_israel → enter_weather_forecast_city_israel →
select_weather_forecast_city_israel → get_weather_forecast_content_israel,
ותוכלו לראות את הדפדפן נפתח, מקליד את שם העיר, ובוחר אותה מהרשימה - לפני
שהתשובה חוזרת בטרמינל.
מצב headless
כברירת מחדל הדפדפן נפתח גלוי (headless=False) כדי לאפשר לצפות
בתהליך. כדי להריץ ללא חלון גלוי (למשל על שרת ללא מסך), הגדירו בקובץ .env:
PLAYWRIGHT_HEADLESS=trueלמה לא Google Search?
בכוונה נמנענו מלבנות כלי שמחפש בגוגל "מה התחזית היום ב-X":
חיפוש בגוגל דרך דפדפן אוטומטי (Playwright) מוביל להקפצת אימות CAPTCHA.
הדרך הנכונה לבצע Web Search בפרויקטי LLM היא באמצעות מנוע חיפוש ייעודי (כגון Tavily), ולא על ידי פתיחת דפדפן.
מטרת הפרויקט הייתה תרגול פיתוח MCP Server ספציפי למקור מידע נתון; לצרכים גנריים של גלישה ואוטומציה קיים כבר MCP Playwright הרשמי.
מבנה הפרויקט
.
├── client.py # MCP Client גנרי
├── host.py # צ'אט טרמינל שמחבר את כל שרתי ה-MCP
├── weather_USA.py # MCP Server לתחזית בארה"ב, דרך ה-API של NWS
├── weather_Israel.py # MCP Server לתחזית בישראל, דרך אוטומציית Playwright
├── pyproject.toml # תלויות הפרויקט (מנוהל על ידי uv)
├── .env.example # תבנית למשתני סביבה נדרשים
└── README.mdAvailable Tools
4 toolsenter_weather_forecast_city_israelA
מזינה שם עיר בשדה החיפוש שבדף התחזית, כך שרשימת ערים מתאימות תיפתח.
יש להריץ לאחר open_weather_forecast_israel.
Args: city: שם העיר לחיפוש בעברית (למשל: "תל אביב", "חיפה", "באר שבע")
Inputs: city (required). Returns: result
get_weather_forecast_content_israelA
שולפת ומנקה את תוכן הטקסט של דף התחזית הפתוח כרגע בדפדפן, כדי לספק ל-LLM את המידע הדרוש לענות על שאלות לגבי התחזית ישירות בשיחה (RAG).
יש להריץ לאחר select_weather_forecast_city_israel.
Inputs: no named parameters. Returns: result
open_weather_forecast_israelA
פותחת דפדפן חדש ומנווטת לדף התחזית של אתר weather2day.co.il.
יש להריץ כלי זה תמיד ראשון, לפני הזנת עיר או בחירתה.
Inputs: no named parameters. Returns: result
select_weather_forecast_city_israelA
בוחרת את הפריט הראשון מתוך רשימת הערים הנפתחת (autocomplete) שמופיעה לאחר הזנת שם עיר, וממתינה לטעינת דף התחזית של אותה עיר.
יש להריץ לאחר enter_weather_forecast_city_israel.
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
Scored across 4 tools
Each tool has a discrete role in a linear workflow: opening the forecast page, entering a city, selecting an autocomplete result, and extracting content. The Hebrew descriptions clearly state required predecessors, so an agent should not confuse entering a city with selecting it.
All tool names follow a consistent snake_case convention with a verb, the weather_forecast domain, and the israel suffix. The shared prefix and country suffix make the set coherent, while the varying object nouns still align with each tool's distinct action.
Four tools is exactly right for the narrow browser automation workflow; each step is necessary and none is redundant. The count fits comfortably within the ideal 3–15 range for a focused MCP server.
The full workflow from opening the site to extracting forecast content is covered, including city search and selection. A close/reset tool or broader city-selection capabilities would be nice but are not essential for the stated purpose.
Maintenance
Related MCP Connectors
Playwright browser automation — navigate, click, fill forms, extract, screenshot — 17 agent tools.
Current weather and forecast lookup as an agent tool.
Get current weather for any city and create images from your prompts. Streamline planning, reports…
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables users to retrieve real-time weather forecasts for Israeli cities by autonomously browsing a weather website using Playwright.-
- FlicenseNot gradedqualityDmaintenanceProvides LLMs with real-time weather forecasts for Israeli cities using browser automation with Playwright to scrape live data from a weather website.-
- FlicenseNot gradedqualityDmaintenanceEnables LLMs to retrieve Israeli weather forecasts by controlling a browser via Playwright and scraping data from an Israeli weather website.-
- FlicenseAqualityDmaintenanceEnables LLMs to fetch Israeli weather forecasts by controlling a real browser via Playwright, simulating human interactions like typing and clicking on a weather website.4-