home / mcp / weather mcp server

Weather MCP Server

Provides weather alerts and forecasts by querying the National Weather Service (NWS) API for MCP-powered clients.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "jackkuo666-weather-mcp-server": {
      "command": "python",
      "args": [
        "weather.py"
      ],
      "env": {
        "LOG_LEVEL": "INFO",
        "LOG_FORMAT": "%(levelname)s %(asctime)s %(message)s",
        "USER_AGENT": "Weather-MCP-Client/1.0",
        "NWS_API_BASE": "https://api.weather.gov/",
        "REQUEST_TIMEOUT": "30"
      }
    }
  }
}

This Weather MCP Server provides weather data by querying the National Weather Service API. It exposes two practical actions you can use from any MCP client: receive weather alerts for any US state and fetch a forecast for a precise location given latitude and longitude. Use it to integrate current weather information into your workflows, apps, or automation pipelines.

How to use

To access weather data from your MCP client, call the Weather MCP Server tools you have installed in your environment. Two core tools are available: get_alerts and get_forecast.

How to install

Prerequisites you need before installing this server:

  • Python 3.10 or newer
  • FastMCP
  • httpx

Steps to install and run the server

  • Clone the project to your development machine.
  • Create and activate a Python virtual environment:
  • python -m venv .venv
  • source .venv/bin/activate # On Windows, use .venv\Scripts\activate

Install required packages using the MCP CLI tool. Run this command to add the httpx dependency under the mcp group (this enables the client side tools to communicate with the server):

uv add "mcp[cli]" httpx

Run the server locally

Start the Weather MCP Server in standalone mode after your virtual environment is activated.

source .venv/bin/activate  # On Windows, use `.venv\Scripts\activate`
python weather.py

Configuration

Tune server behavior by editing the configuration file config.py. Key settings include the base URL for the National Weather Service API, the User-Agent header, logging level and format, and the API request timeout.

Usage with MCP clients

Once the server is running, you can invoke the two available actions from your MCP client.

Notes on errors and logging

If an API request fails, the server logs the error and returns a meaningful message to your client. Logs reflect the configured level and format.

Testing your setup

You can test the tools through your MCP client by calling get_alerts and get_forecast and inspecting the returned data.

Available tools

get_alerts

Get weather alerts for a US state. Provide the two-letter state code (e.g., CA) to receive active alerts for that state.

get_forecast

Get a weather forecast for a specific location by providing latitude and longitude.