Skip to main content
Glama
RashJrEdmund

weather-mcp

by RashJrEdmund

preview image

weather-mcp

Servidor MCP en TypeScript que expone herramientas meteorológicas respaldadas por OpenWeatherMap.

Herramientas

Herramienta

Descripción

get_current_weather

Condiciones actuales por nombre de ciudad o lat/lon

get_forecast

Pronóstico de 5 días / 3 horas por lat/lon

Transportes

Modo

Env

Úsalo cuando

stdio (por defecto)

TRANSPORT=stdio

Cursor local / Claude Desktop

Streamable HTTP

TRANSPORT=http

Despliegue (Render, etc.) / URL remota

Documentación oficial de MCP: https://modelcontextprotocol.io/docs/

En vivo remoto (Render)

Desplegado en el plan gratuito de Render:

Configuración de Cursor (remoto)

Añade esto a Settings → MCP o ~/.cursor/mcp.json:

{
  "mcpServers": {
    "weather": {
      "url": "https://weather-mcp-ts.onrender.com/mcp"
    }
  }
}

Sin compilación local ni clave API en Cursor: la clave vive en las variables de entorno de Render.

Plan gratuito de Render: el servicio se apaga tras ~15 minutos de inactividad. La siguiente petición es un arranque en frío y puede tardar hasta ~50 segundos antes de que MCP responda. Llama a /health una vez si las herramientas de Cursor parecen atascadas al despertar.

Related MCP server: mcp-weatherapi

Requisitos previos (solo local)

Configuración (local)

pnpm install
cp .env.example .env

Edita .env y establece tu clave:

OPEN_WEATHER_MAP_API_KEY=your_key_here
TRANSPORT=stdio

Compila el servidor:

pnpm run build

Esto escribe el punto de entrada ejecutable en dist/index.js.

Añadir a Cursor (stdio local)

Cursor no inicia este proceso desde la raíz del proyecto por defecto para la carga de variables de entorno, así que pasa el archivo de entorno con una ruta absoluta mediante la bandera --env-file de Node.

  1. Abre Cursor Settings → MCP, o edita ~/.cursor/mcp.json.

  2. Añade una entrada weather bajo mcpServers:

{
  "mcpServers": {
    "weather": {
      "command": "node",
      "args": [
        "--env-file",
        "/ABSOLUTE/PATH/TO/weather-mcp/.env",
        "/ABSOLUTE/PATH/TO/weather-mcp/dist/index.js"
      ]
    }
  }
}

Reemplaza /ABSOLUTE/PATH/TO/weather-mcp con tu ruta real del proyecto (p. ej. ejecuta pwd desde la raíz del repositorio). Mantén TRANSPORT=stdio (o sin definir) en .env.

Alternativa: env en línea

{
  "mcpServers": {
    "weather": {
      "command": "node",
      "args": [
        "/ABSOLUTE/PATH/TO/weather-mcp/dist/index.js"
      ],
      "env": {
        "OPEN_WEATHER_MAP_API_KEY": "your_key_here",
        "TRANSPORT": "stdio"
      }
    }
  }
}

Prefiere .env + --env-file para que la clave no quede en mcp.json.

  1. Guarda y luego alterna el servidor apagado/encendido en Settings → MCP (o reinicia Cursor).

  2. Confirma que el servidor aparece como conectado y lista get_current_weather y get_forecast.

Tras cambios de código

pnpm run build

Luego recarga el servidor MCP en Cursor.

Streamable HTTP (local)

El modo HTTP sirve MCP en POST/GET /mcp (configurable) además de GET /health. Streamable HTTP se configura mediante createMcpHandler + toNodeHandler del SDK oficial.

pnpm run build
TRANSPORT=http PORT=3000 pnpm run start
# or
pnpm run start:http

Deberías ver algo como:

Weather MCP Server running on http://0.0.0.0:3000/mcp (Streamable HTTP)

Desplegar en Render

  1. Crea un Web Service desde este repositorio (raíz del proyecto).

  2. Compila: pnpm install && pnpm run build (o el equivalente con npm).

  3. Inicia: node dist/index.js (o pnpm run start).

  4. Variables de entorno:

    • TRANSPORT=http

    • OPEN_WEATHER_MAP_API_KEY=...

    • PORT lo establece Render automáticamente

  5. URL de MCP: https://<your-service>.onrender.com/mcp
    Este despliegue: https://weather-mcp-ts.onrender.com/mcp

El endpoint HTTP no está autenticado. Cualquiera con la URL puede llamar a las herramientas. Añade autenticación antes de compartirlo ampliamente.

Comprobación manual rápida (OpenWeatherMap)

Con .env configurado:

node --env-file=.env -e "
import { getApiKey, buildCurrentWeatherUrl, makeOWMRequest, formatCurrentWeather } from './dist/utils.js';
const apiKey = getApiKey();
const data = await makeOWMRequest(buildCurrentWeatherUrl({ apiKey, city: 'Yaounde,CM', units: 'metric' }));
console.log(data ? formatCurrentWeather(data, 'metric') : 'failed');
"

Salud remota:

curl -s https://weather-mcp-ts.onrender.com/health

Estructura del repositorio

weather-mcp/
├── README.md
├── package.json
├── tsconfig.json
├── .env.example
└── src/
    ├── index.ts      # stdio + Streamable HTTP entry
    ├── server.ts     # tool registration
    ├── types.ts
    └── utils.ts

Notas

  • Nunca hagas commit de .env (está en gitignore).

  • Los servidores stdio no deben escribir en stdout salvo JSON-RPC de MCP; los registros van a stderr (console.error).

  • Los planes gratuitos de OpenWeatherMap cubren el clima actual y el pronóstico de 5 días / 3 horas usado aquí.

Licencia

ISC

F
license - not found
Not graded
quality - not tested
B
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

View all related MCP servers

Related MCP Connectors

  • OpenWeather MCP — wraps the OpenWeatherMap API (openweathermap.org)

  • WeatherAPI.com MCP — wraps WeatherAPI.com (api.weatherapi.com)

  • Visual Crossing Weather MCP — wraps the Visual Crossing Weather Timeline API

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/RashJrEdmund/Weather-MCP'

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