China Weather MCP Server

China Weather MCP Server

Enables querying weather forecasts (1-7 days) and meteorological warnings for Chinese cities using the QWeather API. Supports detailed weather data including temperature, humidity, wind, precipitation, UV index, and real-time weather alerts.

Category
Visit Server

README

中国天气查询 MCP 服务器

照抄Mcp官网Demo的基于和风天气API的Model Context Protocol (MCP)服务器,用于查询中国城市的天气信息和气象预警。

code ~/Library/Application\ Support/Claude/claude_desktop_config.json 

{
  "mcpServers": {
    "weather": {
      "command": "node",
      "args": [
        "your_dir/weather/build/index.js"
      ]
    }
  }
}

alt text

alt text

功能特性

  • 🌤️ 天气预报: 获取中国任意城市的1-7天天气预报
  • ⚠️ 气象预警: 查询城市的实时气象预警信息
  • 🏙️ 智能城市搜索: 支持中文城市名称搜索
  • 📊 详细信息: 提供温度、湿度、风力、降水、紫外线等详细天气数据

安装和配置

1. 获取API密钥

访问 和风天气开发平台 注册账号并获取免费的API密钥。

2. 设置环境变量

const QWEATHER_API_BASE = "https://ph5ctubwqh.re.qweatherapi.com";
const API_KEY = "dedccbe28e4d43a28e9db478df8aca71";

3. 安装依赖

npm install

4. 构建项目

npm run build

可用工具

1. get-weather-forecast

获取城市天气预报

参数:

  • city (string): 城市名称,如:北京、上海、广州等
  • days (number, 可选): 预报天数,1-7天,默认3天

示例:

{
  "city": "北京",
  "days": 5
}

2. get-weather-warnings

获取城市气象预警信息

参数:

  • city (string): 城市名称,如:北京、上海、广州等

示例:

{
  "city": "上海"
}

支持的城市

支持中国大陆、港澳台地区的所有主要城市,包括但不限于:

  • 直辖市: 北京、上海、天津、重庆
  • 省会城市: 广州、深圳、杭州、南京、武汉、成都、西安等
  • 地级市: 苏州、无锡、佛山、东莞、大连等
  • 县级市: 昆山、江阴、张家港等

数据说明

天气预报包含以下信息:

  • 📅 日期
  • 🌡️ 最高/最低温度
  • ☀️ 白天天气状况
  • 🌙 夜间天气状况
  • 💨 风向风力
  • 💧 湿度
  • 🌧️ 降水量
  • 📊 气压
  • 👁️ 能见度
  • ☀️ 紫外线指数
  • 🌅 日出日落时间

气象预警包含:

  • ⚠️ 预警标题和类型
  • 📊 预警等级
  • 📍 影响区域
  • ⏰ 生效时间
  • 📋 详细描述

错误处理

服务器会处理以下常见错误:

  • API密钥无效或未设置
  • 城市名称不存在
  • 网络连接问题
  • API请求限制

开发

项目结构

weather/
├── src/
│   └── index.ts          # 主服务器文件
├── build/
│   └── index.js          # 编译后的文件
├── package.json
├── tsconfig.json
└── README.md

本地开发

  1. 修改源代码 src/index.ts
  2. 重新构建: npm run build
  3. 测试运行: npm start

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request!

相关链接

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured