Get the FREE Ultimate OpenClaw Setup Guide →

weather

A lightweight Model Context Protocol (MCP) server that enables AI assistants like Claude to retrieve and interpret real-time weather data. Discuss on Hacker News:

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ezh0v-weather-mcp-server weather-mcp-server \
  --env WEATHER_API_KEY="your-api-key"

How to use

Weather MCP Server is a lightweight MCP server that exposes real-time weather data accessible to AI assistants via MCP tools. The server focuses on fetching current weather information for a specified city through its current_weather tool. Once running, Claude-like assistants can query the weather data by invoking the MCP tool named current_weather with required parameters such as city. The server is designed to be used in both local and remote (URL-based) modes, enabling seamless integration with Claude Desktop or other MCP-enabled clients. To use locally, configure the mcpServers section with the path to the weather-mcp-server binary and provide your WeatherAPI key as an environment variable. In remote mode, point to the server’s SSE endpoint if you’re exposing it over HTTP.

The primary tool exposed by this MCP server is current_weather, which accepts a city name as input and returns the current weather conditions for that city. This makes it straightforward to retrieve up-to-date weather information in real-time for any supported location, enabling AI assistants to answer questions like “What’s the weather in London?” with accurate data.

How to install

Prerequisites:

  • Go installed for building from source (optional if using prebuilt binary)
  • WeatherAPI account and API key
  • Docker (optional, for containerized deployment)

From Source:

  1. Clone the repository: git clone https://github.com/ezh0v/weather-mcp-server.git cd weather-mcp-server
  2. Build the binary: go build -o weather-mcp-server ./cmd/weather-mcp-server
  3. Run the server (local mode): WEATHER_API_KEY=your-api-key ./weather-mcp-server
  4. Verify the server starts and is reachable (default port depends on the codebase).

Docker (containerized):

  1. Build the Docker image: docker build -t weather-mcp-server .
  2. Run the container with your API key: docker run -e WEATHER_API_KEY=your-api-key -d --name weather-mcp-server -p 8000:8000 weather-mcp-server
  3. Access the server via the mapped port (e.g., http://localhost:8000).

Optional remote mode ( Claude Desktop integration):

  • In Claude Desktop, you can configure the mcpServers entry with a URL for remote mode if you’re exposing the MCP server via SSE.

Additional notes

Tips and considerations:

  • Ensure WEATHER_API_KEY is kept secure and not exposed in logs or public repos. Use environment isolation where possible.
  • If you see authentication errors, double-check the WeatherAPI key and its permissions.
  • In remote mode, verify that the server’s URL is reachable from the Claude Desktop client and that the SSE endpoint is correctly configured.
  • The server exposes at least the current_weather tool; if you extend functionality, update clients to use the new tool names and input parameters.
  • When running in Docker, map the internal port correctly and consider using a volume for configuration if needed.

Related MCP Servers

Sponsor this space

Reach thousands of developers