npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ctermiii/weather-mcp-server

v1.1.1

Published

MCP server for fetching weather data from Open-Meteo API with support for Chinese city names, 1-16 days forecast, temperature, wind, comfort index, precipitation, UV index, and PM2.5/PM10 air quality

Downloads

31

Readme

Weather MCP Server

基于 Open-Meteo API 的 MCP (Model Context Protocol) 天气服务器,为 LLM 大模型提供实时天气查询功能。

功能特性

  • 支持中英文城市名称查询
  • 自动地理编码(城市名→坐标)
  • 获取7天天气预报
  • 详细的天气信息包括:
    • 温度: 最高/最低温度、体感温度
    • 风力: 风速、阵风、风向
    • 舒适度: 基于温度和湿度的舒适度评估
    • 天气状况: 晴、雨、雪等详细描述
    • 降水信息: 降水量、降雨量、降雪量
    • 其他: 日出日落时间、湿度等

安装

npm install

使用方法

1. 配置 MCP 客户端

在 Claude Desktop 或其他 MCP 客户端的配置文件中添加:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "weather": {
      "command": "node",
      "args": ["/Users/wanli/.config/mcp/weather-mcp-metro/index.js"]
    }
  }
}

2. 启动服务器

npm start

3. 在 LLM 中使用

服务器提供了一个工具 get_weather,可以通过以下方式调用:

请帮我查询北京的天气

What's the weather like in Shanghai?

API 说明

get_weather

获取指定城市的天气预报信息。

参数:

  • city (string, 必需): 城市名称,支持中英文

返回示例:

{
  "城市信息": {
    "名称": "Beijing",
    "国家": "China",
    "坐标": "39.9075, 116.39723",
    "时区": "Asia/Shanghai"
  },
  "当前天气": {
    "时间": "2025-10-17T10:00",
    "温度": "18°C",
    "体感温度": "16°C",
    "湿度": "65%",
    "天气状况": "部分多云",
    "风速": "12 km/h",
    "风向": "东北",
    "舒适度": "舒适"
  },
  "七天预报": [
    {
      "日期": "2025-10-17",
      "最高温度": "22°C",
      "最低温度": "14°C",
      "天气状况": "部分多云",
      "降水量": "0mm",
      "降雨量": "0mm",
      "降雪量": "0cm",
      "最大风速": "15 km/h",
      "最大阵风": "25 km/h",
      "主导风向": "东",
      "日出": "2025-10-17T06:30",
      "日落": "2025-10-17T18:15",
      "舒适度": "舒适"
    }
    // ... 其余6天
  ]
}

技术细节

数据来源

  • 地理编码 API: https://geocoding-api.open-meteo.com/v1/search
  • 天气数据 API: https://api.open-meteo.com/v1/forecast

天气参数

  • temperature_2m_max/min: 最高/最低温度
  • weathercode: 天气代码(自动转换为中文描述)
  • precipitation_sum: 总降水量
  • rain_sum: 降雨量
  • snowfall_sum: 降雪量
  • windspeed_10m_max: 最大风速
  • windgusts_10m_max: 最大阵风
  • winddirection_10m_dominant: 主导风向
  • sunrise/sunset: 日出日落时间
  • relative_humidity_2m: 相对湿度
  • apparent_temperature: 体感温度

舒适度评级

基于体感温度和湿度计算:

  • 非常寒冷 (< 0°C)
  • 寒冷 (0-10°C)
  • 凉爽 (10-16°C)
  • 舒适 (16-24°C)
  • 温暖 (24-28°C)
  • 炎热 (28-32°C)
  • 酷热 (> 32°C)

同时考虑湿度影响(高湿度/干燥提示)

依赖项

  • @modelcontextprotocol/sdk: MCP SDK

许可证

MIT

注意事项

  • Open-Meteo API 是免费开源的,无需 API 密钥
  • 数据更新频率取决于 Open-Meteo 服务
  • 建议合理使用,避免过于频繁的请求