Skip to main content
Glama
KDimkuz

mcp-weather-connector

by KDimkuz

mcp-weather-connector

An MCP server that gives an AI agent access to weather forecasts through Open-Meteo — a public API with no key or registration required.

Deliberately small: the repository is about how the tool layer for an agent is structured, not about weather. Weather here is a relatable pretext for showing the trust boundary between the model and the outside world.

Why

Model Context Protocol is a way to give a language model the right to take actions in external services. Once that right exists, the question arises: what happens if the model passes garbage to a tool right as the third-party service returns a 503?

Three decisions are made explicit in this code:

Model input is untrusted. The model can pass an empty string, a ten-kilobyte wall of text, or control characters. All of this is filtered out in server.py before the network call — not in a third-party API.

Errors are distinguished by type. Retrying a 4xx is pointless — it is a request error, and a retry will not fix it. A 5xx is more likely a one-off failure — one retry with a pause. The logic lives in _get_json and is verified by tests that assert the call count.

What goes out is text, not raw JSON. The agent has nothing to second-guess and no way to err when relaying the answer. A 200 response without the required field counts as a failure, not as a reason to return an empty value.

As a separate note: a day count outside the supported range is clamped to the boundary rather than treated as an error. If the model asks for a 30-day forecast, it is more useful to return seven days than to break the conversation with an error message.

Related MCP server: open-meteo-mcp-server

Tools

Tool

What it does

current_weather(city)

Current weather: temperature, feels like, humidity, wind

forecast(city, days=3)

Forecast for 1–7 days with precipitation

locate(query)

Checks whether a populated place exists and clarifies the country

locate exists for the single scenario where the agent is not sure about the spelling: better to check with the user than to silently return the weather for the wrong city.

Installation

pip install -e .

Connecting to Claude Desktop

In claude_desktop_config.json:

{
  "mcpServers": {
    "weather": {
      "command": "mcp-weather"
    }
  }
}

After the app restarts, the tools will appear in the list of available tools.

Development

pip install -e ".[dev]"
pytest
ruff check .

The tests cover what actually breaks: empty and oversized input, a non-numeric number of days, a 4xx with no retry, a 5xx with one retry, success on the second attempt, a 200 response without a payload, and an unknown weather code. HTTP is mocked with respx — no network is needed in the tests.

Structure

src/mcp_weather/
    client.py    — работа с Open-Meteo: типы, повторы, разбор ответа
    server.py    — MCP-слой: валидация входа и форматирование вывода
tests/
    test_tools.py

The network code is deliberately separated from the MCP layer: the client is tested on its own, and the agent's tools remain a thin wrapper over straightforward functions.

License

MIT

Available Tools

3 tools
current_weatherB

Текущая погода в указанном городе.

Args: city: Название населённого пункта, например «Ижевск» или «Berlin».

ParametersJSON Schema
NameRequiredDescriptionDefault
cityYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior2/5

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

No annotations are provided, so the description must fully explain behavioral traits, but it only says 'current weather'. It does not mention data source, units, freshness, failure behavior, or any other operational considerations that an agent should know before invoking it.

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 concisely four intuitive sentences, directly states the core function, and uses a simple 'Args' outline for the parameter. There is no repetition or unstructured detail, making it easy to parse.

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

Completeness3/5

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

For a simple one-parameter tool, the description is mostly sufficient, and an output schema exists so the return value is largely handled. However, the lack of usage guidance and behavioral disclosure leaves the agent with incomplete context beyond the essential call pattern, bringing it to a minimal viable level.

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 input schema only has 'city' with no description, so the description's extra explanation of the city parameter is valuable. It defines city as a locality and gives concrete examples like 'Ижевск' or 'Berlin', which adds meaning beyond the schema.

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

Purpose4/5

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

The description states the specific verb and resource: 'Текущая погода в указанном городе' (current weather in a specified city). It clearly identifies city as the target and provides examples, and the word 'текущая' distinguishes it from the sibling 'forecast', though it does not explicitly name alternatives.

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

Usage Guidelines2/5

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

No guidance is given about when to use this tool versus the siblings 'forecast' or 'locate'. The description only defines the tool's function; it does not mention exclusions, alternative conditions, or scenarios that would favor another tool.

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

forecastA

Прогноз погоды на несколько дней вперёд.

Args: city: Название населённого пункта. days: Сколько дней показать, от 1 до 7. Значения вне диапазона приводятся к границе, а не считаются ошибкой.

ParametersJSON Schema
NameRequiredDescriptionDefault
cityYes
daysNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.9/5.0
Behavior4/5

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

No annotations are present, so the description carries the behavioral disclosure burden. It adds a useful non-obvious behavior: out-of-range days are clamped to the bounds rather than treated as errors. It does not cover invalid city behavior or errors, but this is a low-risk read-style tool and the main complexity is disclosed.

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 compact, front-loaded with the purpose, and uses a clean Args block. Every sentence contributes either to selecting the tool or calling it correctly, with no filler.

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 an output schema and only two self-explanatory parameters, the description is largely sufficient for a correct call. The main missing piece is explicit guidance about choosing between forecast and current_weather, which remains implicit rather than stated.

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?

Schema description coverage is 0%, so the description compensates by explaining both parameters: city is the populated place name, and days controls how many days to return with the 1–7 range. It adds the clamping behavior, which the schema cannot express. The default value is left to the schema, which is acceptable.

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

Purpose4/5

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

The description clearly states the tool returns a weather forecast for multiple upcoming days, which identifies the resource and the specific purpose. It also differentiates it from current_weather by the 'несколько дней' framing, though it does not explicitly name the sibling.

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 multi-day forecast purpose and 1–7 day range imply when it should be used, especially compared to current_weather. However, the description never explicitly says 'use current_weather for current conditions' or states when forecast should not be used, leaving the choice to inference.

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

locateA

Проверяет, что населённый пункт существует, и уточняет страну.

Полезно, когда агент не уверен в написании: лучше уточнить у пользователя, чем молча выдать погоду не того города.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior3/5

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

No annotations are present, so the description carries the behavioral disclosure burden. It explains that the tool verifies existence and returns country information, and it includes a useful user-facing safety rule. However, it does not describe error behavior, ambiguous results, or what happens when the query matches multiple places.

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?

Two short sentences: the first states the core behavior, the second gives a concrete usage scenario. There is no filler, and the most important information is front-loaded.

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 single-parameter lookup tool with an output schema present, the description is sufficient for basic calling decisions. It would benefit from covering edge cases like ambiguous or nonexistent places, but given the small surface and clear sibling context, the definition is adequately complete.

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 says only that 'query' is a string with no description (0% coverage). The description compensates by indicating that the parameter is a populated place name whose spelling the agent may be uncertain about, adding meaningful semantics to the otherwise empty schema.

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 states a specific action — 'checks that a populated place exists' and 'clarifies the country' — with a clear resource. It also distinguishes itself from weather siblings by focusing on location verification rather than weather output.

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 explicitly tells the agent when to use this tool: when uncertain about the spelling of a place name, it is better to ask the user than to silently return weather for the wrong city. It clearly implies when this tool matters, though it does not explicitly name alternatives or 'when not to use.'

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.

  1. 3 tool updatesv1.0.0
    • First observedcurrent_weather
    • First observedforecast
    • First observedlocate

TDQS

A3.8/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: current conditions, multi-day forecast, and location validation. There is no overlap or ambiguity between them, even though two tools accept a city argument.

Naming Consistency3/5

Naming is readable but inconsistent: current_weather is a noun phrase, forecast is a bare noun, and locate is a verb. A more consistent pattern like get_current_weather, get_forecast, and validate_location would be clearer.

Tool Count5/5

Three tools is well-scoped for a weather connector. Each tool covers a necessary function without unnecessary overlap or bloat.

Completeness4/5

The core weather workflows are covered: current conditions and multi-day forecasts, with optional location validation. Minor gaps exist, such as lacking unit selection or weather alerts, but these are not essential for most use cases.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables AI assistants to retrieve current weather, forecasts, and summaries for any global location using the Open-Meteo API, with no API key required.
    5 npm
    Creative Commons Zero v1.0 Universal
  • A
    license
    A
    quality
    D
    maintenance
    Provides comprehensive access to Open-Meteo weather APIs, including forecasts, historical data, air quality, marine weather, and geocoding, enabling LLMs to retrieve weather information and location data.
    17
    361 npm
    1
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides live weather data (current conditions, forecasts) and city geocoding through Open-Meteo API, enabling AI assistants to answer weather queries without an API key.
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Provides weather forecasts and geocoding lookup using free Open-Meteo APIs, enabling LLMs to query real-time weather and multi-day forecasts for any location.
    1
    2 npm
    ISC