Get the FREE Ultimate OpenClaw Setup Guide →

Weather

MCP server from Krytons/Weather-MCP-Server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio krytons-weather-mcp-server node dist/index.js \
  --env MODE="http" \
  --env PORT="3000" \
  --env API_KEY="your_openweathermap_api_key_here"

How to use

This Weather MCP Server provides real-time weather information by leveraging the OpenWeatherMap API. It is built in TypeScript with a modular architecture that supports both MCP stdio transport and an HTTP API, enabling multi-transport operation with a single core logic. The server is designed to manage tenants and sessions via MongoDB, and it includes a seeder utility to populate initial tenants and API keys which are required to authenticate MCP clients. To use the HTTP API, run the server in HTTP mode and send requests to the configured port using a valid API key in the Authorization header. For MCP clients that use stdio, the server can be started in stdio mode and will communicate over the standard input/output streams as per MCP conventions. The Weather tool exposes endpoints and tools defined by weather schemas, and you can extend it by adding new schema files and service classes following the existing patterns (schema-driven development, service layer, and router-based versioning).

How to install

Prerequisites:

  • Node.js v20.0+ (as per project requirements)
  • npm (comes with Node.js)
  • OpenWeatherMap API key (required for weather data)
  • MongoDB instance (local or remote) for tenant and session persistence

Installation steps:

  1. Clone the repository
git clone https://github.com/Krytons/Weather-MCP-Server.git
cd Weather-MCP-Server
  1. Install dependencies
npm install
  1. Create and configure environment variables
  • Create a .env file or provide environment variables at runtime
API_KEY=your_openweathermap_api_key_here
MONGODB_URI=mongodb://localhost:27017
MONGODB_DBNAME=mcp-server-skylabs
PORT=3000
MODE=http
  1. Build the TypeScript project
npm run build
  1. Run the server
  • As MCP Server (stdio mode):
MODE=stdio node dist/index.js
  • As HTTP Server:
node dist/index.js
  1. Optional: seed tenants and generate API keys using the seeder utility as described in the documentation. Ensure MongoDB is accessible and the API keys are distributed to MCP clients.

Additional notes

Notes and tips:

  • Ensure your OpenWeatherMap API key is kept secure and not committed to version control.
  • The server stores MCP sessions and tenant data in MongoDB; monitor TTL settings and cleanup intervals to manage storage.
  • Authentication is enforced via API keys passed as a Bearer token in the Authorization header for all MCP endpoints.
  • Environment variables control features such as the session cleanup interval (MCP_SESSION_CLEANUP_INTERVAL) and seeding behavior (TENANTS_SEED_EMAILS, SEED_FROM_ENV, etc.).
  • If switching between stdio and HTTP modes, the core logic remains the same; only transport layers differ.
  • When running in production, consider enabling verbose logging selectively (start:verbose) to diagnose issues without flooding logs.
  • If you need to customize or add new tools, follow the Schema-Driven Development approach described in the architecture section (create a new schema, service, and route with versioning in the RouterFactory).
  • Verify MongoDB indexes and TTL configuration to ensure timely cleanup of expired sessions.

Related MCP Servers

Sponsor this space

Reach thousands of developers