weather-china-mcp
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., "@weather-china-mcp what's the weather in Chengdu?"
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.
š¤ Weather China MCP Server
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.
⨠Features
Real-time weather ā temperature, feels-like, humidity, wind, visibility, and more
3-day forecast ā daily high/low, day/night weather, humidity, wind
MCP-native ā works with any MCP-compatible client (Claude Code, Codex, OpenClaw, etc.)
Secure ā API credentials stored in
.env, never committed to Git
Related MCP server: AMap Weather MCP
š Prerequisites
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:
Create a project ā get your API Key
Go to Settings ā copy your dedicated API Host (format:
xxx.xxx.qweatherapi.com)
š Quick Start
# 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.pyš§ MCP Client Configuration
Claude Code
Add 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.
Codex (OpenAI)
In Codex, open Settings ā MCP Servers ā Add:
{
"mcpServers": {
"weather-china": {
"command": "uv",
"args": [
"--directory",
"/path/to/weather-china",
"run",
"weather.py"
]
}
}
}OpenClaw
Add to your OpenClaw MCP configuration file:
mcp_servers:
weather-china:
command: uv
args:
- --directory
- /path/to/weather-china
- run
- weather.pyOther MCP Clients (Generic stdio)
Any 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, pass
QWEATHER_API_KEYandQWEATHER_API_HOSTvia theenvfield as shown above. When using.envfile, the server loads them automatically.
š Available Tools
get_weather
Get real-time weather for a Chinese city.
Parameters:
city: string ā City name (e.g., "åäŗ¬", "äøęµ·", "广å·")get_forecast
Get 3-day weather forecast for a Chinese city.
Parameters:
city: string ā City name (e.g., "åäŗ¬", "äøęµ·", "广å·")š Project Structure
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š Security
.envis listed in.gitignoreā never commit your API credentials.env.exampleprovides a template for others to set up their own credentialsBoth
QWEATHER_API_KEYandQWEATHER_API_HOSTare read from environment variables, not hardcoded
š License
MIT
Available Tools
2 toolsget_forecastA
č·åäøå½ååøęŖę„3天ē天ę°é¢ę„
Args:
city: ååøåē§°ļ¼ä¾å¦"åäŗ¬"ć"äøęµ·"ć"广å·"
Inputs: city (required). Returns: result
get_weatherA
č·åäøå½ååøēå®ę¶å¤©ę° Get weather for chinese city
Args:
city:ååøåē§°,ä¾å¦"åäŗ¬","äøęµ·","广å·"
Inputs: city (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 2 tools
The two tools are clearly distinct: one provides real-time current weather, the other provides a 3-day forecast. There is no overlap or ambiguity in their purposes.
Both tools follow the exact same verb_noun pattern (get_weather, get_forecast), using consistent snake_case and a clear 'get_' prefix.
With only 2 tools, the server feels thin for a weather service, but it is functional for basic real-time and forecast queries. This falls on the borderline low end.
The core weather operations (current conditions and forecast) are covered, but gaps exist for additional useful features like air quality, historical data, or location suggestions, which agents might expect from a comprehensive weather server.
Maintenance
Related MCP Connectors
MCP server for China weather: current conditions and multi-day forecast by city name or adcode.
MCP server for current weather and multi-day forecasts worldwide, Chinese city names and output.
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
MCP server for GLM chat completions using Zhipu AI models via AceDataCloud
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides weather forecast data for locations in China through HeFeng Weather API, supporting real-time, hourly, and daily forecasts with full Chinese weather descriptions.319 npmISC
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides real-time weather information, 4-day forecasts, and city search functionality for Chinese cities via the AMap API. It enables users to query weather data using city names or administrative codes through natural language interactions.1MIT
- 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.34 npm-
- FlicenseAqualityDmaintenanceEnables querying real-time weather, forecasts, and warnings for Chinese cities via the QWeather API.3-