Weather Israel MCP Server
使用 MCP、Gemini 和 Playwright 的 AI 天气代理
概述
本项目实现了一个 AI 代理,使用模型上下文协议(MCP)、Google Gemini 和 Playwright 获取以色列各城市的当前天气信息。
当用户询问某个城市的天气时,代理会打开一个天气网站,搜索所请求的城市,从页面中提取天气信息,并根据网站内容返回答案。
项目还包含一个简单的检索步骤,即从网页中提取天气信息,并在生成最终回答之前将其作为附加上下文提供给语言模型。
Related MCP server: Israel Weather MCP Server
技术
Python
Google Gemini API
MCP(模型上下文协议)
Playwright
AsyncIO
python-dotenv
项目结构
host.py # Main chat application
client.py # MCP client
weather_Israel.py # MCP weather server
README.md
requirements.txt工作原理
用户询问以色列某个城市的天气。
Gemini 选择合适的 MCP 工具。
Playwright 打开天气网站。
在搜索框中输入所请求的城市。
从自动完成列表中选择该城市。
加载天气页面。
从页面中提取天气信息。
将提取的文本返回给 Gemini。
Gemini 使用提取的信息生成最终回答。
功能
支持以色列城市的天气查询。
接受希伯来语或英语的城市名称。
使用 Playwright 导航实时天气网站。
直接从网站提取天气信息。
在回答前将提取的内容提供给语言模型。
使用网站内容,而不是依赖模型的内部知识。
安装
克隆仓库:
git clone https://github.com/YisNiz/AI-MCP-with-RAG-project安装所需包:
pip install -r requirements.txt创建一个包含以下内容的 .env 文件:
GEMINI_API_KEY=YOUR_API_KEY安装 Playwright 浏览器:
playwright install运行项目:
python host.py示例问题
耶路撒冷的天气怎么样?
特拉维夫的天气
מזג האוויר בחיפה
מה מזג האוויר בבאר שבע?
备注
天气信息来自实时天气网站。
语言模型被指示使用提取的网站内容进行回答。
该项目演示了 LLM 与 MCP 工具和浏览器自动化的集成。
作者
Yisca Nazri
This server cannot be deployed
Maintenance
Related MCP Connectors
Get current weather for any city and create images from your prompts. Streamline planning, reports…
Web scraping, browser automation, screenshots and AI data extraction for AI agents via MCP.
Weather, code search, currency & Solana trust scoring as MCP tools. Free, no API key needed.
Web search, scraping, RAG answers with citations, and translation as MCP tools.
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 gradedqualityDmaintenanceRetrieves current weather information for Israeli cities by scraping a live weather website using Playwright, and provides the data to the language model as context.-
- FlicenseNot gradedqualityCmaintenanceEnables LLMs to fetch real-time, localized weather forecasts for Israeli cities by using Playwright to autonomously navigate and scrape weather2day.co.il, including handling Hebrew queries and stateful web interactions.-