Weather China
БесплатноНе проверенProvides real-time weather and 3-day forecast for Chinese cities using the QWeather API, working with any MCP-compatible client.
Описание
Provides real-time weather and 3-day forecast for Chinese cities using the QWeather API, working with any MCP-compatible client.
README
🇨🇳 中文 | 🇺🇸 English
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
Установка Weather China
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/killerfirst/weather-china-mcpFAQ
Weather China MCP бесплатный?
Да, Weather China MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Weather China?
Нет, Weather China работает без API-ключей и переменных окружения.
Weather China — hosted или self-hosted?
Доступен hosted-вариант: Unyly запускает сервер в облаке, локальная установка не обязательна.
Как установить Weather China в Claude Desktop, Claude Code или Cursor?
Открой Weather China на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
GitHub
PRs, issues, code search, CI status
автор: GitHubFilesystem
Secure file operations with configurable access controls.
Memory
Knowledge graph-based persistent memory system.
Template MCP Server
A CLI tool to create a new Model Context Protocol server project with TypeScript support, dual transport options, and an extensible structure
автор: mcpdotdirectCompare Weather China with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории development
