MC

MCP Server AccuWeather Hourly and Daily Forecasts

Integrate hourly and daily AccuWeather forecasts via an MCP server for seamless weather data and reliable location-based updates.

Quick Install
npx -y @TimLukaHorstmann/mcp-weather

Overview

This MCP (Model Context Protocol) server exposes AccuWeather hourly and daily forecasts as MCP-compatible tools. It bridges AccuWeather’s REST API and model-driven workflows so language models or other MCP-aware agents can request weather data by location and receive consistent, structured forecasts. The server handles API key management, location lookup, result formatting, and rate-limit smoothing so models and integrations get concise, reliable weather context.

For developers, the server is useful when you need location-based weather data inside a model-driven application, a chatbot, scheduling assistant, or automation pipeline. By providing hourly and daily forecasts as MCP tools, you can invoke precise, up-to-date weather conditions without embedding API keys in multiple places or writing custom parsing logic for forecast responses.

Features

  • Exposes AccuWeather hourly and daily forecasts as MCP tools
  • Location-based lookup: supports lat/lon or AccuWeather location keys
  • Structured JSON output formatted for model consumption
  • Simple configuration using environment variables or a .env file
  • Docker-ready and runnable locally for development
  • Example tool manifest for easy integration with MCP-capable models
  • Rate-limit and error handling to surface consistent messages to clients

Installation / Configuration

Clone the repository, install dependencies, configure your AccuWeather API key, and start the server.

  1. Clone the repo
git clone https://github.com/TimLukaHorstmann/mcp-weather.git
cd mcp-weather

2a. Run locally (Node.js example)

# install
npm install

# set environment variables (or add them to a .env file)
export ACCUWEATHER_API_KEY="your_accuweather_api_key"
export PORT=3000

# start the server
npm start

2b. Run with Docker

# build (if a Dockerfile is included)
docker build -t mcp-weather .

# run with environment variables
docker run -e ACCUWEATHER_API_KEY="your_api_key" -e PORT=3000 -p 3000:3000 mcp-weather
  1. Example .env
ACCUWEATHER_API_KEY=your_accuweather_api_key
PORT=3000
DEFAULT_UNITS=metric # or imperial
DEFAULT_LANG=en-us

Configuration options (typical environment variables)

  • ACCUWEATHER_API_KEY — required API key for AccuWeather
  • PORT — server listen port (default 3000)
  • DEFAULT_UNITS — metric or imperial
  • DEFAULT_LANG — language code for forecasts (e.g., en-us)
  • RATE_LIMIT_WINDOW / RATE_LIMIT_MAX — optional rate-limit settings

Available Tools / Resources

The server exposes MCP-style tools (HTTP endpoints) for forecasts. Typical endpoints and their purpose:

EndpointMethodDescription
/tools/accuweather/hourlyPOSTReturns hourly forecast for the next N hours for a given location
/tools/accuweather/dailyPOSTReturns daily forecast for the next N days for a given location
/locations/lookupGET or POSTResolve lat/lon to AccuWeather location key (optional)
/healthGETHealth check / readiness

Request payloads are JSON. Example input schema:

{
  "lat": 40.7128,
  "lon": -74.0060,
  "locationKey": null,
  "hours": 24,
  "days": 7,
  "units": "metric",
  "lang": "en-us"
}

Example curl calls:

# Hourly forecast by lat/lon
curl -X POST http://localhost:3000/tools/accuweather/hourly \
  -H "Content-Type: application/json" \
  -d '{"lat":40.7128,"lon":-74.0060,"hours":12}'

# Daily forecast by location key
curl -X POST http://localhost:3000/tools/accuweather/daily \
  -H "Content-Type: application/json" \
  -d '{"locationKey":"349727"}'

Example MCP tool manifest (JSON) to register with an MCP-capable model:

[
  {
    "name": "accuweather_hourly_forecast",
    "description": "Get hourly weather forecast for a specified location",
    "endpoint": "/tools/accuweather/hourly",
    "method": "POST",
    "input_schema": {
      "lat": "number",
      "lon": "number",
      "hours": "integer",
      "units": "string",
      "lang": "string"
    }
  },
  {
    "name": "accuweather_daily_forecast",
    "description": "Get daily weather forecast for a specified location",
    "endpoint": "/tools/accuweather/daily",
    "method": "POST",
    "input_schema": {
      "locationKey": "string",
      "days": "integer",
      "units": "string",
      "lang": "string"
    }
  }
]

Use Cases

  • Chatbot weather queries: A conversational assistant can call the hourly tool to answer “What’s the weather like for