彩云天气
# 彩云天气 MCP 服务器 ## 设置说明
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"caiyun-weather": {
"args": [
"mcp-caiyun-weather"
],
"command": "uvx"
}
}
}
该服务需要配置环境变量:CAIYUN_WEATHER_API_TOKEN
可用工具 (5 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
get_realtime_weather 2 个参数 需填 2 项
Get the realtime weather for a location.
必填参数:lng、lat
get_hourly_forecast 2 个参数 需填 2 项
Get hourly weather forecast for the next 72 hours.
必填参数:lng、lat
get_weekly_forecast 2 个参数 需填 2 项
Get daily weather forecast for the next 7 days.
必填参数:lng、lat
get_historical_weather 2 个参数 需填 2 项
Get historical weather data for the past 24 hours.
必填参数:lng、lat
get_weather_alerts 2 个参数 需填 2 项
Get weather alerts for the location.
必填参数:lng、lat
服务介绍
彩云天气 MCP 服务器
设置说明
在开始之前,请确保您已经获得了 API 访问权限。您可以在 https://docs.caiyunapp.com/weather-api/ 申请。
首先安装 uv。
MacOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
使用 Claude 桌面版设置
# claude_desktop_config.json
# Can find location through:
# Hamburger Menu -> File -> Settings -> Developer -> Edit Config
{
"mcpServers": {
"caiyun-weather": {
"command": "uvx",
"args": ["mcp-caiyun-weather"],
"env": {
"CAIYUN_WEATHER_API_TOKEN": "YOUR_API_KEY_HERE"
}
}
}
}
向 Claude 提出需要天气信息的问题
例如:"北京现在的天气怎么样?"
本地/开发环境设置说明
使用 Claude 桌面版设置
# claude_desktop_config.json
# Can find location through:
# Hamburger Menu -> File -> Settings -> Developer -> Edit Config
{
"mcpServers": {
"caiyun-weather": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/mcp-caiyun-weather",
"run",
"mcp-caiyun-weather"
],
"env": {
"CAIYUN_WEATHER_API_TOKEN": "YOUR_API_TOKEN_HERE"
}
}
}
}
调试
运行:
npx @modelcontextprotocol/inspector \
uv \
--directory /ABSOLUTE/PATH/TO/PARENT/FOLDER/mcp-caiyun-weather \
run \
mcp-caiyun-weather
可用工具
-
get_realtime_weather: 获取特定地点的实时天气数据- 参数:
lng: 地点的经度lat: 地点的纬度
- 返回详细信息包括:
- 温度
- 湿度
- 风速和风向
- 降水强度
- 空气质量指标(PM2.5, PM10, O3, SO2, NO2, CO)
- AQI(中国和美国标准)
- 生活指数(紫外线和舒适度)
- 参数:
-
get_hourly_forecast: 获取未来72小时的逐小时天气预报- 参数:
lng: 地点的经度lat: 地点的纬度
- 返回逐小时预报包括:
- 温度
- 天气状况
- 降雨概率
- 风速和风向
- 参数:
-
get_weekly_forecast: 获取未来7天的每日天气预报- 参数:
lng: 地点的经度lat: 地点的纬度
- 返回每日预报包括:
- 温度范围(最低/最高)
- 天气状况
- 降雨概率
- 参数:
-
get_historical_weather: 获取过去24小时的历史天气数据- 参数:
lng: 地点的经度lat: 地点的纬度
- 返回历史数据包括:
- 温度
- 天气状况
- 参数:
-
get_weather_alerts: 获取特定地点的天气警报- 参数:
lng: 地点的经度lat: 地点的纬度
- 返回天气警报包括:
- 警报标题
- 警报代码
- 警报状态
- 警报描述
- 参数:
注意:所有工具都需要在环境变量 CAIYUN_WEATHER_API_TOKEN 中设置有效的彩云天气 API 令牌。