Provides real-time weather and 3-day forecast for Chinese cities using the QWeather API, working with any MCP-compatible client.
SaferSkills independently audited weather-china-mcp (MCP Server) 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.
<p align="center"> <a href="README.zh.md">🇨🇳 中文</a> | <b>🇺🇸 English</b> </p>
A Model Context Protocol (MCP) server that provides real-time weather and 3-day forecast for Chinese cities, powered by QWeather (和风天气) API.
Inspiration: This project is a learning exercise by the author, inspired by the MCP server weather tutorial on modelcontextprotocol.io — which demonstrated building a US weather MCP server. This is the Chinese weather counterpart, adapted for the QWeather API.
.env, never committed to Git| Requirement | Description |
|---|---|
| Python | ≥ 3.11 |
| uv | Python package manager (install) |
| QWeather Account | Free tier: 1,000 calls/day. Register at console.qweather.com |
After registering on QWeather Console:
xxx.xxx.qweatherapi.com)# 1. Clone the repo
git clone <your-repo-url>
cd weather-china
# 2. Set up environment variables
cp .env.example .env
# Edit .env and fill in your QWeather API Key & API Host
# 3. Install dependencies
uv sync
# 4. Run the server (for testing)
uv run weather.pyAdd to .mcp.json in your project root (or ~/.claude/mcp.json for global):
{
"mcpServers": {
"weather-china": {
"command": "uv",
"args": [
"--directory",
"/path/to/weather-china",
"run",
"weather.py"
]
}
}
}Restart Claude Code or run /mcp reload to pick up the change.
In Codex, open Settings → MCP Servers → Add:
{
"mcpServers": {
"weather-china": {
"command": "uv",
"args": [
"--directory",
"/path/to/weather-china",
"run",
"weather.py"
]
}
}
}Add to your OpenClaw MCP configuration file:
mcp_servers:
weather-china:
command: uv
args:
- --directory
- /path/to/weather-china
- run
- weather.pyAny MCP client that supports stdio transport:
{
"mcpServers": {
"weather-china": {
"command": "uv",
"args": ["--directory", "/path/to/weather-china", "run", "weather.py"],
"env": {
"QWEATHER_API_KEY": "<your-api-key>",
"QWEATHER_API_HOST": "<your-api-host>"
}
}
}
}Note: If your client doesn't inherit shell environment variables, passQWEATHER_API_KEYandQWEATHER_API_HOSTvia theenvfield as shown above. When using.envfile, the server loads them automatically.
get_weatherGet real-time weather for a Chinese city.
Parameters:
city: string — City name (e.g., "北京", "上海", "广州")get_forecastGet 3-day weather forecast for a Chinese city.
Parameters:
city: string — City name (e.g., "北京", "上海", "广州")weather-china/
├── weather.py # MCP server — main entry point
├── main.py # Placeholder entry
├── .env.example # Environment variable template
├── .env # Your credentials (gitignored)
├── .gitignore
├── .mcp.json # Claude Code MCP config (example)
├── pyproject.toml # Python project metadata & dependencies
├── uv.lock # Dependency lock file
├── README.md # English readme
└── README.zh.md # Chinese readme.env is listed in .gitignore — never commit your API credentials.env.example provides a template for others to set up their own credentialsQWEATHER_API_KEY and QWEATHER_API_HOST are read from environment variables, not hardcodedMIT
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.