Skip to main content
Glama
Efrat-Fr

Weather-MCP

by Efrat-Fr

🌤️ — イスラエルの天気予報

**MCP(Model Context Protocol)**開発の学習プロジェクト:イスラエルと米国の都市の天気予報を取得し、ターミナルのチャットで自由な言語で回答できるLLMベースのエージェント(Agent)。


🎯 プロジェクトの目的

LLMが単独ではできないタスク——APIを持たないイスラエルのサイトから天気予報を取得すること——を「教える」専用のMCPサーバーを構築します。

エージェントはこれを2つの方法で行います:

  1. イスラエルサーバー(weather-IsraelPlaywrightで実際のブラウザを自動操作します:weather2day.co.il/forecastを開き、都市を検索して選択し、予報ページのコンテンツを抽出してLLMに供給し、LLM自身が回答します(RAGアプローチ)。

  2. 米国サーバー(weather-USA — NWS(National Weather Service)の公式APIを通じて予報と警報を取得します。

HostはすべてのサーバーをLLM(Gemini、OpenAI互換API経由)に接続し、サーバーからすべてのToolsを自動的に収集し、LLMがどのツールを使用するかを選択して、回答が得られるまでそれらを次々に実行するチャットループを実行します。


Related MCP server: mcp-playwright-weather-israel

🏗️ プロジェクト構造

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に返す

💡 最初の3つは、すべて同じサーバープロセスで実行されるため、グローバル状態(_page)を介して同じブラウザを共有します。4つ目は、予報自体がメインのbodyからは見えない<iframe>内に読み込まれるため、ページ上のすべてのframesを調べます。


⚙️ インストールと実行

前提条件

手順

# 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を実行するか、どの順序で実行するかを決定します — ハードコードされたロジックは書いていません。

  • サーバーファイルが2つ = 別々のプロセスが2つ。したがって、共有状態(開いているブラウザなど)は1つのサーバー内にのみ存在します。

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • MCP server for AI dialogue using various LLM models via AceDataCloud

  • MCP server exposing the Backtest360 engine API as tools for AI agents.

  • Hosted MCP server to manage a restaurant menu from AI agents - 39 tools over the DuckHub API.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Efrat-Fr/Weather-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server