weather-mcp-server
A Python MCP server that provides current weather conditions and multi-day forecasts for cities worldwide using the Open-Meteo API. It exposes tools to get current weather and forecasts without requiring an API key.
README
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

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
- User enters a city name
- MCP client calls a weather tool
- MCP server sends the city to Open-Meteo Geocoding API
- Geocoding API returns latitude, longitude and timezone
- MCP server calls the Open-Meteo Forecast API
- Weather data is formatted into readable text
- 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
- Clone the repository
git clone https://github.com/aarvijayanand/weather-mcp-server.git cd weather-mcp-server
- 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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。