Skip to main content

weather-mcp

A weather MCP server powered by WeatherAPI. Works with Claude and any MCP-compatible client.

Installation

pip install weather-mcp-v1

Setup

  1. Get a free API key from weatherapi.com
  2. Create a .env file in your working directory:
WEATHER_API_KEY=your_api_key_here

Or set it as an environment variable:

# Linux/Mac
export WEATHER_API_KEY=your_api_key_here

# Windows (PowerShell)
$env:WEATHER_API_KEY="your_api_key_here"

Usage

The server supports two transport modes — stdio for local development and SSE for remote/production deployment.

Mode 1 — stdio (Local Development)

No separate server process needed. The client spawns and manages the server automatically.

from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

server_params = StdioServerParameters(
    command="python",
    args=["-m", "weather_mcp.server"],
    env={"WEATHER_API_KEY": "your_api_key_here"}
)

async with stdio_client(server_params) as (read, write):
    async with ClientSession(read, write) as session:
        await session.initialize()
        tools = await session.list_tools()

Mode 2 — SSE (Remote / Production)

Run the server independently and connect to it over HTTP.

Start the server:

# Linux/Mac
MCP_TRANSPORT=sse weather-mcp

# Windows (PowerShell)
$env:MCP_TRANSPORT="sse"; weather-mcp

Server starts at http://localhost:8000/sse

Connect from your client:

from mcp.client.sse import sse_client
from mcp import ClientSession

async with sse_client("http://localhost:8000/sse") as (read, write):
    async with ClientSession(read, write) as session:
        await session.initialize()
        tools = await session.list_tools()

When hosted remotely, just change the URL:

async with sse_client("https://your-server.railway.app/sse") as (read, write):
    ...

Connect with Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "weather": {
      "command": "weather-mcp",
      "env": {
        "WEATHER_API_KEY": "your_api_key_here"
      }
    }
  }
}

Environment Variables

Variable Required Default Description
WEATHER_API_KEY Yes — Your WeatherAPI key from weatherapi.com
MCP_TRANSPORT No stdio Transport mode: stdio or sse

Available Tools

get_weather

Fetches current weather for a given location.

Input:

  • location (string) — city name, postal code, or coordinates (e.g. "New York", "10001", "48.8566,2.3522")

Output: Full weather JSON from WeatherAPI including:

  • Temperature (Celsius and Fahrenheit)
  • Condition and description
  • Humidity, wind speed, visibility
  • Feels like temperature

License

MIT

Metadata

Release files for weather-mcp-v1 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for weather-mcp-v1 0.1.2
File Size Uploaded
weather_mcp_v1-0.1.2.tar.gz 2.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for weather-mcp-v1 0.1.2
File Interpreter ABI Platform
weather_mcp_v1-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 5.9 kB

Release files / weather_mcp_v1-0.1.2.tar.gz

Download URL weather_mcp_v1-0.1.2.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
12de6cbb513ede9a61c91d830ba6027c2120e6989b35263ab9092cccaf6e63ee
BLAKE2b-256 checksum
How to use checksums
2d6d74f4fda68d2715ac25330629f919c46d2e8b24d861998d04832e23a1b6a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.0

Release files / weather_mcp_v1-0.1.2-py3-none-any.whl

Download URL weather_mcp_v1-0.1.2-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af6a66305a93d7197ff47e09ab4dcd0f5e3ebf5897dc955f15d28b0c99276234
BLAKE2b-256 checksum
How to use checksums
c3cbcd6aa8da805cb5394b4554a12046f18141e1be6a8d3ba8db4a677cf91e38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.0

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page