A FastMCP based QWeather query service
Project description
Weather MCP Server
一个基于 FastMCP 的和风天气(QWeather)查询服务,提供以下工具:
lookup_city(location): 城市/位置查询(名称或经纬度)get_warning(location): 天气预警查询(LocationID 或经纬度)get_forecast(location): 当前天气查询(LocationID 或经纬度)
安装与运行
- 克隆仓库:
git clone --depth 1 https://github.com/gandli/mcp-qweather
uv sync
- 在支持 MCP 的客户端中,可添加如下配置以
stdio方式启动本服务:
{
"mcpServers": {
"weather": {
"name": "weather",
"type": "stdio",
"description": "一个基于 FastMCP 的和风天气(QWeather)查询服务",
"isActive": true,
"registryUrl": "",
"command": "uv",
"args": [
"--directory",
"path/to/mcp-qweather",
"run",
"main.py"
],
"env": {
"QWEATHER_API_HOST": "your_api_host",
"QWEATHER_API_KEY": "your_api_key"
}
}
}
}
零克隆使用(更省事的方式)
- 如果已发布到 PyPI(控制台脚本
weather-mcp),可在客户端直接使用uvx调用,无需克隆仓库:
{
"mcpServers": {
"weather": {
"name": "weather",
"type": "stdio",
"command": "uvx",
"args": [
"weather-mcp"
],
"env": {
"QWEATHER_API_HOST": "your_api_host",
"QWEATHER_API_KEY": "your_api_key"
}
}
}
}
- 或者使用本地已安装的脚本入口(
pipx或uv pip install -e .后):
{
"mcpServers": {
"weather": {
"name": "weather",
"type": "stdio",
"command": "weather-mcp",
"env": {
"QWEATHER_API_HOST": "your_api_host",
"QWEATHER_API_KEY": "your_api_key"
}
}
}
}
说明:
uvx会临时拉取并运行已发布工具的控制台脚本,适合无需克隆的快速使用;- 若尚未发布到 PyPI,可先克隆仓库后执行
uv pip install -e .安装脚本入口; - 服务会从环境变量或
.env读取QWEATHER_API_HOST与QWEATHER_API_KEY。
GitHub Actions 自动发布
- 已内置工作流:
.github/workflows/publish.yml - 触发规则:
- 推送到
main分支:自动发布到 TestPyPI。 - 推送符合
v*的标签(如v0.1.1):自动发布到正式 PyPI。
- 推送到
- 推荐使用 Trusted Publishing:
- 在 PyPI 项目设置启用“Trusted Publishers”,关联此 GitHub 仓库;启用后无需设置密钥。
- 若暂未配置 Trusted Publishing,可用密钥发布:
- 在仓库 Secrets 添加
TEST_PYPI_API_TOKEN与PYPI_API_TOKEN(API Token); - 工作流内已留注释,可切换为
TWINE_USERNAME=__token__与对应密码的方式。
- 在仓库 Secrets 添加
许可
未设置专有许可证。如需开源协议,请在 pyproject.toml 或根目录添加相应许可文件。
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_qweather-0.0.1.tar.gz.
File metadata
- Download URL: mcp_qweather-0.0.1.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f34cc6fa1e5982f28334e88f5b376c7ec6b55cfbbcbf4893af5a5f1e5c441386
|
|
| MD5 |
ff19d4a4fc37387ce5360413df46d4f4
|
|
| BLAKE2b-256 |
ff5a19445ba203b4832a667bc0da938484bbe8ac2367adb721e9e9dc26a802f3
|
Provenance
The following attestation bundles were made for mcp_qweather-0.0.1.tar.gz:
Publisher:
publish.yml on gandli/mcp-qweather
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_qweather-0.0.1.tar.gz -
Subject digest:
f34cc6fa1e5982f28334e88f5b376c7ec6b55cfbbcbf4893af5a5f1e5c441386 - Sigstore transparency entry: 604863479
- Sigstore integration time:
-
Permalink:
gandli/mcp-qweather@7f49c820687cea985b41446581ea7519f36d22bf -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/gandli
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7f49c820687cea985b41446581ea7519f36d22bf -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_qweather-0.0.1-py3-none-any.whl.
File metadata
- Download URL: mcp_qweather-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd0441018376ba3a48cc92130379ae0248580d7eccccfa4114aad81966c13e40
|
|
| MD5 |
7ff919f6f3d73b52bfe05363c13ad02c
|
|
| BLAKE2b-256 |
6ccd70cf88ce2ae1edb28efb24c34a1a684109170340489c1e35bea41d2e48b6
|
Provenance
The following attestation bundles were made for mcp_qweather-0.0.1-py3-none-any.whl:
Publisher:
publish.yml on gandli/mcp-qweather
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_qweather-0.0.1-py3-none-any.whl -
Subject digest:
cd0441018376ba3a48cc92130379ae0248580d7eccccfa4114aad81966c13e40 - Sigstore transparency entry: 604863480
- Sigstore integration time:
-
Permalink:
gandli/mcp-qweather@7f49c820687cea985b41446581ea7519f36d22bf -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/gandli
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7f49c820687cea985b41446581ea7519f36d22bf -
Trigger Event:
push
-
Statement type: