Hefeng Qweather Mcp — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Hefeng Qweather Mcp (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
一个基于 Model Context Protocol (MCP) 的和风天气服务,提供天气预报、气象预警、空气质量、历史数据、天文信息、热带气旋 (台风) 等多种气象数据查询功能。
uv tool install hefeng-qweather-mcp或使用 pip 安装:
pip install hefeng-qweather-mcp# 推荐配置 - API KEY 认证(简单快捷)
HEFENG_API_HOST=你的API主机地址
HEFENG_API_KEY=你的API KEY
# 备用配置 - JWT 数字签名认证
# HEFENG_PROJECT_ID=你的项目ID
# HEFENG_KEY_ID=你的凭据ID
# HEFENG_PRIVATE_KEY_PATH=./ed25519-private.pem
# 可选:直接加载密钥内容,方便远程部署
# HEFENG_PRIVATE_KEY= # 复制并编辑配置文件
cp .env.example .env
# 填入您的和风天气 API 配置
# 推荐使用 API KEY 认证方式服务启动时会按以下优先级自动查找 .env 配置文件(已加载的变量不会被后续文件覆盖):
| 优先级 | 路径 | 适用场景 |
|---|---|---|
| 1 | 当前工作目录下的 .env | 本地项目内配置 |
| 2 | 项目根目录下的 .env | 源码方式运行时 |
| 3 | ~/.config/qweather/.env | 用户级配置(pip/uv 安装后推荐) |
用户级路径遵循 XDG 规范:若设置了XDG_CONFIG_HOME环境变量,则查找$XDG_CONFIG_HOME/qweather/.env。
# STDIO 模式(推荐用于本地开发)
hefeng-qweather-mcp stdio
# HTTP 模式(推荐用于远程访问)
hefeng-qweather-mcp http#### HTTP 模式
HTTP 模式提供 Web API 接口,适合远程访问和 Web 集成:
hefeng-qweather-mcp http服务器启动后将在 http://127.0.0.1:8000 运行,MCP 端点为 http://127.0.0.1:8000/mcp。
VS Code 配置:
{
"servers": {
"hefeng-qweather-mcp": {
"url": "http://127.0.0.1:8000/mcp",
"type": "http"
}
},
"inputs": []
}#### STDIO 模式
STDIO 模式通过标准输入输出通信,适合本地开发:
hefeng-qweather-mcp stdioVS Code 配置:
{
"servers": {
"hefeng-qweather-mcp": {
"type": "stdio",
"command": "hefeng-qweather-mcp stdio"
}
},
"inputs": []
}使用 uv 运行:
{
"servers": {
"hefeng-qweather-mcp": {
"type": "stdio",
"command": "uvx hefeng-qweather-mcp stdio",
"envFile": "${workspaceFolder}/.env"
}
},
"inputs": []
}#### 查看运行状态
# 查看后台进程
ps aux | grep hefeng-qweather-mcp#### 停止服务器
# 停止所有模式
pkill -f hefeng-qweather-mcp
# 或分别停止
pkill -f "hefeng-qweather-mcp stdio"
pkill -f "hefeng-qweather-mcp http"#### 验证配置
服务启动后,可以通过以下方式验证配置是否正确:
如果遇到配置问题,请检查:
#### 天文数据查询示例
# 查询北京今天的日出日落时间
get_astronomy_sun("北京", "20251029")
# 结果:日出 06:40, 日落 17:17
# 查询上海的月相信息
get_astronomy_moon("上海", "20251101")
# 结果:月升 13:24, 月落 23:09, 月相:上弦月
# 使用经纬度查询(全球任意地点)
get_astronomy_sun("116.41,39.92", "20251029") # 北京坐标
get_astronomy_moon("121.47,31.23", "20251101") # 上海坐标
# 查询未来日期的天文数据
get_astronomy_sun("广州", "20251225") # 圣诞节
get_astronomy_moon("深圳", "20260101") # 元旦#### 多天天气预报示例
# 查询不同天数的天气预报
get_weather("北京", "3d") # 3天预报(默认)
get_weather("上海", "7d") # 7天预报
get_weather("广州", "15d") # 15天预报
get_weather("深圳", "30d") # 30天预报#### GeoAPI功能示例
# 获取热门城市列表
get_top_cities(10, "cn") # 获取10个中国热门城市
# POI关键词搜索(米制半径)
search_poi("116.41,39.92", "故宫", "scenic", radius=10000)
# POI范围搜索(公里制半径)
search_poi_range("116.41,39.92", "scenic", radius=2) # 2公里范围内景点
# 搜索餐厅和其他类型POI
search_poi("北京", "火锅", "scenic", radius=5000) # 北京5公里内的景点#### 空气质量扩展功能示例
# 空气质量小时预报
get_air_quality_hourly("39.92,116.41", "24h") # 24小时逐小时空气质量
get_air_quality_hourly("39.92,116.41", "72h") # 72小时逐小时空气质量
# 空气质量每日预报
get_air_quality_daily("39.92,116.41", "3d") # 3天空气质量预报
# 监测站数据查询
get_air_quality_stations("P58911") # 查询监测站P58911的污染物数据
get_air_quality_stations("P53763") # 查询监测站P53763的污染物数据#### 热带气旋 (台风) 功能示例
# 获取2020年西北太平洋台风列表
get_storm_list("2020")
# 返回: {"code": "200", "storm": [{"id": "NP2008", "name": "巴威", ...}]}
# 获取指定台风的实况和路径
get_storm_track("NP2018")
# 返回: {"code": "200", "isActive": "1", "now": {...}, "track": [...]}
# 获取指定台风的预报路径
get_storm_forecast("NP2018")
# 返回: {"code": "200", "forecast": [{...}]}
# 注意:当前仅支持 basin=NP(西北太平洋),其他流域暂不可用
# 台风列表仅支持本年度和上一年度查询您的 MCP 服务器提供以下天气查询工具:
#### 基础天气工具
city(城市名)或 location(位置ID/坐标)city(城市名)、days(预报天数:3d/7d/10d/15d/30d,默认3d)hours(24h/72h/168h)、city 或 location#### 空气质量工具
city(城市名)city(城市名)、days(1-10天)#### 生活指数工具
city(城市名)、days(1d/3d)、index_types(指数类型)#### 预警和天文工具
city(城市名)location(城市名/LocationID/坐标)、date(yyyyMMdd格式,支持未来60天)location(城市名/LocationID/坐标)、date(yyyyMMdd格式,支持未来60天)#### 历史和详细数据工具
city 或 location、days(1-10天)location(坐标或城市名)#### GeoAPI工具(新功能)
number(返回数量,默认10)、city_type(城市类型:cn/world/overseas,默认cn)location(位置)、keyword(搜索关键词)、poi_type(POI类型:scenic/TSTA)、radius(搜索半径,米制,100-50000)location(中心坐标)、poi_type(POI类型:scenic/TSTA)、radius(搜索半径,公里制,1-50)#### 空气质量扩展工具(新功能)
location(纬度,经度坐标)、hours(预报时长:24h/72h/168h)、lang(语言,默认zh)location(纬度,经度坐标)、days(预报天数:3d)、lang(语言,默认zh)station_id(监测站ID,如P58911)、lang(语言,默认zh)#### 格点天气工具
location(经纬度坐标)、lang(语言,默认zh)、unit(单位,默认m)location(经纬度坐标)、lang(语言,默认zh)、unit(单位,默认m)location(经纬度坐标)、lang(语言,默认zh)、unit(单位,默认m)#### 热带气旋 (台风) 工具(新功能)
year(年份,如 '2020',仅支持本年度和上一年度)、basin(流域,默认 'NP' 西北太平洋)stormid(台风ID,可通过 get_storm_list 获取,如 'NP2018')now 字段可能为 nullstormid(台风ID,如 'NP2018')get_storm_list 获取台风状态git clone https://github.com/fengyucn/hefeng-qweather-mcp.git
cd hefeng-qweather-mcp使用 pip:
pip install -e .或使用 uv (推荐):
uv sync#### 方式一:API KEY 认证(推荐)
cp .env.example .env.env 文件:# API KEY 认证配置
HEFENG_API_HOST=你的API主机地址
HEFENG_API_KEY=你的API KEY通过 pip/uv 安装后,也可以将.env放在~/.config/qweather/目录作为用户级配置(详见「快速开始」中的配置查找优先级)。
#### 方式二:JWT 数字签名认证(备用)
如果需要使用 JWT 认证:
openssl genpkey -algorithm ED25519 -out ed25519-private.pem \
&& openssl pkey -pubout -in ed25519-private.pem > ed25519-public.pem.env 文件:# JWT 认证配置
HEFENG_API_HOST=你的API主机地址
HEFENG_PROJECT_ID=你的项目ID
HEFENG_KEY_ID=你的凭据ID
HEFENG_PRIVATE_KEY_PATH=./ed25519-private.pem注意: 推荐优先使用 API KEY 认证,配置更简单。JWT 认证适合需要更高安全性的场景。
ruff 进行代码格式化和检查mypy 进行静态类型检查~/.config/qweather/.env(XDG 规范,可用 XDG_CONFIG_HOME 覆盖)get_storm_list: 台风列表查询(支持指定流域和年份)get_storm_track: 台风实况和路径(实时位置、等级、气压、风速、历史轨迹)get_storm_forecast: 台风预报路径(预测位置、等级、气压、风速)MIT License
我们欢迎任何形式的贡献!
如果你发现了 bug 或有功能建议,请:
如有问题或建议,请通过以下方式联系:
免责声明: 本项目仅供学习和研究使用,请遵守和风天气的服务条款和 API 使用规范。
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.