基于MCP的天气查询工具
一个支持命令行和服务模式的全球天气查询工具,使用wttr.in API获取数据。
快速入门
安装
- 克隆仓库:
git clone https://github.com/liye71023326/weather-cli.git
- 进入目录:
cd weather-cli
- 使用
uv pip install -e .
或pip install -e .
安装依赖。
命令行模式
- 查询默认城市(北京)天气:
weather-cli forecast
- 查询指定城市天气:
weather-cli forecast --latitude 31.2304 --longitude 121.4737
服务模式
- 启动服务:
python run_server.py
- 或使用MCP CLI工具:
mcp run weather
- 查询天气:
- 默认城市:
mcp call weather get_forecast
- 指定经纬度:
mcp call weather get_forecast --latitude 31.2304 --longitude 121.4737
- 默认城市: