天气预报

cpfplus/MCP_7day_forecast
1 Stars 287 次浏览 更新于 2026-08-23

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "kts_weather_server": {
      "timeout": 600,
      "type": "streamableHttp",
      "url": "https://www.shikongxun.com/kts_weather_server/mcp"
    }
  }
}

Streamable HTTP 传输配置

{
  "mcpServers": {
    "kts_weather_server": {
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      },
      "type": "streamableHttp",
      "url": "https://www.shikongxun.com/kts_weather_server/mcp"
    }
  }
}

服务介绍

天气预报MCP服务文档

⚙️ MCP配置

Claude Desktop / Cursor 等客户端配置

在 MCP 配置文件中添加以下配置,YOUR_API_KEY 替换为你的实际 API Key:

{
  "mcpServers": {
    "kts_weather_server": {
      "type": "streamableHttp",
      "url": "https://www.shikongxun.com/kts_weather_server/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

说明: headers 中的 Authorization 会随每次请求自动发送,服务端通过上游 shikongxun.com 远程校验 Key 有效性,校验失败返回 401 Unauthorized

API Key 申请

请访问 时空寻平台 申请 API Key。


🛠️ 可用工具

1. query_day7_weather

功能: 7天天气预报(标准,JSON格式)

参数:

  • lon - 经度(number)
  • lat - 纬度(number)

返回示例:

{
  "location": {"lon": 113.6, "lat": 22.3},
  "forecast": [
    {
      "day": 1,
      "date": "2025-07-30",
      "temperature": {"max": 33, "min": 27, "current": 30, "unit": "℃"},
      "humidity": {"value": 75, "unit": "%"},
      "wind": {"speed": 3.5, "speed_unit": "m/s", "direction": "东南", "gust": 8.0},
      "precipitation": {"value": 0.0, "unit": "mm"},
      "hourly_count": 24
    }
  ],
  "days_count": 7
}

返回字段说明:

字段 类型 说明
location object 查询位置坐标(lon: 经度, lat: 纬度)
forecast array 预报数据数组
forecast[].day number 预报天数序号(1~7)
forecast[].date string 预报日期(YYYY-MM-DD)
forecast[].temperature.max number 最高气温(℃)
forecast[].temperature.min number 最低气温(℃)
forecast[].temperature.current number 当前时刻气温(℃)
forecast[].humidity.value number 相对湿度(%)
forecast[].wind.speed number 风速(m/s)
forecast[].wind.direction string 风向
forecast[].wind.gust number 阵风风速(m/s)
forecast[].precipitation.value number 降水量(mm)
forecast[].hourly_count number 该日小时级数据点数
days_count number 预报总天数

2. query_day7_weather_text

功能: 7天天气预报(标准,可读文本格式)

参数:

  • lon - 经度(number)
  • lat - 纬度(number)

返回示例:

📍 位置: (22.3, 113.6)

📅 7 天预报:

🕐 第1天 (2025-07-30)
  🌡️  温度: 27~33 ℃
  💧 湿度: 75 %
  🌬️  风速: 3.5 m/s 东南
  🌧️  降水: 0.0 mm

返回字段说明:

query_day7_weather 相同,以易读文本格式输出。


3. query_hour24_weather

功能: 24小时天气预报(标准,JSON格式)

参数:

  • lon - 经度(number)
  • lat - 纬度(number)

返回示例:

{
  "location": {"lon": 113.6, "lat": 22.3},
  "forecast": [
    {
      "time": "2025-07-29 14:00",
      "hour_offset": 0,
      "temperature": {"value": 30.5, "unit": "℃"},
      "humidity": {"value": 72, "unit": "%"},
      "wind": {"speed": 3.2, "speed_unit": "m/s", "direction": "东南", "direction_value": 135},
      "precipitation": {"value": 0.0, "unit": "mm"}
    }
  ],
  "hours_count": 24
}

返回字段说明:

字段 类型 说明
location object 查询位置坐标
forecast array 逐时预报数据数组
forecast[].time string 预报时间(YYYY-MM-DD HH:00)
forecast[].hour_offset number 距当前时刻的小时偏移量
forecast[].temperature.value number 温度(℃)
forecast[].humidity.value number 相对湿度(%)
forecast[].wind.speed number 风速(m/s)
forecast[].wind.direction string 风向
forecast[].wind.direction_value number 风向角度值(0~360)
forecast[].precipitation.value number 降水量(mm)
hours_count number 预报总小时数

4. query_hour24_weather_text

功能: 24小时天气预报(标准,可读文本格式)

参数:

  • lon - 经度(number)
  • lat - 纬度(number)

返回示例:

📍 位置: (22.3, 113.6)

📅 24 小时预报:

🕐 2025-07-29 14:00
  🌡️  温度: 30.5 ℃
  💧 湿度: 72 %
  🌬️  风速: 3.2 m/s 东南
  🌧️  降水: 0.0 mm

返回字段说明:

query_hour24_weather 相同,以易读文本格式输出。

📍 常见位置

  • 珠海:113.6, 22.3
  • 深圳:114.1, 22.5
  • 广州:113.3, 23.1
  • 香港:114.2, 22.3
  • 澳门:113.5, 22.2

⚠️ 常见错误

错误信息 原因 解决方案
Missing API key 未携带 API Key 在配置中添加 headers: {"Authorization": "Bearer YOUR_API_KEY"}
API key validation failed API Key 无效或已过期 检查 Key 是否正确,或重新申请

相关 MCP 服务