Weather MCP Tool
Инструмент Weather MCP (ориентирован на Индию)
Сервер MCP (Model Context Protocol), использующий API OpenWeatherMap для предоставления:
Погодные условия в реальном времени
5-дневные прогнозы погоды
Данные о качестве воздуха
Поиск местоположения
🚀 Настройка
Требуется Python 3.10+ .
Установить зависимости:
pip install -r requirements.txtПолучите ключ API от OpenWeatherMap .
Создайте файл
.envв корневой папке:OPENWEATHER_API_KEY=your_api_key_here
Related MCP server: MCP Weather Free
🛠 Доступные инструменты
get_current_weather(location: str)
Возвращает текущую погоду для указанного местоположения.
get_weather_forecast(location: str, days: int = 5)
Возвращает прогноз погоды (до 5 дней) для указанного местоположения.
get_air_quality(location: str)
Возвращает показатели качества воздуха и уровень AQI.
search_location(query: str)
Возвращает до 5 совпадений местоположений на основе запроса.
🧪 Пример вывода (Индия)
Текущая погода (Дели)
{
"location": {
"name": "Delhi",
"country": "IN",
"lat": 28.6139,
"lon": 77.2090
},
"temperature": {
"current": 32.4,
"feels_like": 35.1,
"min": 30.0,
"max": 36.2
},
"weather_condition": {
"main": "Haze",
"description": "smoky haze",
"icon": "50d"
},
"wind": {
"speed": 4.1,
"deg": 135
},
"clouds": 20,
"humidity": 58,
"pressure": 1005,
"visibility": 5000,
"sunrise": "2025-03-16T06:20:00",
"sunset": "2025-03-16T18:40:00",
"timestamp": "2025-03-16T14:30:00"
}Прогноз погоды (Мумбаи)
{
"location": {
"name": "Mumbai",
"country": "IN",
"lat": 19.0760,
"lon": 72.8777
},
"forecast": [
{
"datetime": "2025-03-16T12:00:00",
"temperature": {
"temp": 33.2,
"feels_like": 37.8,
"min": 31.5,
"max": 34.0
},
"weather_condition": {
"main": "Clouds",
"description": "scattered clouds",
"icon": "03d"
},
"wind": {
"speed": 3.9,
"deg": 200
},
"clouds": 40,
"humidity": 70,
"pressure": 1008,
"visibility": 10000,
"pop": 0.1
}
],
"days": 5
}Качество воздуха (Бангалор)
{
"location": {
"name": "Bengaluru",
"country": "IN",
"lat": 12.9716,
"lon": 77.5946
},
"air_quality_index": 2,
"air_quality_level": "Fair",
"components": {
"co": 102.4,
"no": 0.0,
"no2": 12.6,
"o3": 30.5,
"so2": 3.8,
"pm2_5": 45.1,
"pm10": 60.2,
"nh3": 1.5
},
"timestamp": "2025-03-16T14:30:00"
}Поиск местоположения
{
"results": [
{
"name": "Kolkata",
"state": "West Bengal",
"country": "IN",
"lat": 22.5726,
"lon": 88.3639
},
{
"name": "Kolkata",
"state": "",
"country": "IN",
"lat": 22.5675,
"lon": 88.3700
}
]
}🧰 Обработка ошибок
Все инструменты возвращают четкие сообщения об ошибках:
{ "error": "Location 'XYZ' not found" }📌 Заметки
Убедитесь, что файл
.envнастроен правильно.Активация ключей API может занять некоторое время.
Бесплатный уровень OpenWeatherMap: 60 вызовов API в минуту.
🧑💻 Запустите сервер
mcp dev main.pyПосле запуска вы сможете использовать этот сервер с MCP-совместимыми клиентами, такими как Claude Desktop или другими инструментами автоматизации.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
An MCP server for weather information by @kulybaba
An MCP server for weather information by @kulybaba
MCP server for weather with reasoning — umbrella advice, outdoor checks, city comparisons.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server that provides real-time weather information including temperature, humidity, wind speed, and sunrise/sunset times through the OpenWeatherMap API.2415MIT
- AlicenseNot gradedqualityDmaintenanceAn 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.2MIT
- FlicenseCqualityDmaintenanceAn MCP server that provides access to current weather data and 5-day forecasts via the Open Weather13 API. It enables users to retrieve weather information using city names or geographic coordinates across various languages.3-
- FlicenseNot gradedqualityDmaintenanceAn MCP server that provides current weather conditions and forecasts via OpenWeatherMap API to AI agents.-