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 and air quality information using the Weather Union API.

This server offers real-time weather data for specific coordinates or predefined Indian cities.

Usage with MCP Clients

Claude Desktop

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "weather-union": {
      "command": "uvx",
      "args": ["weatherunion-mcp"],
      "env": {
        "WEATHER_UNION_API_KEY": "your-api-key-here"
      }
    }
  }
}

Other MCP Clients

The server follows standard MCP protocol and works with any compliant MCP client.

Quick Start

  1. Set up your API key:

    export WEATHER_UNION_API_KEY='your-api-key-here'
    
  2. Run the server:

    # For MCP clients (default - uses stdin)
    python weatherunion_mcp/server.py
    
    # For testing with HTTP
    python weatherunion_mcp/server.py --http --port 8000
    

Available Tools

The MCP server provides two powerful weather tools:

1. get_current_weather

Get current weather data for any geographic location using latitude and longitude coordinates.

Parameters:

  • latitude (float): Latitude coordinate (-90 to 90 degrees)
  • longitude (float): Longitude coordinate (-180 to 180 degrees)

Returns: Comprehensive weather information including temperature, humidity, wind conditions, precipitation, and air quality data.

Example:

get_current_weather(12.933756, 77.625825)  # Bangalore coordinates

2. get_weather_for_city

Get weather data for major Indian cities using predefined city names.

Parameters:

  • city_name (str): Name of the city (case-insensitive)
  • 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")
get_weather_for_city("Mumbai")

Weather Data Format

The server returns comprehensive weather information in a formatted string:

Weather Information (Lat: 12.933756, Lon: 77.625825):

Temperature: 25.68°C
Humidity: 25.81%
Wind Speed: 1.15 km/h
Wind Direction: 331.2°
Rain Intensity: 0 mm/h
Rain Accumulation: 0.4 mm
Air Quality Index (PM 2.5): 84
Air Quality Index (PM 10): 75

API Key

You need a Weather Union API key (X-Zomato-Api-Key) to use this server. You can generate this for free by signing up at Weather Union.

  • The server validates your API key on startup
  • API key must be set as an environment variable
  • The server will show clear error messages if the API key is missing or invalid

Contributing

Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.

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.1.tar.gz (28.6 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.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for weatherunion_mcp-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5e9ea4d5d4f4b917f3e2bf290b36b0e0e147079074e75f616c14a15f16223ed6
MD5 b6c8916aebc953b132316014d75824b4
BLAKE2b-256 548f9e326cf41749326e1016fd558ff18f643e3f15d169d0ee627845aca03a83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for weatherunion_mcp-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a06a512e2919702b035ec99bfdaadb18a104036dc6d7ca02140637075cb05b6c
MD5 b25ec2151ba8226a57433e834e553b16
BLAKE2b-256 9bd44b0258a635e83cc1cf9445b2fe77fefece9f1d3583644360c57d41dff914

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