Skip to main content
Glama
mali8573

Israel Weather Forecast MCP Server

by mali8573

Israel Weather Forecast MCP Server

一个独立的 MCP 服务器,通过启动真实浏览器 (Playwright) 来获取以色列天气预报,而不是调用常规 API。其思路是:模型 (Host,例如 Claude Desktop / Claude Code) 会像浏览网站的人类用户一样逐个调用工具:打开页面、输入城市名称、从自动补全列表中选择该城市,最后提取页面内容来回答用户的问题。

项目结构

israel-weather-mcp/
├── server.py           # השרת עצמו - כל ה-tools מוגדרים כאן
├── requirements.txt
└── README.md

Related MCP server: Israel Weather MCP Agent

已实现的工具

第一阶段 - 导航与城市搜索

工具

描述

open_weather_forecast_israel()

打开 Chromium 浏览器 (Playwright) 并导航到 ims.gov.il 的预报页面

enter_weather_forecast_city_israel(city_name)

在页面的搜索框中输入城市名称

select_weather_forecast_city_israel(city_name)

从出现的自动补全列表中选择相应的城市

第二阶段 - 内容提取 (RAG)

工具

描述

get_weather_forecast_content()

从预报页面 (选择城市后) 提取文本,清理 HTML/script/style,并返回干净的文本,LLM 可以直接据此在聊天中作答

close_weather_forecast_browser()

在工作结束时关闭浏览器

典型流程 (LLM 预期的调用顺序):

open_weather_forecast_israel
        ↓
enter_weather_forecast_city_israel("תל אביב")
        ↓
select_weather_forecast_city_israel("תל אביב")
        ↓
get_weather_forecast_content()   → הטקסט חוזר למודל, שמנסח תשובה למשתמש

安装

cd israel-weather-mcp
python -m venv .venv
source .venv/bin/activate        # ב-Windows: .venv\Scripts\activate
pip install -r requirements.txt
playwright install chromium      # מוריד את הדפדפן שה-Playwright מפעיל

连接 Host (例如 Claude Desktop)

在 MCP 的配置文件 (例如 claude_desktop_config.json) 中需要添加:

{
  "mcpServers": {
    "israel-weather-forecast": {
      "command": "python",
      "args": ["/נתיב-מלא/israel-weather-mcp/server.py"]
    }
  }
}

保存后需要重新启动 Host。这些工具将出现在可用工具列表中,届时可以请求,例如:“今天海法的天气预报是什么?”,Host 将逐个调用这些工具来回答。

关于选择器 (Selectors) 的重要说明

ims.gov.il 网站的确切 HTML 结构 (搜索框的 class/id 名称、自动补全项目以及预报区域) 可能会随网站更新而变化,因此所有选择器都集中在 server.py 顶部的 SELECTORS 字典中,并为每个元素提供了一些备选方案 (fallback)。建议:

  1. 使用 server.py 文件中的 HEADLESS = False 运行 (该行位于通用设置附近),以便实际看到浏览器。

  2. 在普通浏览器中打开预报网站,对搜索框 / 自动补全列表 / 预报区域点击右键 → “检查” (Inspect),并相应更新 SELECTORS 字典中的列表。

这样,即使决定将其指向另一个以色列预报网站 (例如私营机构的网站) 而不是 ims.gov.il,也可以调整服务器——只需更新 IMS_FORECAST_URLSELECTORS

上传到 GitHub

该项目已经是一个本地 git 仓库 (包含一个初始 commit)。要将其上传到 GitHub 并获得一个可发送给讲师/老师的链接:

  1. 进入 github.com,点击 New repository (不要勾选 “Add README” / “.gitignore” / “license”——这些我们已经有了)。

  2. 给它命名,例如 israel-weather-mcp,然后点击 Create repository

  3. 在终端中,在项目文件夹 (israel-weather-mcp/) 内运行:

    git remote add origin https://github.com/<שם-המשתמש-שלכם>/israel-weather-mcp.git
    git branch -M main
    git push -u origin main
  4. push 之后,发送给老师的链接就是仓库地址:https://github.com/<שם-המשתמש-שלכם>/israel-weather-mcp

如果还没有在这台电脑上首次配置 git,可能需要运行一次:

git config --global user.name "השם שלכם"
git config --global user.email "האימייל שלכם"

直接运行测试 (不带 Host)

也可以使用 MCP CLI 快速运行测试:

mcp dev server.py

这会打开一个本地测试界面 (MCP Inspector),可以在其中直接调用工具并查看输出,无需连接 Claude Desktop。

A
license - permissive license
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

  • US weather, alerts, earthquakes and elevation for AI agents, from NWS/NOAA and USGS. No API keys.

  • Real-time weather conditions and multi-day forecasts via Open-Meteo — free, no API key required

  • Global weather via Open-Meteo: forecast, ERA5 archive, marine, air quality, geocoding, elevation.

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/mali8573/israel-weather-mcp'

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