Skip to main content
Glama
aarvijayanand

weather-mcp-server

Weather MCP Server

A Python-based Model Context Protocol (MCP) server that provides current weather conditions and multi-day forecasts for cities worldwide.

The server uses the Open-Meteo Geocoding API to convert city names into coordinates and the Open-Meteo Forecast API to retrieve live weather data. The results are exposed as MCP tools through Streamable HTTP and can be tested with MCP Inspector.

Demo

The server exposes two MCP tools:

get_current_weather

get_forecast

Example request:

{ "city": "Cologne", "days": 5 }

Example result:

Weather forecast for Cologne, Germany Coordinates: 50.9333, 6.95 Timezone: Europe/Berlin

Date: 2026-08-03 Conditions: Partly cloudy Maximum temperature: 28.5 °C Minimum temperature: 16.4 °C Maximum rain probability: 20% Maximum wind speed: 12.1 km/h

Demo

Weather MCP Server running in MCP Inspector

Features

Current weather information for cities worldwide

Daily forecasts for up to 7 days

Automatic city-to-coordinate lookup

Worldwide location support

Weather condition descriptions based on WMO weather codes

Maximum and minimum temperatures

Rain probability

Wind speed

Asynchronous HTTP requests with httpx

MCP tool exposure

Streamable HTTP transport

MCP Inspector compatibility

No API key required

Available MCP Tools

get_current_weather

Returns the current weather conditions for a city.

Input

{ "city": "Cologne" }

Output includes

Location and country

Local time

Weather conditions

Current temperature

Apparent temperature

Precipitation

Wind speed

get_forecast

Returns a multi-day daily weather forecast.

Input

{ "city": "Cologne", "days": 5 }

Parameters

Parameter

Type

Description

city

string

Name of the city

days

integer

Number of forecast days, from 1 to 7

Output includes

Forecast date

Weather conditions

Maximum temperature

Minimum temperature

Maximum rain probability

Maximum wind speed

Architecture

MCP Client / MCP Inspector | | Streamable HTTP v Weather MCP Server | | HTTPS requests v Open-Meteo Geocoding API Open-Meteo Forecast API

Request flow

  1. User enters a city name

  2. MCP client calls a weather tool

  3. MCP server sends the city to Open-Meteo Geocoding API

  4. Geocoding API returns latitude, longitude and timezone

  5. MCP server calls the Open-Meteo Forecast API

  6. Weather data is formatted into readable text

  7. MCP server returns the result to the client

Technologies Used

Python

Model Context Protocol Python SDK

MCPServer

Open-Meteo Geocoding API

Open-Meteo Forecast API

HTTPX

uv

Uvicorn

Streamable HTTP

MCP Inspector

Git and GitHub

Project Structure

weather-mcp-server/ ├── weather.py ├── pyproject.toml ├── uv.lock ├── README.md ├── .gitignore ├── .python-version └── src/ └── weather/ └── init.py

Optional screenshot folder:

screenshots/ └── mcp_weather_inspector.png

Requirements

Python 3.10 or newer

uv

Node.js

npm and npx

Git

Check installed versions:

python --version uv --version node --version npm --version npx --version git --version

Installation

  1. Clone the repository

git clone https://github.com/aarvijayanand/weather-mcp-server.git cd weather-mcp-server

  1. Install dependencies

uv sync

If required, install dependencies manually:

uv add "mcp[cli]" httpx

Run the MCP Server

uv run weather.py

Expected output:

INFO: Started server process INFO: Application startup complete INFO: Uvicorn running on http://127.0.0.1:8000

Server address:

http://127.0.0.1:8000

MCP endpoint:

http://127.0.0.1:8000/mcp

The /mcp endpoint is not a normal webpage. Opening it directly in a browser may show Missing session ID. This is expected because it must be accessed by an MCP client.

Test with MCP Inspector

Keep the weather server running.

Open a second PowerShell window:

npx -y @modelcontextprotocol/inspector

MCP Inspector normally opens at:

http://localhost:6274

Add the weather server

Click Add Servers

Choose Add manually

Enter:

Name: weather Transport: Streamable HTTP URL: http://127.0.0.1:8000/mcp

Save the server

Switch it to Connected

Open the Tools tab

You should see:

get_current_weather get_forecast

Test Examples

Current weather for Cologne

{ "city": "Cologne" }

Five-day forecast for Cologne

{ "city": "Cologne", "days": 5 }

Forecast for Berlin

{ "city": "Berlin", "days": 3 }

Forecast for Chennai

{ "city": "Chennai", "days": 7 }

Open-Meteo API

Open-Meteo is a weather-data service that provides current conditions and forecasts through an API.

Geocoding API

https://geocoding-api.open-meteo.com/v1/search

It converts a city name into:

latitude

longitude

country

timezone

Example:

Cologne ↓ Latitude: 50.9333 Longitude: 6.95 Timezone: Europe/Berlin

Forecast API

https://api.open-meteo.com/v1/forecast

It returns weather variables such as:

temperature_2m

apparent_temperature

weather_code

precipitation

wind_speed_10m

temperature_2m_max

temperature_2m_min

precipitation_probability_max

wind_speed_10m_max

No API key is required for this project.

Weather Codes

Code

Description

0

Clear sky

1

Mainly clear

2

Partly cloudy

3

Overcast

45

Fog

51

Light drizzle

61

Slight rain

63

Moderate rain

65

Heavy rain

71

Slight snowfall

80

Slight rain showers

95

Thunderstorm

Important Note

This project does not create its own weather prediction model.

It retrieves forecast data from Open-Meteo and exposes it through MCP tools.

A correct project description is:

A Python MCP server that retrieves and presents worldwide weather forecasts using the Open-Meteo API.

Error Handling

The project handles:

invalid city names

empty city input

invalid forecast-day values

request timeouts

HTTP errors

invalid JSON responses

missing forecast data

malformed location data

incomplete API responses

Common Problems

npx is not recognized

winget install OpenJS.NodeJS.LTS

Restart PowerShell, then check:

node --version npm --version npx --version

uv is not recognized

irm https://astral.sh/uv/install.ps1 | iex

Restart PowerShell and check:

uv --version

Missing session ID

This happens when opening the MCP endpoint directly in a browser. Use MCP Inspector or another MCP-compatible client instead.

Port 8000 is already in use

netstat -ano | findstr :8000

MCP Inspector cannot connect

Check that:

weather.py is running

the URL is exactly http://127.0.0.1:8000/mcp

the transport is Streamable HTTP

no other service is using port 8000

Learning Objectives

This project demonstrates:

Building an MCP server

Creating MCP tools

Defining tool parameters

Calling external APIs

Handling asynchronous HTTP requests

Converting city names into coordinates

Processing JSON responses

Mapping numerical weather codes

Using Streamable HTTP

Testing with MCP Inspector

Returning live external data through MCP

Using Git and GitHub for version control

Future Improvements

Hourly weather forecasts

Weekend weather summaries

Weather comparison between two cities

Rain and snow alerts

Travel-weather recommendations

Clothing suggestions

Sunrise and sunset times

Air-quality data

Historical weather data

Docker support

Cloud deployment

Automated tests

Structured JSON output

MCP resources

MCP prompts

Authentication

Rate limiting

Logging

Health-check endpoint

Suggested Additional MCP Tools

get_hourly_forecast compare_city_weather get_weekend_forecast get_rain_forecast get_weather_by_coordinates get_travel_weather_summary

GitHub Workflow

After making changes:

git status git add . git commit -m "Improve weather MCP server" git push

Repository Description

Recommended GitHub About description:

Python-based MCP weather server providing current conditions and multi-day forecasts for cities worldwide using Open-Meteo and Streamable HTTP.

Recommended GitHub topics:

mcp model-context-protocol python open-meteo weather-api streamable-http httpx uv mcp-inspector

Author

Vijay Rathnavel

Senior System Simulation Engineer with 15+ years of experience in automotive simulation, thermal systems, electrified powertrains and model-based development. Currently building expertise in Python, machine learning, MLOps and MCP.

License

This project is available for learning, demonstration and portfolio purposes.

F
license - not found
-
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    D
    maintenance
    An MCP server that provides real-time weather data, hourly forecasts, and daily summaries using the free Open-Meteo API with no API key required. It enables users to search for weather conditions by specific coordinates or city names across multiple measurement units.
    Last updated
    1
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    Provides tools to retrieve current weather conditions and daily forecasts for cities worldwide using the Open-Meteo API. This Python-based server enables MCP-compatible clients to access real-time meteorological data through a standardized interface.
    Last updated
    2
    MIT
  • A
    license
    -
    quality
    C
    maintenance
    A no-API-key-required MCP server that wraps Open-Meteo APIs to provide geocoding and weather forecast data, enabling city lookups and multi-day forecasts through tools, resources, and prompts.
    Last updated
    MIT

View all related MCP servers

Related MCP Connectors

  • Open-Meteo MCP — weather forecast + historical reanalysis + sister APIs

  • OpenWeather MCP — wraps the OpenWeatherMap API (openweathermap.org)

  • MCP server exposing the Backtest360 engine API as tools for AI agents.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aarvijayanand/weather-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server