Weather MCP Server
Wetter-MCP-Server
Ein Model Context Protocol (MCP)-Server für Wetterdaten mit OpenAPI-Unterstützung. Dieser Server stellt Wetterinformationen von der OpenWeatherMap-API bereit und kann von LLM-Agenten über MCP genutzt werden.
Funktionen
MCP-stdio-Transport für die Integration von LLM-Agenten
HTTP-REST-API mit OpenAPI 3.0-Spezifikation
4 Wetter-Tools:
Aktuelles Wetter nach Stadt abrufen
Aktuelles Wetter nach Koordinaten abrufen
Wettervorhersage abrufen (5 Tage, 3-Stunden-Intervalle)
Zusammenfassung des Temperaturbereichs abrufen
Unterstützung für Mock-Daten zum Testen ohne API-Schlüssel
TypeScript-Implementierung mit vollständiger Typsicherheit
Related MCP server: mcp-openweather
Installation
cd weather-mcp-server
npm install
npm run buildVerwendung
1. MCP-Server (stdio-Transport)
Starten Sie den MCP-Server für LLM-Agenten:
npm startOder im Entwicklungsmodus:
npm run dev2. HTTP-Server mit OpenAPI
Starten Sie den HTTP-Server mit REST-API:
npm run dev:httpDer Server startet unter http://localhost:3000 mit:
/health- Health-Check-Endpunkt/openapi- OpenAPI-Spezifikation/api/v1/weather/current/{city}- Aktuelles Wetter nach Stadt/api/v1/weather/current/coordinates- Aktuelles Wetter nach Koordinaten/api/v1/weather/forecast/{city}- Wettervorhersage
3. Konfiguration
Legen Sie Ihren OpenWeatherMap-API-Schlüssel fest (optional – falls nicht angegeben, werden Mock-Daten verwendet):
export OPENWEATHER_API_KEY=your_api_key_hereOder erstellen Sie eine .env-Datei:
OPENWEATHER_API_KEY=your_api_key_hereMCP-Tools
Der Server stellt die folgenden MCP-Tools bereit:
Tool-Name | Beschreibung | Parameter |
| Aktuelles Wetter nach Stadt abrufen |
|
| Aktuelles Wetter nach Koordinaten abrufen |
|
| Wettervorhersage abrufen |
|
| Zusammenfassung des Temperaturbereichs abrufen |
|
API-Endpunkte
HTTP-REST-API
Alle Endpunkte geben JSON mit der folgenden Struktur zurück:
{
"success": true,
"data": { ... }
}1. Aktuelles Wetter nach Stadt
GET /api/v1/weather/current/{city}Beispiel:
curl http://localhost:3000/api/v1/weather/current/London2. Aktuelles Wetter nach Koordinaten
GET /api/v1/weather/current/coordinates?lat={latitude}&lon={longitude}Beispiel:
curl "http://localhost:3000/api/v1/weather/current/coordinates?lat=51.5074&lon=-0.1276"3. Wettervorhersage
GET /api/v1/weather/forecast/{city}?days={days}Beispiel:
curl "http://localhost:3000/api/v1/weather/forecast/New%20York?days=3"Testen
Führen Sie die Test-Suite aus:
npm testStarten Sie den MCP-Inspektor zum Debuggen:
npm run inspectProjektstruktur
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.mdAbhängigkeiten
@modelcontextprotocol/sdk- MCP-SDK für TypeScriptexpress- HTTP-Server-Frameworkaxios- HTTP-Client für API-Aufrufezod- Schema-Validierungtypescript- TypeScript-Compiler
Lizenz
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Unofficial OpenWeather MCP — wraps the OpenWeatherMap API (openweathermap.org)
Weather MCP — wraps Open-Meteo API (free, no auth)
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.
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 gradedqualityBmaintenanceWraps the OpenWeatherMap API to provide weather data through MCP, enabling AI agents to query current conditions, forecasts, and other weather information via natural language.256 npmMIT
- AlicenseNot gradedqualityCmaintenanceProvides weather data from WeatherAPI.com through MCP, enabling AI agents to query current conditions and forecasts via natural language.146 npmMIT
- FlicenseBqualityDmaintenanceProvides real-time weather information for cities worldwide using the OpenWeatherMap API, accessible through natural language queries via the MCP protocol.1-