weather-china-mcp
Click on "Install 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-mcpWhat's the weather in Beijing?"
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.
中国天气网 MCP 服务
基于中国天气网(weather.com.cn)的 MCP 服务器,提供实时天气和 5 天预报查询。兼容 Claude Desktop、Claude Code、Cursor、Cline、Windsurf、OpenCode 等 AI 工具。
直接调用中国天气网官方接口,无需 API Key,免费使用。
快速安装(npm)
# 全局安装
npm install -g weather-china-mcp然后在你的 MCP 客户端配置中添加:
{
"mcpServers": {
"weather-china": {
"type": "stdio",
"command": "weather-china-mcp",
"args": []
}
}
}或者直接用 npx(无需全局安装):
{
"mcpServers": {
"weather-china": {
"type": "stdio",
"command": "npx",
"args": ["-y", "weather-china-mcp"]
}
}
}Related MCP server: HeFeng Weather MCP Server
配置
配置位置说明(项目级 vs 全局)
MCP 服务可以在两个位置配置,区别如下:
配置级别 | 配置文件位置 | 作用范围 | 适用客户端 |
项目级 | 项目根目录下的 | 仅当前项目 | Claude Code、OpenCode |
全局级 | 用户主目录下的配置文件 | 所有项目 | Claude Code、Claude Desktop、OpenCode、Cursor 等 |
方式一:项目级配置(仅当前项目生效)
适用场景:希望这个 MCP 服务只在某个特定项目中可用。
在项目根目录下创建 .mcp.json 文件:
<项目根目录>/
├── .mcp.json ← 在这里创建
├── src/
├── package.json
└── ...方式二:全局配置(推荐,所有项目生效)
适用场景:希望在任何项目、任何目录都能使用这个 MCP 服务。
2.1 Claude Code 全局配置
配置文件路径:
系统 | 完整路径 |
Windows |
|
macOS |
|
Linux |
|
简写:
~/.claude.json
在 ~/.claude.json 中添加 mcpServers 字段(详见下方安装方式)。
2.2 Claude Desktop 配置
系统 | 完整路径 |
Windows |
|
macOS |
|
2.3 OpenCode 全局配置
配置文件路径:
系统 | 完整路径 |
Windows |
|
macOS |
|
Linux |
|
简写:
~/.config/opencode/opencode.jsonc
⚠️ 注意:OpenCode 的配置格式与 Claude Code 不同,详见下方 OpenCode 配置格式。
2.4 Cursor / Windsurf / Cline 等 IDE
IDE | 配置方式 |
Cursor | 设置面板 → MCP,或项目 |
Windsurf | 设置面板 → MCP |
Cline | 扩展设置 → MCP 配置 |
安装方式与配置内容
以下安装方式对应不同的
command+args,根据你的选择填入上述配置文件。
安装方式 A:GitHub 直装(npx,推荐)
无需克隆,直接通过 npx 从 GitHub 运行:
{
"mcpServers": {
"weather-china": {
"type": "stdio",
"command": "npx",
"args": ["-y", "github:zaixiamaomaoyu/weather-china-mcp"]
}
}
}安装方式 B:本地克隆(Git Clone)
如果你是从 GitHub 克隆到本地运行的,需要先安装依赖,然后使用本地绝对路径:
git clone https://github.com/zaixiamaomaoyu/weather-china-mcp.git
cd weather-china-mcp
npm install配置内容(将 <你的项目路径> 替换为实际路径):
{
"mcpServers": {
"weather-china": {
"type": "stdio",
"command": "node",
"args": ["<你的项目路径>/weather-china-mcp/src/index.js"]
}
}
}示例:如果克隆到
D:\projects\weather-china-mcp,则路径为D:/projects/weather-china-mcp/src/index.js
安装方式 C:npm 全局安装
npm install -g weather-china-mcp配置内容:
{
"mcpServers": {
"weather-china": {
"type": "stdio",
"command": "weather-china-mcp",
"args": []
}
}
}安装方式 D:npm 包 + npx(不全局安装)
无需全局安装,直接用 npx 运行:
{
"mcpServers": {
"weather-china": {
"type": "stdio",
"command": "npx",
"args": ["-y", "weather-china-mcp"]
}
}
}各安装方式对比
安装方式 | 是否需要克隆 | 是否需要全局安装 | 配置中的 command | 推荐度 |
A. GitHub 直装(npx) | ❌ | ❌ |
| ⭐⭐⭐ |
B. 本地克隆 | ✅ | ❌ |
| ⭐⭐ |
C. npm 全局安装 | ❌ | ✅ |
| ⭐⭐ |
D. npm + npx | ❌ | ❌ |
| ⭐⭐⭐ |
OpenCode 配置格式
⚠️ OpenCode 的配置格式与 Claude Code 不同,主要差异如下:
差异项 | Claude Code | OpenCode |
顶层键 |
|
|
类型关键字 |
|
|
命令格式 |
|
|
环境变量 |
|
|
支持注释 | ❌ | ✅( |
OpenCode 配置示例
在 opencode.jsonc(项目级或全局)中添加:
// opencode.jsonc
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"weather-china": {
"type": "local",
"command": ["npx", "-y", "github:zaixiamaomaoyu/weather-china-mcp"],
"enabled": true
}
}
}OpenCode 各安装方式对应的 command
安装方式 | OpenCode 的 |
A. GitHub 直装(推荐) |
|
B. 本地克隆 |
|
C. npm 全局安装 |
|
D. npm + npx |
|
OpenCode MCP 管理命令
opencode mcp list # 列出所有 MCP 服务器和认证状态
opencode mcp auth <name> # 与需要 OAuth 的 MCP 服务器进行认证
opencode mcp debug <name> # 调试连接/OAuth 问题
opencode mcp logout <name> # 移除已存储的凭证配置验证
配置完成后,重启你的客户端,然后验证:
Claude Code:运行 /mcp,如果看到 weather-china 服务已连接并列出 weather_current、weather_forecast、weather_summary 三个工具,说明配置成功。
OpenCode:运行 opencode mcp list,如果看到 weather-china 状态为已连接,说明配置成功。
其他客户端:在对话中尝试调用天气查询,如"查询北京天气"。
可用工具
工具名称 | 描述 | 参数 |
| 实时天气(温度、湿度、PM2.5、空气质量、气压) |
|
| 5 天天气预报(含天气状况、高低温、风向风力) |
|
| 天气摘要(实时 + 今天 + 明天) |
|
支持的城市
支持任意中文城市名查询,查找逻辑如下:
本地映射表(
city-codes-complete.json,含 2732 个城市/区县)精确匹配(如
广州)自动去后缀(如
广州市→广州)模糊匹配(如输入部分城市名)
在线搜索 fallback(中国天气网内部搜索接口)
本地表找不到时,自动按城市名在线搜索代码
搜索到后自动缓存到本地,下次无需再请求网络
支持镇级地名(自动映射到上级市级数据)
数据源
项目 | 说明 |
数据来源 | 中国天气网 weather.com.cn |
天气接口 |
|
搜索接口 |
|
认证方式 | 无需 API Key |
注意事项
预报天数:
weather_forecast返回 5 天预报,这是中国天气网官方接口fc数组能提供的最大天数,无法获取 7 天或 15 天数据。
返回数据示例
weather_current
{
"city": "广州",
"temperature_c": "28.8",
"weather": "多云",
"wind": "西南风 1级",
"humidity_pct": "84%",
"pressure_hpa": "998",
"aqi": "36",
"pm25": "36",
"updateTime": "18:30",
"notice": "多云转晴,南风转微风 3-4级转<3级"
}weather_forecast
{
"city": "广州",
"updateTime": "18:30",
"days": 5,
"forecast": [
{
"date": "7/22",
"week": "今天",
"weather_day": "多云",
"weather_night": "晴",
"temp_high": "33℃",
"temp_low": "25℃",
"wind_day": "南风 3-4级",
"wind_night": "无持续风向 <3级"
}
]
}weather_summary
{
"city": "广州",
"updateTime": "18:30",
"current": {
"temperature_c": "28.8",
"humidity_pct": "84%",
"weather": "多云",
"wind": "西南风 1级",
"aqi": "36",
"pm25": "36"
},
"today": {
"date": "7/22",
"week": "今天",
"weather_day": "多云",
"weather_night": "晴",
"temp_high": "33℃",
"temp_low": "25℃",
"wind": "南风 3-4级"
},
"tomorrow": {
"date": "7/23",
"week": "星期四",
"weather_day": "晴",
"weather_night": "晴",
"temp_high": "34℃",
"temp_low": "26℃",
"wind": "无持续风向 <3级"
}
}依赖
@modelcontextprotocol/sdk — MCP 协议 SDK
许可证
MIT
Available Tools
3 toolsweather_currentA
获取中国天气网实时天气(温度、湿度、PM2.5、空气质量等)。参数:city(城市名,如'广州')
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes | 城市名,如:广州、北京、上海 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so the description carries full burden. It lists returned attributes but does not mention behavior like rate limits, authentication needs, or response format. Acceptable for a simple read-only tool but lacks depth.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence containing both purpose and parameter info. Concise and front-loaded, though slightly redundant with the schema. No wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema and simple input, the description lists key output attributes (temp, humidity, PM2.5, etc.) but doesn't specify structure or units. Adequate but could be more precise.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% (one parameter 'city' with examples). The description repeats the parameter with an example ('广州'), adding no extra meaning beyond the schema. Baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states it retrieves real-time weather data (temperature, humidity, PM2.5, etc.) from China Weather Network. It names specific attributes and distinguishes from sibling tools (weather_forecast, weather_summary) by focusing on current conditions.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use vs. alternatives. The sibling tool names imply 'current' vs. 'forecast' or 'summary', but the description does not clarify use cases or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
weather_forecastB
获取中国天气网 15 天天气预报。参数:city(城市名)
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes | 城市名,如:广州、北京、上海 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided. Description only states 'get 15-day forecast' with no disclosure of data freshness, limitations, or error behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Concise with two segments: purpose and parameter. Efficient but could add structure like usage notes.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Simple tool with one parameter, no output schema, and minimal description. Lacks details on forecast content or how to interpret results.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. Description repeats the city parameter without adding new semantics beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Clearly states verb 'get' and resource '15-day weather forecast from China Weather Network'. Distinct from siblings 'weather_current' and 'weather_summary'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus siblings or any context for scenario selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
weather_summaryA
获取中国天气网天气摘要(实时+今天+明天,简洁格式)。参数:city(城市名)
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes | 城市名,如:广州、北京、上海 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It only mentions the data scope (real-time + today + tomorrow) and format (concise), but lacks details on data freshness, source reliability, or any operational constraints.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence plus a parameter note, front-loading the core purpose and providing essential context with no extraneous text.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has no output schema, and the description does not detail the return format or fields. While it states '简洁格式' (concise format), this is vague. For a simple tool with one parameter, the description is adequate but could be improved by specifying what data points are included in the summary.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
There is only one parameter, 'city', with schema description fully covering its semantics (e.g., example city names). The description reiterates '参数:city(城市名)' but adds no additional meaning beyond the schema. With 100% schema coverage, a baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states the tool retrieves a weather summary from China Weather Network, covering real-time, today, and tomorrow in concise format. This distinguishes it from siblings weather_current and weather_forecast, which focus on single aspects.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies the tool is for retrieving a combined summary when both current and short-term forecast are needed, but does not explicitly state when to use it versus siblings or provide exclusion criteria.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
3 tool updates
v1.0.4- First observed
weather_current - First observed
weather_forecast - First observed
weather_summary
TDQS
Each tool has a clearly distinct purpose: current conditions, 15-day forecast, and a concise summary combining current+today+tomorrow. No overlap that would cause confusion.
All tools follow the exact same snake_case pattern with 'weather_' prefix followed by a noun (current, forecast, summary), making the set predictable and easy to navigate.
Three tools is perfectly scoped for a weather service covering current, forecast, and summary data. Not too many or too few.
Covers the core weather information needs (current, forecast, concise summary). Minor missing features like weather alerts or historical data, but not significant for typical usage.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server for current weather and multi-day forecasts worldwide, Chinese city names and output.
Free, keyless real-time weather and 7-day forecasts for any city worldwide.
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
MCP server for weather with reasoning — umbrella advice, outdoor checks, city comparisons.
Related MCP Servers
FlicenseBqualityCmaintenanceProvides a Model Context Protocol server that enables large language models to query and retrieve real-time weather forecasts for cities and regions across China.1-- AlicenseBqualityDmaintenanceProvides weather forecast data for locations in China through HeFeng Weather API, supporting real-time, hourly, and daily forecasts with full Chinese weather descriptions.324ISC
- 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
- AlicenseNot gradedqualityCmaintenanceReal-time weather query MCP server for Chinese cities and global cities using wttr.in API.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/zaixiamaomaoyu/weather-china-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server