mcp-weather-api 是一个强大的天气信息获取工具,支持多种配置选项与位置格式,能轻松满足你对天气数据的需求。
mcp-weather-api 是一个用于获取天气信息的工具,支持多种配置选项和位置格式。以下是详细的安装、配置和使用说明。
要使用 mcp-weather-api,请按照以下步骤进行安装:
打开终端并运行以下命令:
npm install -g mcp-weather-api
从 GitHub 下载最新版本的压缩包,并解压到任意目录。
在项目根目录下创建一个 config.json 文件,添加以下配置:
{
"weather-api-key": "your_api_key",
"default-location": "Beijing",
"units": "metric"
}
weather-api-key:天气 API 的密钥。default-location:默认查询的位置,默认为北京。units:单位系统,支持 imperial 和 metric。mcp-weather-api --location Shanghai
mcp-weather-api --set-default-location Guangzhou
mcp-weather-api --help
如果你希望对工具进行二次开发,请按照以下步骤操作:
git clone https://github.com/username/repo.git
cd repo
npm install
npm test
⚠️ 重要提示
- 确保你拥有有效的天气 API 密钥。
- 部分地理位置可能不支持,建议查阅 API 文档。
- 工具默认使用
metric单位(摄氏度),如需使用华氏度,请设置为imperial。