Skip to main content
Glama

Weather MCP Service

by Philip-Walsh

Weather MCP Service

A lite weather service providing live weather data and forecasts via both REST API and MCP (Model Context Protocol) endpoints.

A minimal, production-ready weather service designed for local deployment with dual protocol support and comprehensive monitoring.

TypeScript Node.js Docker

Quick Start

# Clone & install git clone <repo-url> cd weather-mcp-db npm install # Set up environment cp .env.example .env # Add your WeatherAPI.com key to .env # Get your free API key at: https://www.weatherapi.com/ # Run npm run dev

Server runs on: http://localhost:3000

Weather Data Source

This service uses WeatherAPI.com for weather data, which provides:

  • Real-time weather data for any location worldwide

  • 14-day weather forecasts with hourly and daily intervals

  • Historical weather data going back to 2010

  • Air quality data and weather alerts

  • Free tier with 1 million calls per month

  • Reliable uptime and fast response times

Getting Your API Key

  1. Visit WeatherAPI.com

  2. Click "Get Started" or "Sign Up"

  3. Create a free account (no credit card required)

  4. Copy your API key from the dashboard

  5. Add it to your .env file: WEATHER_API_KEY=your_key_here

šŸ“– Documentation: WeatherAPI.com Docs

API

REST Endpoints

GET /api/weather?city=London # Current weather GET /api/forecast?city=London # 3-day forecast GET /api/local # Default location GET /api/health # Health check

Supported Query Formats:

  • City names: London, New York, Tokyo

  • Coordinates: 48.8567,2.3508 (lat,lon)

  • US ZIP codes: 10001, 90210

  • UK postcodes: SW1, M1 1AA

  • Airport codes: LHR, JFK (via IATA)

  • IP addresses: auto:ip for IP lookup

MCP Protocol

POST /mcp # MCP JSON-RPC 2.0

Available Tools:

  • get_weather - Current weather for a city

  • get_forecast - Weather forecast (1-10 days)

  • get_local_weather - Default location weather

Usage

REST API

# Current weather curl "http://localhost:3000/api/weather?city=London" # Forecast (1-14 days) curl "http://localhost:3000/api/forecast?city=London&days=5" # Default location weather curl "http://localhost:3000/api/local" # Health check curl "http://localhost:3000/api/health"

MCP Protocol

# List tools curl -X POST http://localhost:3000/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' # Get weather curl -X POST http://localhost:3000/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_weather","arguments":{"city":"London"}}}'

Development

npm run dev # Development server npm run build # Build for production npm run mcp # Standalone MCP server (stdio) npm test # Run tests npm run lint # Lint code

Deployment

Docker

# Local development docker-compose up -d # Production docker build -t weather-mcp-db . docker run -p 3000:3000 -e WEATHER_API_KEY=your_key weather-mcp-db

Kubernetes

# Using Helm helm install weather-service ./helm/weather-service \ --set env.WEATHER_API_KEY=your_key

Configuration

Variable

Default

Description

WEATHER_API_KEY

-

WeatherAPI.com key (required)

DEFAULT_LOCATION

London

Default city

TEMP_UNIT

C

Temperature unit

PORT

3000

Server port

Architecture

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │ REST Client │ │ MCP Client │ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │ │ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā–¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │ Express Server │ │ /api + /mcp │ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā–¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │ Weather Service │ │ WeatherAPI.com │ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Features

  • āœ… Dual Protocol - REST + MCP in one server

  • āœ… Official MCP SDK - @modelcontextprotocol/sdk

  • āœ… TypeScript - Full type safety

  • āœ… Security - Rate limiting, validation, headers

  • āœ… Monitoring - Health checks, metrics, logging

  • āœ… Testing - 68 tests (unit, integration, e2e)

  • āœ… Docker - Multi-stage build with nginx

  • āœ… Kubernetes - Helm charts included

License

MIT

-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Provides live weather data and forecasts for any location worldwide through both REST API and MCP endpoints. Supports current weather, multi-day forecasts, and various location formats including city names, coordinates, ZIP codes, and airport codes.

  1. Quick Start
    1. Weather Data Source
      1. Getting Your API Key
    2. API
      1. REST Endpoints
      2. MCP Protocol
    3. Usage
      1. REST API
      2. MCP Protocol
    4. Development
      1. Deployment
        1. Docker
        2. Kubernetes
      2. Configuration
        1. Architecture
          1. Features
            1. License

              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/Philip-Walsh/weathernode'

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