Get the FREE Ultimate OpenClaw Setup Guide →

MCP_Server

Weather App MCP server that works with Claude Desktop

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio gautamrajur-mcp_server python3 /full/path/to/weather_mcp.py \
  --env OPENWEATHER_API_KEY="your_openweather_api_key_here"

How to use

This MCP server provides weather information and related utilities through a set of tools and prompts. The core tools include get_weather, which returns current conditions and temperature for a specified city; get_sunrise_and_sunset_in_EST, which provides sunrise and sunset times in the EST timezone; and add_favorite_city, which lets you save cities for quick access. You can also access resources like Weather History to review past queries and Favorite Cities to manage your saved locations. Prompts such as weather_report generate a detailed forecast with clothing suggestions, and compare_cities lets you compare weather across multiple cities at a glance. To use these features, interact with the server by invoking the corresponding tool or prompt names and supplying any required parameters (e.g., city names).

How to install

Prerequisites:

  • Python 3.x installed
  • pip available
  • OpenWeatherMap API key (sign up at openweathermap.org and obtain an API key)

Install dependencies:

pip install mcp httpx python-dotenv

Configure API key:

  • Create a .env file in the project root and add:
OPENWEATHER_API_KEY=your_openweather_api_key_here

Prepare data storage:

mkdir -p weather_data
echo "[]" > weather_data/history.json
echo "[]" > weather_data/favorites.json

Run the MCP server:

# Example startup if weather_mcp.py is your main server script
python3 weather_mcp.py

Optionally, customize the configuration by editing the Claude Desktop config (as shown in the README) to point to your weather_mcp.py script.

Additional notes

Tips and notes:

  • Ensure OPENWEATHER_API_KEY is set in the environment or in a .env file accessible by the server.
  • The server stores query history and favorites in weather_data/history.json and weather_data/favorites.json; back these up if needed.
  • If you modify the data directory or file names, update the server configuration accordingly.
  • When deploying, keep the API key secure and do not commit the .env file to version control.
  • If you encounter network or API rate limits, consider caching results or staggering requests for multiple cities.

Related MCP Servers

Sponsor this space

Reach thousands of developers