Skip to main content
Glama
mcp-weather-connector

mcp-weather-connector

by KDimkuz

mcp-weather-connector

Servidor MCP que da a un agente de IA acceso a la previsión del tiempo a través de Open-Meteo, una API pública sin clave ni registro.

Pequeño, a propósito: el repositorio trata sobre cómo está construida la capa de herramientas para un agente, no sobre el tiempo. El tiempo aquí es un pretexto comprensible para mostrar el límite de confianza entre el modelo y el mundo exterior.

Para qué sirve

El Model Context Protocol es un modo de dar a un modelo de lenguaje el derecho a realizar acciones en servicios externos. En cuanto aparece ese derecho, surge la pregunta: ¿qué pasa si el modelo transmite basura a la herramienta y un servicio externo, justo en ese momento, devuelve un 503?

Tres decisiones que se muestran explícitamente en este código:

La entrada desde el modelo no es de confianza. El modelo puede pasar una cadena vacía, una parrafada de diez kilibytes o caracteres de control. Todo eso se filtra en server.py antes de la llamada de red, no en una API externa.

Los errores se distinguen por tipo. Un 4xx no tiene sentido repetirlo: es un error de la solicitud y su repetición no lo resuelve. Un 5xx suele ser un fallo puntual: un solo reintento con una pausa. La lógica está en _get_json y se verifica con pruebas que cuentan las llamadas.

Hacia afuera sale texto, no JSON crudo. El agente no tiene nada que supoñarse ni mucho en lo que equivocarse al contarlo. Una respuesta 200 sin el campo previsto se considera fallo, no una excusa para devolver vacío.

Además: el número de días fuera del rango se corrige al límite, no se trata como un error. Si solicitaron una previsión de 30 días, es más útil entregar siete que derrumbar el diálogo con un mensaje de error.

Related MCP server: open-meteo-mcp-server

Herramientas

Herramienta

Qué hace

current_weather(city)

Tiempo actual: temperatura, sensación térmica, humedad, viento

forecast(city, days=3)

Previsión de 1 a 7 días con precipitaciones

locate(query)

Comprueba que la localidad existe y concreta el país

locate sirve para un único escenario: cuando el agente no está seguro de cómo se escribe, es mejor consultar el usuario que mostrar en sileno la información del lugar equivocado.

Instalación

pip install -e .

Conexión con Claude Desktop

En claude_desktop_config.json:

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

Después de reiniciar la aplicación, las herramientas aparecerán en la lista de elementos disponibles.

Desarrollo

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

Las pruebas cubren lo que sí falla: un vacío y sobreescamado, una cantidad no numérica de días, 4xx sin repetición, 5xx con un reintento, unacceso con éxito al segundo preciso, una respuesta 200 sin carga útil y un código de tiempo desconocido. HTTP se simula con respx, así que no se necesita red en las pruebas.

Estructura

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

El código de red está separado de la capa MCP deliberadamente: el cliente se prueba solo, y las herramientas del agente quedan como una capa fina sobre funciones claras.

Licencia

MIT

Available Tools

3 tools
current_weatherB

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

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

NameRequiredDescriptionDefault
cityYes

Output 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. Значения вне диапазона приводятся к границе, а не считаются ошибкой.

NameRequiredDescriptionDefault
cityYes
daysNo

Output 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

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

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

NameRequiredDescriptionDefault
queryYes

Output 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

ActivityStale
ResponsivenessNo recent community issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    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.
    4 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
    2,437 npm
    MIT
  • A
    license
    Not graded
    quality
    D
    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
    D
    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
    7 npm
    ISC