weather-china-mcp
Provides real-time weather and 3-day forecast for Chinese cities using the QWeather API, working with any MCP-compatible client.
README
π€ Weather China MCP Server
<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.
β¨ 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
π 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.py
Other 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 credentials- Both
QWEATHER_API_KEYandQWEATHER_API_HOSTare read from environment variables, not hardcoded
π License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.