Weather MCP Tool
天气 MCP 工具(以印度为中心)
使用 OpenWeatherMap API 的 MCP(模型上下文协议)服务器提供:
实时天气状况
5天天气预报
空气质量数据
位置搜索
🚀 设置
需要Python 3.10+ 。
安装依赖项:
pip install -r requirements.txt从OpenWeatherMap获取 API 密钥。
在根文件夹中创建一个
.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 或其他自动化工具)一起使用。
This server cannot be installed
Maintenance
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
- AlicenseBqualityDmaintenanceAn MCP server that provides real-time weather information including temperature, humidity, wind speed, and sunrise/sunset times through the OpenWeatherMap API.415MIT
- 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.1MIT
- 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 gradedqualityCmaintenanceAn MCP server that provides current weather conditions and forecasts via OpenWeatherMap API to AI agents.
Related MCP Connectors
This MCP server provides seamless access to Malaysia's government open data, including datasets, w…
OpenWeather MCP — wraps the OpenWeatherMap API (openweathermap.org)
350+ production-ready APIs through one MCP server — weather, geocoding, validation, financial data.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/jalaj-pandey/Weather-MCP-Tool'
If you have feedback or need assistance with the MCP directory API, please join our Discord server