mcp-weather-israel-playwright
MCP with Playwright - Weather (Israel)
이 프로젝트는 Malka Baruch의 강의 "MCP with Playwright"에서 진행된 MCP(Model Context Protocol) 과제입니다.
프로젝트 목적
MCP 서버는 Playwright를 사용하여 실제 브라우저를 구동하고 https://www.weather2day.co.il/forecast에서 데이터를 스크래핑하여 이스라엘 도시의 날씨 예보를 제공합니다. 목표는 LLM(Claude)이 노출된 Tools를 통해 브라우저를 제어하여 전통적인 API 없이 실시간 웹 데이터를 가져올 수 있도록 하는 것입니다.
Related MCP server: MCP Playwright Weather Israel
내가 구현한 것
Tools (MCP 서버 - weather_Israel.py):
open_weather_forecast_israel()Chromium 브라우저를 열고(headless=False) 예보 사이트로 이동합니다. 브라우저와 Page 인스턴스를 전역 컨텍스트에 유지하여 Tool 호출 간에 지속성을 유지합니다.
enter_weather_search_israel(city: str)사이트의 검색 필드에 주어진 도시 이름을 입력하고 자동 완성 목록이 나타날 때까지 기다립니다.
select_weather_forecast_city_israel()첫 번째 자동 완성 결과를 선택하고(또는 Enter 키를 누르고) 예보 페이지가 로드될 때까지 기다립니다.
extract_weather_data_israel()로드된 페이지에서 보이는 예보 텍스트를 추출하고 광고 및 UI 노이즈를 제거하여 LLM이 유용한 날씨 데이터만 받을 수 있도록 정리합니다.
실행 방법
project-template폴더에서:
cd C:\Users\user1\Downloads\dovrot-ai-projects-master\dovrot-ai-projects-master\8-mcp\project-template
uv sync
uv run playwright install chromium호스트(터미널 채팅 인터페이스)를 시작합니다:
uv run host.py호스트 채팅 프롬프트에서 다음과 같은 질문을 합니다:
"מה התחזית בתל אביב היום?"
"תן חיזוי גשם בתל אביב מחר"
호스트는 요청을 weather-Israel MCP로 라우팅하고 LLM이 Tools를 순서대로(열기 → 입력 → 선택 → 추출) 호출하여 예보를 가져와 반환합니다.
제출 안내
리포지토리를 GitHub에 공개 리포지토리로 푸시합니다.
이
README.md를 포함하여 목적과 실행 방법을 설명합니다.실제 API 키가 포함된
.env가 커밋되지 않도록 합니다. 플레이스홀더가 포함된.env.example을 사용하세요.
참고 사항 및 문제 해결
Anthropic SDK(Claude)로 실행하는 경우 환경에
ANTHROPIC_API_KEY가 설정되어 있는지 확인하세요.Playwright 선택자가 깨지면(사이트가 변경된 경우) 사이트의 HTML(DevTools로 검사)에 따라
weather_Israel.py의 선택자를 업데이트하세요.
이 README는 강의 제출 가이드라인(목적, 실행 단계, 예시 질문)을 따릅니다.
Available Tools
4 toolsenter_weather_search_israelA
Enter the city name into the search field and wait for autocomplete results.
This uses the shared Page in _PLAYWRIGHT_CONTEXT so open_weather_forecast_israel
should be called first.
Inputs: city (required). Returns: result
extract_weather_data_israelA
Extract and clean the visible forecast text from the current page.
This expects that a forecast page is already loaded in the shared Page (i.e., after select_weather_forecast_city_israel). It will attempt to extract the main forecast container text and remove obvious noise like advertisements, links, and short UI strings.
Inputs: no named parameters. Returns: result
open_weather_forecast_israelA
Open the forecast site and keep the browser/page open for subsequent tools.
Inputs: no named parameters. Returns: result
select_weather_forecast_city_israelA
Select the first autocomplete result (or press Enter) and wait for forecast page to load.
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 distinct step in a clear workflow: open site, search, select city, extract data. No overlapping responsibilities.
All tools follow a consistent verb_weather_forecast_city_israel snake_case pattern, making the purpose of each clear.
With 4 tools, the set is well-scoped for the specific task of fetching a weather forecast for an Israeli city. No unnecessary tools or omissions.
The tools cover the primary workflow, but lack error recovery or reset capabilities (e.g., no tool to handle failed city lookup or restart from scratch). Still sufficient for the intended use case.
Related MCP Connectors
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Hosted browser for agents: open pages, search the web, extract data, read PDFs and take screenshots.
A real browser for your agent: screenshots, page checks, Markdown and PDFs.
Web search, browser automation, scraping, crawling and CAPTCHA solving for AI agents.
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables LLMs to query real-time weather data in Israel by automating a browser to scrape weather2day.co.il.4-
- FlicenseAqualityDmaintenanceEnables an LLM to retrieve Israeli weather forecasts by controlling a real Chromium browser to search and scrape a weather site.5-
- 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 automating a browser to navigate Weather2Day, providing tools for city search and content extraction.4-