这是一个借助WeatherAPI,提供当前天气和空气质量数据的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密钥。
获取指定城市的当前天气数据。
location (字符串):城市名称示例响应:
{
"location": "伦敦",
"国家": "英国",
"temp_c": 15.0,
"condition": "部分多云",
"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
}
}
本项目采用MIT许可证。