Skip to main content
Glama
killerfirst

weather-china-mcp

by killerfirst

🌀 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: HeFeng Weather MCP Server

πŸ“‹ 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:

  1. Create a project β†’ get your API Key

  2. 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_KEY and QWEATHER_API_HOST via the env field as shown above. When using .env file, 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

  • .env is listed in .gitignore β€” never commit your API credentials

  • .env.example provides a template for others to set up their own credentials

  • Both QWEATHER_API_KEY and QWEATHER_API_HOST are read from environment variables, not hardcoded

πŸ“„ License

MIT

F
license - not found
-
quality - not tested
B
maintenance

Maintenance

–Maintainers
–Response time
–Release cycle
–Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/killerfirst/weather-china-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server