Weather-MCP

Weather-MCP

An MCP server that provides weather forecast tools for Israel (via Playwright web scraping) and the USA (via NWS API), enabling LLM agents to answer weather queries in natural language.

Category
Visit Server

README

šŸŒ¤ļø — ×Ŗ×—×–×™×Ŗ מזג אוויר ×‘×™×©×Ø××œ

×¤×Ø×•×™×§×˜ לימוד בפיתוח MCP (Model Context Protocol): הוכן (Agent) מבוהה LLM שיודע לשלוף ×Ŗ×—×–×™×Ŗ מזג אוויר ×œ×¢×Ø×™× ×‘×™×©×Ø××œ ובארה"ב, ×•×œ×¢× ×•×Ŗ עליה בשפה חופשית בצ'אט ×©×‘×˜×Ø×ž×™× ×œ.


šŸŽÆ ×ž×˜×Ø×Ŗ ×”×¤×Ø×•×™×§×˜

×œ×‘× ×•×Ŗ שרת MCP ייעודי ש"מלמד" את ה-LLM לבצע משימה שהוא לא יודע לבד — לשלוף ×Ŗ×—×–×™×Ŗ מזג אוויר ×ž××Ŗ×Ø ×™×©×Ø××œ×™ שאין לו API.

ההוכן עושה זאת בשתי ×“×Ø×›×™×:

  1. שרת ×™×©×Ø××œ (weather-Israel) — מאטמט דפדפן ××ž×™×Ŗ×™ עם Playwright: פותח את weather2day.co.il/forecast, מחפש עיר, בוחר אותה, ואז מחלׄ את ×Ŗ×•×›×Ÿ דף ×”×Ŗ×—×–×™×Ŗ ומזין אותו ל-LLM כדי שיענה בעצמו (גישת RAG).
  2. שרת ארה"ב (weather-USA) — שולף ×Ŗ×—×–×™×Ŗ והתרעות ×“×Ø×š ה-API ×”×Ø×©×ž×™ של ה-NWS (National Weather Service).

ה-Host ×ž×—×‘×Ø את כל ×”×©×Ø×Ŗ×™× ל-LLM (Gemini, ×“×Ø×š ה-API ×”×Ŗ×•××-OpenAI), אוהף מהם ××•×˜×•×ž×˜×™×Ŗ את כל ה-Tools, ×•×ž×Ø×™×„ ×œ×•×œ××Ŗ צ'אט שבה ה-LLM בוחר באיזה כלי ×œ×”×©×Ŗ×ž×© ומפעיל ××•×Ŗ× בזה אחר זה עד ×©×ž×Ŗ×§×‘×œ×Ŗ תשובה.


šŸ—ļø מבנה ×”×¤×Ø×•×™×§×˜

project-template/
ā”œā”€ā”€ host.py            # צ'אט ×‘×˜×Ø×ž×™× ×œ ×©×ž×—×‘×Ø את ה-LLM לכל שרתי ה-MCP
ā”œā”€ā”€ client.py          # MCP Client גנרי (×ž×Ŗ×—×‘×Ø לשרת, ×ž×Ø×™×„ Tools)
ā”œā”€ā”€ weather_USA.py     # שרת MCP ×œ××Ø×”"ב — ×“×Ø×š NWS API
ā”œā”€ā”€ weather_Israel.py  # שרת MCP ×œ×™×©×Ø××œ — ×“×Ø×š אטמוט דפדפן (Playwright)
ā”œā”€ā”€ pyproject.toml     # ×Ŗ×œ×•×™×•×Ŗ ×”×¤×Ø×•×™×§×˜
└── README.md

ה-Tools של שרת ×™×©×Ø××œ

# Tool תפקיד
1 open_weather_forecast_israel פותח דפדפן Chromium ומנווט לאתר ×”×Ŗ×—×–×™×Ŗ
2 enter_weather_forecast_city_israel מקליד שם עיר בשדה החיפוש
3 select_weather_forecast_city_israel בוחר את העיר הראשונה ×ž×Ø×©×™×ž×Ŗ ההצעות
4 get_weather_forecast_content_israel מחלׄ את ×Ŗ×•×›×Ÿ דף ×”×Ŗ×—×–×™×Ŗ (כולל iframes) ×•×ž×—×–×™×Ø אותו ל-LLM

šŸ’” ×©×œ×•×©×Ŗ ×”×Ø××©×•× ×™× חולקים אותו דפדפן ×“×Ø×š מצב גלובלי (_page), כי כולם ×Ø×¦×™× באותו ×Ŗ×”×œ×™×š-שרת. הרביעי עובר על כל ה-frames בדף, כי ×”×Ŗ×—×–×™×Ŗ עצמה נטענת ×‘×Ŗ×•×š <iframe> שה-body הראשי לא רואה.


āš™ļø ×”×Ŗ×§× ×” והרצה

דרישות ×ž×§×“×™×ž×•×Ŗ

שלבים

# 1. ×”×Ŗ×§× ×Ŗ ×”×Ŗ×œ×•×™×•×Ŗ ×•×”×§×ž×Ŗ הביבת העבודה
uv sync

# 2. ×”×Ŗ×§× ×Ŗ דפדפן Chromium עבור Playwright
uv run playwright install chromium

הגדרת ×ž×©×Ŗ× ×™ הביבה

צרו קובׄ .env בתיקיית ×”×¤×Ø×•×™×§×˜:

GEMINI_API_KEY=your_api_key_here
GEMINI_MODEL=gemini-2.0-flash

הרצה

uv run host.py

×œ××—×Ø ההפעלה תופיע שורת Query: — הקלידו שאלה (או quit ליציאה).


šŸ’¬ ×“×•×’×ž××•×Ŗ ×œ×©××œ×•×Ŗ שההוכן יודע ×œ×¢× ×•×Ŗ עליהן

×Ŗ×—×–×™×Ŗ ×‘×™×©×Ø××œ (Playwright)

נפתח חלון דפדפן שבו ×Ø×•××™× את דף ×”×Ŗ×—×–×™×Ŗ, וה-LLM גם עונה בצ'אט.

  • "מה ×”×Ŗ×—×–×™×Ŗ ×‘×Ŗ×œ אביב?"
  • "כמה ×ž×¢×œ×•×Ŗ צפויות ×ž×—×Ø ×‘×™×Ø×•×©×œ×™×?"
  • "איך מזג האוויר בחיפה היום?"
  • "תפתחי לי את ×”×Ŗ×—×–×™×Ŗ ×œ×‘××Ø שבע"

×Ŗ×—×–×™×Ŗ והתרעות בארה"ב (NWS API)

  • "What's the weather forecast for San Francisco?" (latitude/longitude)
  • "Are there any weather alerts in California?"
  • "Show me active weather alerts for NY"

🧩 איך זה עובד (×Ŗ×Ø×©×™× ×–×Ø×™×ž×”)

×ž×©×Ŗ×ž×© → "מה ×”×Ŗ×—×–×™×Ŗ ×‘×Ŗ×œ אביב?"
   │
   ā–¼
 Host  ──►  LLM (Gemini) בוחר Tools להפעיל
   │
   ā–¼  (שרת ×™×©×Ø××œ, בזה אחר זה)
 open → enter("תל אביב") → select → get_content
   │
   ā–¼
 ×Ŗ×•×›×Ÿ ×”×Ŗ×—×–×™×Ŗ חוזר ל-LLM (RAG)
   │
   ā–¼
 LLM כותב תשובה בשפה חופשית בצ'אט ✨

šŸ“ הערות

  • ה-LLM הוא זה שמחליט אילו Tools להפעיל ובאיזה הדר — לא כתבנו לוגיקה קשיחה.
  • שני קבצי שרת = שני ×Ŗ×”×œ×™×›×™× × ×¤×Ø×“×™×, ולכן כל מצב ×ž×©×•×Ŗ×£ (כמו הדפדפן הפתוח) חי ×‘×Ŗ×•×š שרת אחד בלבד.

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
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

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