Skip to main content
Glama
yehyaabk

Weather MCP Agent

by yehyaabk

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:

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.md

Prerequisites

  • 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 SDK

  • httpx — for async HTTP requests to the OpenWeatherMap API

  • python-dotenv — for loading environment variables from .env

  • An OpenWeatherMap API key — get one at openweathermap.org/api

Installing dependencies with uv

uv sync

Setting up your .env file

Create a .env file at the project root:

OPENWEATHER_API_KEY=your_api_key_here

Connecting 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.py

Example 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.py

Available Tools

Tool

Description

fetch_current_weather

Fetches the current weather conditions for a given city.

fetch_weather_forecast

Fetches the weather forecast (3-hour intervals) for a given city.

Available Tools

2 tools
fetch_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.

ParametersJSON Schema
NameRequiredDescriptionDefault
cityYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It details the return dictionary keys (city, country, temperature, feels-like, min/max, humidity, weather description) and states that an 'error' key is returned on failure. This provides solid insight into the tool's behavior, though it does not cover edge cases like unknown cities or units, which would push it to a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured: a single purpose sentence followed by Args and Returns sections that clearly delineate parameter and return behavior. Every sentence contributes value without redundancy, and the format follows expected conventions for Python docstrings.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with one parameter and no annotations, the description covers the purpose, the parameter, the return structure, and error handling. Although an output schema is present, the description supplements it by naming the specific fields and the error key, making the tool fully understandable. It lacks only minor context (like units or city validation), which is not critical given the simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has one parameter 'city' with no description (0% schema coverage). The description's Args section says 'city (str): Name of the city to fetch weather data for,' which adds a minimal clarification that it is a name string. This is helpful but does not elaborate on valid formats (e.g., 'London' vs 'London, UK'). The parameter is simple, so the description provides adequate but not rich semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description begins with 'Fetch the current weather conditions for a given city,' which uses a specific verb 'Fetch' and clearly identifies the resource (current weather conditions) and the target (a city). This distinguishes it from its sibling tool 'fetch_weather_forecast,' which is for forecasts, making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for current conditions but does not explicitly state when to use this tool versus the sibling 'fetch_weather_forecast.' The context is clear from the name and wording ('current weather'), but there is no explicit exclusion or mention of an alternative. Since the sibling is named for forecasts, the intended use is strongly implied, so a 4 is appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
cityYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the burden of behavioral disclosure. It does transparently describe the return format and error behavior (returning an 'error' key on failure). However, it does not mention potential prerequisites, rate limits, or side effects, though the tool is clearly a read-only operation. The error handling is a positive, but other behavioral aspects are omitted.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured. It promptly states the action, then details the argument and return value in a clear Args/Returns format. No words are wasted; every sentence contributes useful information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity of the tool (one parameter, no annotations, limited schema), the description is fairly complete. It covers purpose, parameter semantics, return structure, and error handling. The only gap is the lack of explicit usage guidance relative to the sibling tool, but that is a minor omission for such a straightforward fetch tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema only provides a 'city' string with a title of 'City', and schema description coverage is 0%. The description compensates by explaining that the parameter is the 'Name of the city to fetch forecast data for', adding meaning beyond the schema. It could have provided more detail on city format, but for a single required parameter, it is helpful.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Fetch the weather forecast') and the resource ('for a given city'). It also distinguishes itself from the sibling tool 'fetch_current_weather' by specifying '3-hour intervals' as part of the forecast data, making it clear this is for multi-period forecasts rather than current conditions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when a forecast is needed, but it does not explicitly state when to use this tool over 'fetch_current_weather' or mention any exclusions. The '3-hour intervals' hint differentiates it, but no clear guidance on selection criteria is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 2 tool updatesv0.1.0
    • First observedfetch_current_weather
    • First observedfetch_weather_forecast

TDQS

A4.2/5.0
Disambiguation5/5

The two tools are clearly distinct: one provides current conditions, the other provides a forecast. There is no overlap or ambiguity between them.

Naming Consistency5/5

Both tool names follow a consistent 'fetch_' + noun pattern, with names fetch_current_weather and fetch_weather_forecast. The naming is predictable and uniform.

Tool Count3/5

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.

Completeness4/5

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.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides 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.
    11
    MIT

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/yehyaabk/mcp_weather_agent'

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