weather-mcp-server

Sachindesai2213/weather-mcp-server

3.2

If you are the rightful owner of weather-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A lightweight, modular Weather MCP Server for real-time weather data integration.

Weather MCP Server

A simple MCP server for fetching current weather data from OpenWeatherMap.

Description

This project provides a FastMCP server with a single tool to get weather information. It can fetch weather data by geographical coordinates (latitude and longitude) or by a location name.

Installation

  1. Clone the repository:

    git clone https://github.com/Sachindesai2213/weather-mcp-server.git
    cd weather-mcp-server
    
  2. Install the dependencies:

    pip install -r requirements.txt
    

Configuration

This server requires an API key from OpenWeatherMap.

Set the following environment variable:

export OPENWEATHERMAP_API_KEY="your_api_key"

On Windows, use:

set OPENWEATHERMAP_API_KEY="your_api_key"

Roo Code Configuration

To use this server with Roo Code, you can add the following to your Roo Code configuration file:

{
  "mcpServers": {
    "weather-mcp-server": {
      "command": "your_python_path",
      "args": [
        "src/server.py"
      ],
      "env": {
        "OPENWEATHERMAP_API_KEY": "your_api_key"
      },
      "alwaysAllow": [],
      "disabled": false
    }
  }
}

Usage

To run the server, execute the following command:

python src/server.py

Validation

Here is a screenshot of the tool in action:

Weather Validation

Tools

fetch_weather

Fetches the current weather data.

Parameters:

  • lat (float, optional): Latitude.
  • lon (float, optional): Longitude.
  • query (str, optional): Location name (e.g., "London", "Tokyo").

Note: You must provide either lat and lon or a query.

Returns:

A JSON object containing the weather data from OpenWeatherMap.