天气预报 MCP 服务器是一个借助 wttr.in 服务,获取全球各地天气信息的工具。它能为用户提供当前天气状况及多日天气预报,还可轻松集成到支持 MCP 协议的客户端中。
此 MCP 服务器提供了获取当前天气状况及多日天气预报的工具。它可以轻松集成到支持 MCP 协议的客户端中,包括 Claude 和其他支持 MCP 的大型语言模型应用。
使用 uv
命令安装:
uv pip install weather-forecast-server
或使用 pip:
pip install weather-forecast-server
git clone https://github.com/shibing624/mcp-server-weather.git
cd weather-forecast-server
pip install -e .
from weather_forecast_server import get_weather
print(get_weather('baoding')) # 支持 "baoding" 或 "保定"
使用 stdio 运输方式运行:
uvx weather-forecast-server
或
uv run weather-forecast-server
或
python -m weather_forecast_server
之后,您可以使用任何支持 stdio 运输的 MCP 客户端。
要在 Cursor 中添加天气 MCP 服务器,请添加 stdio 类型的 MCP 并运行命令:
uv run weather-forecast-server
get_weather
- 获取某个地点的当前天气状况(最多3天)本项目基于 Apache License 2.0 开源,可用于商业用途。请在产品描述中包含 weather-forecast-server 项目的链接及许可信息。
我们欢迎任何贡献以改进此项目!提交 Pull Request 前,请:
tests
目录下添加适当的单元测试python -m pytest
确保所有测试通过