WeatherAPI MCP服务器
使用WeatherAPI提供当前天气和空气质量数据的MCP服务器。
特性
- 获取任何城市的当前天气数据
- 空气质量信息(可选)
- 天气资源的动态URI支持
- 与n8n、Claude桌面应用程序、Windsurf IDE、Cursor IDE和其他MCP客户端轻松集成
入门指南
获取WeatherAPI密钥
- 首选 WeatherAPI.com 网站
- 注册一个免费帐户
- 登录后,转到您的仪表板
- 从“API密钥”部分复制您的API密钥
MCP配置
将以下配置添加到Windsurf MCP配置文件中:
{
"mcpServers": {
"weather": {
"command": "npx",
"args": ["-y", "@swonixs/weatherapi-mcp"],
"env": {
"WEATHER_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}替换 YOUR_API_KEY_HERE 使用您从WeatherAPI.com获得的API密钥。
工具
get_weather
获取指定城市的当前天气数据。
参数:
location(string):城市名称
示例响应:
{
"location": "London",
"country": "United Kingdom",
"temp_c": 15.0,
"condition": "Partly cloudy",
"humidity": 71,
"wind_kph": 14.4,
"air_quality": {
"co": 230.3,
"no2": 13.5,
"o3": 52.9,
"pm2_5": 8.5,
"pm10": 12.1,
"us-epa-index": 1
}
}仓库
许可证
麻省理工学院
