Skip to main content
Glama
RashJrEdmund

weather-mcp

by RashJrEdmund

preview image

weather-mcp

TypeScript-MCP-Server, der Wetter-Tools bereitstellt, die auf OpenWeatherMap basieren.

Tools

Tool

Beschreibung

get_current_weather

Aktuelle Bedingungen nach Stadtname oder lat/lon

get_forecast

5-Tage-/3-Stunden-Vorhersage nach lat/lon

Transporte

Modus

Env

Verwendung

stdio (Standard)

TRANSPORT=stdio

Lokaler Cursor / Claude Desktop

Streamable HTTP

TRANSPORT=http

Deployment (Render usw.) / Remote-URL

Offizielle MCP-Dokumentation: https://modelcontextprotocol.io/docs/

Live-Remote (Render)

Bereitgestellt im kostenlosen Tarif von Render:

Cursor-Konfiguration (Remote)

Füge dies zu Einstellungen → MCP oder ~/.cursor/mcp.json hinzu:

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

Kein lokaler Build oder API-Schlüssel in Cursor — der Schlüssel liegt in Renders Umgebungsvariablen.

Renders kostenloser Tarif: Der Dienst wird nach ~15 Minuten Inaktivität heruntergefahren. Die nächste Anfrage ist ein Kaltstart und kann bis zu ~50 Sekunden dauern, bevor MCP antwortet. Rufe /health einmal auf, wenn Cursor-Tools beim Aufwachen festzuhängen scheinen.

Related MCP server: mcp-weatherapi

Voraussetzungen (nur lokal)

  • Node.js 20+

  • pnpm (oder npm/yarn)

  • Einen OpenWeatherMap-API-Schlüssel (hier erhalten)

Einrichtung (lokal)

pnpm install
cp .env.example .env

Bearbeite .env und setze deinen Schlüssel:

OPEN_WEATHER_MAP_API_KEY=your_key_here
TRANSPORT=stdio

Baue den Server:

pnpm run build

Dies schreibt den ausführbaren Einstiegspunkt nach dist/index.js.

Zu Cursor hinzufügen (lokales stdio)

Cursor startet diesen Prozess standardmäßig nicht aus dem Projektstammverzeichnis, um Umgebungsvariablen zu laden. Übergib die Env-Datei daher mit einem absoluten Pfad über das --env-file-Flag von Node.js.

  1. Öffne Cursor-Einstellungen → MCP oder bearbeite ~/.cursor/mcp.json.

  2. Füge einen weather-Eintrag unter mcpServers hinzu:

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

Ersetze /ABSOLUTE/PATH/TO/weather-mcp durch deinen tatsächlichen Projektpfad (z. B. führe pwd im Repository-Stammverzeichnis aus). Behalte TRANSPORT=stdio in .env bei (oder lasse es ungesetzt).

Alternative: Env-Inline

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

Bevorzuge .env + --env-file, damit der Schlüssel nicht in mcp.json landet.

  1. Speichere und schalte den Server dann in Einstellungen → MCP aus/an (oder starte Cursor neu).

  2. Bestätige, dass der Server als verbunden angezeigt wird und get_current_weather und get_forecast auflistet.

Nach Codeänderungen

pnpm run build

Lade dann den MCP-Server in Cursor neu.

Streamable HTTP (lokal)

Der HTTP-Modus stellt MCP unter POST/GET /mcp (konfigurierbar) sowie GET /health bereit. Streamable HTTP wird über createMcpHandler + toNodeHandler des offiziellen SDK konfiguriert.

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

Du solltest in etwa Folgendes sehen:

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

Auf Render bereitstellen

  1. Erstelle einen Web Service aus diesem Repository (Projektstammverzeichnis).

  2. Build: pnpm install && pnpm run build (oder das npm-Äquivalent).

  3. Start: node dist/index.js (oder pnpm run start).

  4. Umgebungsvariablen:

    • TRANSPORT=http

    • OPEN_WEATHER_MAP_API_KEY=...

    • PORT wird von Render automatisch gesetzt.

  5. MCP-URL: https://<your-service>.onrender.com/mcp
    Dieses Deployment: https://weather-mcp-ts.onrender.com/mcp

Der HTTP-Endpunkt ist nicht authentifiziert. Jeder mit der URL kann die Tools aufrufen. Füge eine Authentifizierung hinzu, bevor du ihn weit verbreitest.

Manueller Smoke-Check (OpenWeatherMap)

Mit gesetzter .env:

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');
"

Remote-Health:

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

Repo-Struktur

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

Hinweise

  • Commite niemals .env (es ist gitignored).

  • Stdio-Server dürfen außer MCP-JSON-RPC nichts auf stdout schreiben; Logs gehen nach stderr (console.error).

  • Kostenlose OpenWeatherMap-Tarife decken das aktuelle Wetter und die hier verwendete 5-Tage-/3-Stunden-Vorhersage ab.

Lizenz

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