Weather MCP Server
Servidor MCP de Clima
Un servidor del Protocolo de Contexto de Modelo (MCP) para datos meteorológicos con soporte para OpenAPI. Este servidor proporciona información meteorológica de la API de OpenWeatherMap y puede ser utilizado por agentes LLM a través de MCP.
Características
Transporte stdio de MCP para la integración con agentes LLM
API REST HTTP con especificación OpenAPI 3.0
4 herramientas meteorológicas:
Obtener el clima actual por ciudad
Obtener el clima actual por coordenadas
Obtener pronóstico del tiempo (5 días, intervalos de 3 horas)
Obtener resumen del rango de temperatura
Soporte de datos simulados (mock) para pruebas sin clave de API
Implementación en TypeScript con seguridad de tipos completa
Related MCP server: mcp-openweather
Instalación
cd weather-mcp-server
npm install
npm run buildUso
1. Servidor MCP (transporte stdio)
Ejecute el servidor MCP para agentes LLM:
npm startO en modo de desarrollo:
npm run dev2. Servidor HTTP con OpenAPI
Ejecute el servidor HTTP con API REST:
npm run dev:httpEl servidor se iniciará en http://localhost:3000 con:
/health- Punto de conexión de verificación de estado/openapi- Especificación OpenAPI/api/v1/weather/current/{city}- Clima actual por ciudad/api/v1/weather/current/coordinates- Clima actual por coordenadas/api/v1/weather/forecast/{city}- Pronóstico del tiempo
3. Configuración
Establezca su clave de API de OpenWeatherMap (opcional: se utilizarán datos simulados si no se proporciona):
export OPENWEATHER_API_KEY=your_api_key_hereO cree un archivo .env:
OPENWEATHER_API_KEY=your_api_key_hereHerramientas MCP
El servidor proporciona las siguientes herramientas MCP:
Nombre de la herramienta | Descripción | Parámetros |
| Obtener el clima actual por ciudad |
|
| Obtener el clima actual por coordenadas |
|
| Obtener pronóstico del tiempo |
|
| Obtener resumen del rango de temperatura |
|
Puntos de conexión de la API
API REST HTTP
Todos los puntos de conexión devuelven JSON con la siguiente estructura:
{
"success": true,
"data": { ... }
}1. Clima actual por ciudad
GET /api/v1/weather/current/{city}Ejemplo:
curl http://localhost:3000/api/v1/weather/current/London2. Clima actual por coordenadas
GET /api/v1/weather/current/coordinates?lat={latitude}&lon={longitude}Ejemplo:
curl "http://localhost:3000/api/v1/weather/current/coordinates?lat=51.5074&lon=-0.1276"3. Pronóstico del tiempo
GET /api/v1/weather/forecast/{city}?days={days}Ejemplo:
curl "http://localhost:3000/api/v1/weather/forecast/New%20York?days=3"Pruebas
Ejecute la suite de pruebas:
npm testEjecute el inspector MCP para depuración:
npm run inspectEstructura del proyecto
weather-mcp-server/
├── src/
│ ├── index.ts # MCP stdio server
│ ├── http-server.ts # HTTP server with OpenAPI
│ ├── types/
│ │ └── weather.ts # TypeScript types and Zod schemas
│ ├── utils/
│ │ └── weather-client.ts # OpenWeatherMap API client
│ └── tools/
│ └── weather-tools.ts # MCP tool definitions
├── dist/ # Compiled JavaScript
├── test/
│ └── test.js # Test suite
├── package.json
├── tsconfig.json
└── README.mdDependencias
@modelcontextprotocol/sdk- SDK de MCP para TypeScriptexpress- Marco de trabajo para servidor HTTPaxios- Cliente HTTP para llamadas a la APIzod- Validación de esquemastypescript- Compilador de TypeScript
Licencia
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
OpenWeather MCP — wraps the OpenWeatherMap API (openweathermap.org)
Weather, code search, currency & Solana trust scoring as MCP tools. Free, no API key needed.
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
OpenWeather data for AI agents: list feeds, sign up, check balance, get a top-up link, fetch data.
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables AI agents to retrieve real-time weather conditions and forecasts via OpenWeatherMap API. Supports interactive weather queries and travel planning through MCP tools, resources, and prompts.2-
- AlicenseNot gradedqualityCmaintenanceWraps the OpenWeatherMap API to provide weather data through MCP, enabling AI agents to query current conditions, forecasts, and other weather information via natural language.5 npmMIT
- AlicenseNot gradedqualityCmaintenanceProvides weather data from WeatherAPI.com through MCP, enabling AI agents to query current conditions and forecasts via natural language.5 npmMIT
- FlicenseBqualityDmaintenanceProvides real-time weather information for cities worldwide using the OpenWeatherMap API, accessible through natural language queries via the MCP protocol.1-