Skip to main content
Glama
sara-simi-git

MCP Weather Assistant

MCP Weather Assistant

An interactive weather assistant built with the Model Context Protocol (MCP). The host connects to two local MCP servers, publishes their tools to an OpenRouter-compatible language model, and lets the model decide when to retrieve weather information.

Features

  • Weather forecasts for locations in the United States through the National Weather Service API.

  • Active weather alerts for a United States state.

  • Israeli weather forecasts through the weather2day.co.il website and a visible Chromium browser controlled by Playwright.

  • One interactive terminal chat interface.

  • Multiple MCP servers connected over stdio.

  • Automatic tool discovery and namespacing to avoid collisions between servers.

Related MCP server: MCP Weather Assistant

Project Structure

File

Purpose

host.py

Main application. Connects to MCP servers, calls OpenRouter, routes tool calls, and runs the chat loop.

client.py

Reusable MCP stdio client wrapper. Starts a server with the current Python interpreter and lists its tools.

weather_USA.py

MCP server backed by the National Weather Service API.

weather_Israel.py

MCP server backed by weather2day.co.il and Playwright.

pyproject.toml

Python project metadata and declared dependencies.

uv.lock

Locked dependency versions for uv-based environments.

.env

Local environment variables. This file is ignored by Git.

Requirements

  • Windows, macOS, or Linux.

  • Python 3.13 or newer.

  • An OpenRouter API key.

  • Internet access to OpenRouter, api.weather.gov, and weather2day.co.il.

  • Chromium, installed through Playwright, for Israeli weather queries.

  • A virtual environment is recommended.

Installation

Using uv

From the project directory:

uv sync
uv run playwright install chromium

The project currently imports httpx directly. If it is not already present in the locked environment, install it with:

uv add httpx

Using standard Python tooling

py -3.13 -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install anthropic mcp python-dotenv playwright openai google-genai httpx
python -m playwright install chromium

On macOS or Linux, activate the environment with:

source .venv/bin/activate

The declared dependencies include several provider SDKs that are not currently used by host.py; they remain part of the project metadata for compatibility with the template.

Configuration

Create a .env file in the project root:

OPENROUTER_API_KEY=your_openrouter_api_key

host.py loads this file with python-dotenv and sends the key as a Bearer token to OpenRouter. Do not commit .env or expose the key in source control, logs, screenshots, or error reports.

The current model is configured in host.py:

MODEL = "nvidia/nemotron-3-super-120b-a12b:free"

Change this constant if you want to use another OpenRouter model that supports tool calling.

Running the Assistant

With uv:

uv run python host.py

With an activated virtual environment:

python host.py

You should see a startup message followed by a Query: prompt. Type a question and press Enter. Type quit to stop the application.

Example questions:

What is the forecast for 34.05, -118.25?
Are there any active weather alerts in California?
What is the weather forecast in Tel Aviv?

The host prints tool calls as they occur, followed by the model's final response.

MCP Servers and Tools

United States server

weather_USA.py starts an MCP server named weather-USA and provides:

  • get_alerts_in_USA(state)

    • state: two-letter state code such as CA or NY.

    • Uses the NWS active-alerts endpoint.

  • get_forecast_in_USA(latitude, longitude)

    • latitude: decimal latitude.

    • longitude: decimal longitude.

    • Resolves the location through the NWS points endpoint, then returns the first five forecast periods.

The NWS API request uses Accept: application/geo+json and a custom User-Agent.

Israel server

weather_Israel.py starts an MCP server named weather-Israel and provides:

  1. open_weather_forecast_israel()

    • Opens a non-headless Chromium browser and navigates to the Israeli forecast website.

  2. enter_weather_forecast_city_israel(city)

    • Enters a city name and waits for autocomplete suggestions.

  3. select_weather_forecast_city_israel()

    • Selects the first autocomplete suggestion and waits for the forecast page.

  4. get_forecast_content_israel()

    • Extracts visible text from the loaded page, cleans empty lines, and limits the result to 4,000 characters.

The Israeli tools are stateful and must be called in order. The browser must be opened before entering a city, and a city must be selected before extracting the forecast.

Architecture

User terminal
    |
    v
host.py (ChatHost)
    |-- OpenRouter chat-completions API
    |
    |-- client.py -> weather_USA.py -> api.weather.gov
    |
    `-- client.py -> weather_Israel.py -> Playwright -> weather2day.co.il

At startup, ChatHost creates one MCPClient for each weather server. Each client launches its server as a child process using the same Python interpreter as the host. The host discovers all MCP tools and exposes them to OpenRouter using function-calling schemas.

To prevent duplicate names, tools are exposed to the model as:

<server_script_name>__<tool_name>

For example, the USA alert tool is exposed as weather_USA__get_alerts_in_USA. When OpenRouter requests a tool, the host maps that public name back to the owning MCP client and original tool name, executes it, and sends the result back into the model conversation.

Running an Individual MCP Server

Each server can be started directly for MCP-compatible clients or for basic smoke testing:

python weather_USA.py
python weather_Israel.py

These programs use MCP stdio transport, so they are intended to communicate with an MCP client rather than display a normal web page or command prompt.

Troubleshooting

ModuleNotFoundError: No module named 'httpx'

Install the missing dependency:

uv add httpx

or:

python -m pip install httpx

Chromium does not start

Install the Playwright browser binary:

python -m playwright install chromium

The Israeli server intentionally launches Chromium with headless=False, so a desktop session is required for that provider.

OpenRouter authentication fails

Check that .env is in the same directory as host.py, that the variable is named exactly OPENROUTER_API_KEY, and that the key is active. Restart the host after changing the file.

No tools are available

Confirm that both server scripts exist in the project root and that the host is started from that directory. The host currently uses the relative paths ./weather_USA.py and ./weather_Israel.py.

A weather request fails

The application depends on external services. Check internet access, the NWS response for the requested coordinates or state, and whether the Israeli website's HTML selectors have changed.

Security and Operational Notes

  • host.py and the NWS client disable TLS certificate verification with verify=False. This may be necessary in the current network environment, but it reduces transport security and should be replaced with normal certificate verification in production.

  • OpenRouter receives the user's query and the results returned by weather tools.

  • The Israeli provider opens a visible browser and scrapes the page's body text. Website layout changes can break the selectors or alter the extracted content.

  • The application has no persistent conversation history; each terminal query starts a new model message list.

  • Errors are printed to the terminal and are not written to a logging service.

Development Notes

The MCP server scripts expose tools through FastMCP decorators and use async functions for network and browser operations. Keep the stdio channel reserved for MCP protocol traffic when modifying a server; diagnostic output should be handled carefully so it does not corrupt protocol communication.

There are currently no automated tests in the repository. A useful next test layer would mock the NWS responses, OpenRouter tool-call responses, and Playwright page interactions so the orchestration can be verified without network access or a browser.

License

No license file is currently included in this repository.

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

  • -
    license
    Not graded
    quality
    C
    maintenance
    MCP server that enables LLMs to retrieve weather forecasts for Israeli cities by automating a browser with Playwright, and also provides US weather alerts and forecasts via NWS API.

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.

  • US weather & geo for AI agents: forecasts, alerts, earthquakes, elevation, geocoding. No keys.

  • Get US weather forecasts, active alerts, and current observations.

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/sara-simi-git/MCP_Weather_Agent-'

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