hefeng-qweather-mcp-modelscope
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@hefeng-qweather-mcp-modelscopeWhat's the weather forecast for Hangzhou?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
和风天气 MCP 服务 · ModelScope 云端托管版(v1.1.1)
本仓库是 hefeng-qweather-mcp 针对 ModelScope MCP 广场云端托管(Hosted) 的适配版本,两处关键适配:
默认 stdio 入口:无参数调用
hefeng-qweather-mcp直接以 stdio 模式启动 (原版 typer 无子命令时会打印帮助并以 exit code 2 退出)HTTP 模式监听
0.0.0.0:云端容器内必须,否则平台网关无法连接; 端口优先读PORT环境变量(云平台注入),其次MCP_PORT,默认 8000
上游源码其余部分未做任何改动。
根因:为什么原版在 ModelScope 部署不起来
原版入口使用 typer.Typer(),只定义了 http / stdio 两个子命令:
app = typer.Typer()
@app.command()
def http() -> None: ...
@app.command()
def stdio() -> None: ...
def main() -> None:
app()ModelScope 平台拉起 server 时不传子命令(对照官方
modelscope-mcp-server:
argparse + --transport 默认 stdio,无参数直接运行)。
原版此时 typer 报 Missing command. 并以 exit code 2 立即退出,
MCP server 从未启动,stdio 握手永远不会发生,平台即判定部署失败。
本地复现(原版):
$ hefeng-qweather-mcp
Usage: ... [OPTIONS] COMMAND [ARGS]...
Try 'hefeng-qweather-mcp --help' for help.
╭─ Error ───────────────────────────╮
│ Missing command. │
╰──────────────────────────────────╯
EXIT CODE: 2 ← 进程直接退出,服务未启动Related MCP server: Weather MCP Server
改动内容(相对原版的唯一差异)
在 main() 前新增一个默认 callback,无子命令时自动进入 stdio 模式:
@app.callback(invoke_without_command=True)
def default(ctx: typer.Context) -> None:
"""
默认入口:不带子命令调用时以 stdio 模式启动
"""
if ctx.invoked_subcommand is None:
stdio()行为对照:
调用方式 | 原版 | 本适配版 |
| 打印帮助,exit 2 ❌ | stdio 模式启动 ✅ |
| stdio 启动 ✅ | stdio 启动 ✅(不变) |
| http 启动 ✅ | http 启动 ✅(不变) |
| 显示帮助 ✅ | 显示帮助 ✅(不变) |
已验证:无参数调用可正确完成 MCP initialize 握手并返回 serverInfo。
部署到 ModelScope
将本文件夹内容作为部署源(独立 Git 仓库 / 分支,或替换主仓库部署目录), 确保仓库根目录包含本版的
pyproject.toml(版本 1.1.1)与src/。平台创建/更新 MCP server 时,配置环境变量(必须,否则模块导入阶段 即抛
ValueError退出):HEFENG_API_HOST=你的API主机地址 # 如 devapi.qweather.com HEFENG_API_KEY=你的API KEY若平台支持自定义启动命令,任选其一均可(本版两者都兼容):
{ "command": "hefeng-qweather-mcp" } { "command": "hefeng-qweather-mcp", "args": ["stdio"] }
零代码替代方案(如不想发适配版)
若 ModelScope 后台支持配置 command/args,直接把原版启动命令配成
hefeng-qweather-mcp stdio(带子命令)即可绕过此问题,无需改任何代码。
适配版的价值在于对任意调用方式都健壮,不依赖平台配置能力。
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
MCP server for current weather and multi-day forecasts worldwide, Chinese city names and output.
Open-Meteo tabanlı anahtarsız hava durumu tahmin MCP sunucusu.
An MCP server for weather information by @kulybaba
Related MCP Servers
FlicenseBqualityCmaintenanceProvides a Model Context Protocol server that enables large language models to query and retrieve real-time weather forecasts for cities and regions across China.1-- FlicenseNot gradedqualityDmaintenanceAn MCP server integrated with the QWeather API that provides real-time weather forecasts and meteorological warnings for AI assistants. It enables users to query current conditions and disaster alerts for specific cities or coordinates.9 npm-
- AlicenseNot gradedqualityDmaintenance基于HelloAgents框架的天气查询MCP服务器,支持12个中国主要城市实时天气查询,使用wttr.in API无需密钥。MIT
- AlicenseNot gradedqualityDmaintenanceReal-time weather query MCP server supporting 12 Chinese cities (and global cities via English names) using wttr.in API, built on HelloAgents framework.MIT