Weather MCP Agent
Enables natural-language interaction with weather data by using Ollama to interpret user prompts, extract tool calls, and answer general questions.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Weather MCP Agent What's the current weather in Tokyo?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Weather MCP Agent
Introduction
This project was built by Yehya Abou Khechfe.
The project is a Weather MCP Agent that retrieves current weather conditions and forecasts for any city, using the OpenWeatherMap API.
The MCP server exposes weather tools that can be consumed in multiple ways:
Connected to Ollama (local LLM) for natural-language interaction — see
ollama_weather_mcp/ollama_mcp_client.pyandollama_weather_mcp/ollama_mcp_server.py.Connected to Claude Desktop — add the server to your Claude configuration file (
claude_desktop_config.json) as described below.A simple client with no LLM integrated, used for testing the server directly — see
weather_mcp/mcp_client.pyandweather_mcp/mcp_server.py.
Related MCP server: OpenWeatherMap_MCP
Project Structure
wheather-mcp-agent/
├── ollama_weather_mcp/
│ ├── ollama_mcp_client.py # Interactive client powered by Ollama
│ └── ollama_mcp_server.py # MCP server extended with a prompt for Ollama
├── weather_mcp/
│ ├── __init__.py
│ ├── mcp_client.py # Simple client (no LLM) for testing the server
│ └── mcp_server.py # Core MCP server exposing the weather tools
├── .env # Environment variables (OpenWeatherMap API key)
├── main.py
├── pyproject.toml
└── README.mdPrerequisites
Python 3.10+
uv — used as the package and project manager
Ollama installed and running locally, with a pulled model (e.g.
llama3)mcp[cli]— the MCP Python SDKhttpx— for async HTTP requests to the OpenWeatherMap APIpython-dotenv— for loading environment variables from.envAn OpenWeatherMap API key — get one at openweathermap.org/api
Installing dependencies with uv
uv syncSetting up your .env file
Create a .env file at the project root:
OPENWEATHER_API_KEY=your_api_key_hereConnecting to Claude Desktop
To use this MCP server with Claude Desktop, add it to your Claude configuration file (claude_desktop_config.json):
{
"mcpServers": {
"weather": {
"command": "uv",
"args": ["run", "--directory", "C:\\path\\to\\wheather-mcp-agent", "weather_mcp/mcp_server.py"]
}
}
}Restart Claude Desktop after saving the configuration — the weather tools should then appear as available tools in a new conversation.
Running the Ollama-powered client
uv run .\ollama_weather_mcp\ollama_mcp_client.pyExample session
[INFO] Server-client connection initialized
Weather Assistant — ask about current conditions or the forecast for any city.
You can also ask general questions.
Type 'q', 'exit', or 'quit' to leave.
You: what is the current weather in paris
[INFO] Requesting Ollama to extract tool and arguments...
Current weather in Paris, FR: clear sky, 32.79°C (feels like 31.48°C), ranging from 32.3°C to 35.03°C, with 28% humidity.
You: and tomorrow ?
[INFO] Requesting Ollama to extract tool and arguments...
--------------------
Weather Forecast in Paris, FR
2026-07-29 12:00:00 — 33.5°C, clear sky
2026-07-29 15:00:00 — 35.88°C, clear sky
2026-07-29 18:00:00 — 37.16°C, clear sky
2026-07-29 21:00:00 — 30.5°C, clear sky
2026-07-30 00:00:00 — 25.28°C, clear sky
2026-07-30 03:00:00 — 22.37°C, scattered clouds
2026-07-30 06:00:00 — 21.97°C, broken clouds
2026-07-30 09:00:00 — 24.71°C, overcast clouds
2026-07-30 12:00:00 — 28.47°C, overcast clouds
2026-07-30 15:00:00 — 33.05°C, clear sky
--------------------
You: what is the capital of lebanon
[INFO] Requesting Ollama to extract tool and arguments...
[INFO] Requesting Ollama to answer a general question ...
Answer: The capital of Lebanon is Beirut (بيروت).
You:Running the simple test client (no LLM)
Useful for testing the MCP server's tools directly, without going through an LLM:
uv run .\weather_mcp\mcp_client.pyAvailable Tools
Tool | Description |
| Fetches the current weather conditions for a given city. |
| Fetches the weather forecast (3-hour intervals) for a given city. |
Available Tools
2 toolsfetch_current_weatherA
Fetch the current weather conditions for a given city.
Args: city (str): Name of the city to fetch weather data for.
Returns: dict[str, Any]: A dictionary containing the city, country, temperature, feels-like temperature, min/max temperature, humidity, and weather description. Returns a dictionary with an "error" key if the request fails or the data cannot be retrieved.
Inputs: city (required). Returns: object
fetch_weather_forecastA
Fetch the weather forecast for a given city.
Args: city (str): Name of the city to fetch forecast data for.
Returns: dict[str, Any]: A dictionary containing the city, country, and a list of forecast entries (temperature, datetime, and description) at 3-hour intervals. Returns a dictionary with an "error" key if the request fails or the data cannot be retrieved.
Inputs: city (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools are clearly distinct: one provides current conditions, the other provides a forecast. There is no overlap or ambiguity between them.
Both tool names follow a consistent 'fetch_' + noun pattern, with names fetch_current_weather and fetch_weather_forecast. The naming is predictable and uniform.
With only 2 tools, the set is on the thin side for a weather server, though it covers the core current and forecast needs. It feels slightly minimal but not inadequate.
The server covers the two most essential weather operations: current conditions and forecasts. Notable gaps include historical weather data and alerts, but these are optional extras rather than essential missing functionality.
Related MCP Connectors
Current weather and forecast lookup as an agent tool.
Get current weather for any city and create images from your prompts. Streamline planning, reports…
Global weather via Open-Meteo: forecast, historical, marine, air quality, geocoding, elevation.
OpenWeather MCP — wraps the OpenWeatherMap API (openweathermap.org)
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides real-time weather data, forecasts, and historical weather information from OpenWeatherMap API for Claude Desktop, enabling natural language queries about current conditions, forecasts, air quality, and weather alerts worldwide.11MIT
- AlicenseNot gradedqualityDmaintenanceProvides current weather and forecasts for any city via natural language, using OpenWeatherMap API and OpenAI for conversational interface.10GPL 3.0
- AlicenseNot gradedqualityDmaintenanceEnables Claude Desktop to query real-time weather information, forecasts, and history via the OpenWeatherMap API.11 npm99MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude to fetch real-time weather data for any city using the OpenWeatherMap API.11 npmMIT