Skip to main content

Weather Union MCP Server - A Model Context Protocol server for weather data

Project description

Weather Union MCP Server

A Model Context Protocol (MCP) server that provides weather data using the Weather Union API.

Quick Start

Run the server directly with uvx (recommended):

uvx weatherunion-mcp --api-key YOUR_API_KEY

Replace YOUR_API_KEY with your actual Weather Union API key (X-Zomato-Api-Key).

Installation

Option 1: Direct execution with uvx (Recommended)

uvx weatherunion-mcp --api-key YOUR_API_KEY

Option 2: Install and run

pip install -e .
weatherunion-mcp --api-key YOUR_API_KEY

Available Tools

The MCP server provides the following tools:

1. get_current_weather

Get formatted weather data for specific coordinates.

Parameters:

  • latitude (float): Latitude coordinate
  • longitude (float): Longitude coordinate

Example:

get_current_weather(12.933756, 77.625825)  # Bangalore coordinates

2. get_weather_raw

Get raw weather data as returned by the Weather Union API.

Parameters:

  • latitude (float): Latitude coordinate
  • longitude (float): Longitude coordinate

3. get_weather_for_city

Get weather data for predefined major Indian cities.

Parameters:

  • city_name (str): Name of the city
  • country_code (str, optional): Country code (default: "IN")

Supported Cities:

  • Bangalore, Mumbai, Delhi, Hyderabad, Chennai
  • Kolkata, Pune, Ahmedabad, Jaipur, Lucknow

Example:

get_weather_for_city("bangalore")

API Key

You need a Weather Union API key to use this server. This is the same as the X-Zomato-Api-Key.

The server will validate your API key on startup by making a test request.

Usage with MCP Clients

Once the server is running, MCP clients (like Claude Desktop, Cline, etc.) can connect to it and use the weather tools.

Example weather data format:

Weather Information for HSR Layout:

Temperature: 25.2°C
Humidity: 68%
Wind Speed: 12.5 km/h
Wind Direction: 230°
Rain Intensity: 0.0 mm/h
Rain Accumulation: 0.0 mm

Last Updated: 2024-01-15T14:30:00Z

Development

The server is built using FastMCP, which provides a simple way to create MCP servers in Python.

Project Structure

weatherunion-mcp/
├── weatherunion_mcp/
│   ├── __init__.py
│   └── server.py          # Main MCP server implementation
├── pyproject.toml         # Project configuration
└── README.md

Testing

You can test the server by running it and checking the validation:

uvx weatherunion-mcp --api-key YOUR_API_KEY

The server will validate your API key on startup and show available tools.

Requirements

  • Python 3.13+
  • fastmcp >= 0.2.0
  • requests >= 2.31.0

License

This project is open source. See the LICENSE file for details.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

weatherunion_mcp-1.0.0.tar.gz (28.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

weatherunion_mcp-1.0.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file weatherunion_mcp-1.0.0.tar.gz.

File metadata

  • Download URL: weatherunion_mcp-1.0.0.tar.gz
  • Upload date:
  • Size: 28.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.9

File hashes

Hashes for weatherunion_mcp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 dda8b4e3f0d63934b658940d5f3e7f9116761368e6babbefcfd3e02e2781e8d2
MD5 52862763ab8ef667dbb630b91ca45c0e
BLAKE2b-256 0683c900655872d1791301b01f16d548f91a061227949aa982937c628b629702

See more details on using hashes here.

File details

Details for the file weatherunion_mcp-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for weatherunion_mcp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a7290bdf5d313711cba37601fd1abac9bf3dc1d15af90fc7569b6b3df62d814
MD5 0743fb9780c3b4915ef77443b4ef660a
BLAKE2b-256 1ed8700cddcd5612cd230677c3aedc2941ce12d660f67812d68ab9786ced36e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page