Skip to main content
Glama
wzp0720

weather-mcp

by wzp0720

weather-mcp

一个用于查询天气的 MCP(Model Context Protocol) 服务,基于免费的 Open-Meteo 接口实现。

无需 API Key ✅ 支持全球任意地点 ✅ 实时天气 + 未来 16 天预报 ✅ 中文输出

LLM 客户端(Claude Desktop、Cursor、Cline 等)接入后,就能直接用自然语言问"北京现在多少度""东京未来三天天气怎么样"。


✨ 功能

工具

说明

get_current_weather

查询指定地点的实时天气(温度、体感、天气状况、湿度、风、观测时间)

get_weather_forecast

查询指定地点未来 1–16 天的逐日预报(天气、最高/最低温、降水)

  • 支持城市名(如 北京ShanghaiTokyo)或经纬度(如 39.9,116.4

  • 地点解析使用 Open-Meteo 地理编码接口,返回中文地名

  • WMO 天气代码已映射为中文描述,风向转换为中文方位


Related MCP server: MCP Weather Server

📦 安装

要求 Python ≥ 3.10。

方式一:用 uv(推荐)

uv tool install weather-mcp

或直接从源码安装:

git clone https://github.com/your-username/weather-mcp.git
cd weather-mcp
uv pip install -e .

方式二:用 pip

git clone https://github.com/your-username/weather-mcp.git
cd weather-mcp
pip install -e .

也可以不安装、直接用 requirements.txt

pip install -r requirements.txt

🔌 接入 MCP 客户端

Claude Desktop

编辑配置文件(macOS:~/Library/Application Support/Claude/claude_desktop_config.json,Windows:%APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "weather": {
      "command": "weather-mcp"
    }
  }
}

如果是用 pip install -r requirements.txt 而非可编辑安装,请改用模块方式启动:

{
  "mcpServers": {
    "weather": {
      "command": "python",
      "args": ["-m", "weather_mcp"]
    }
  }
}

💡 在 VS Code / Cursor 中若使用 .venv,把 command 指向虚拟环境里的 python 或脚本路径即可。

Cursor / Cline / 其他支持 MCP 的客户端

配置方式类似,使用 stdio 传输,命令为 weather-mcp(或 python -m weather_mcp)。


🛠 本地开发

git clone https://github.com/your-username/weather-mcp.git
cd weather-mcp

# 创建虚拟环境并安装
python -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
pip install -e .

# 以开发模式运行(带可视化调试界面)
mcp dev src/weather_mcp/server.py

# 直接启动 stdio 服务
python -m weather_mcp

项目结构

weather-mcp/
├── pyproject.toml          # 打包配置(hatchling)+ 入口脚本
├── requirements.txt        # 运行依赖
├── README.md
├── LICENSE                 # MIT
├── .gitignore
└── src/
    └── weather_mcp/
        ├── __init__.py
        ├── __main__.py     # python -m weather_mcp 入口
        ├── server.py       # MCP 服务与工具定义(FastMCP)
        └── weather.py      # Open-Meteo 接口封装与解析

📝 示例

接入后,你可以直接在对话里问:

  • "北京现在天气怎么样?"

  • "帮我查一下上海未来 5 天的天气预报"

  • "39.9,116.4 当前温度是多少?"


📄 许可证

MIT © weather-mcp contributors

A
license - permissive license
-
quality - not tested
C
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.

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Enables real-time weather queries for cities worldwide using Open-Meteo API. Provides 7-day forecasts with detailed information including temperature, wind, humidity, precipitation, and comfort level assessments in both Chinese and English.
    1
    19
    MIT
  • F
    license
    -
    quality
    D
    maintenance
    Provides real-time weather information and 5-day forecasts for cities worldwide using the OpenWeatherMap API. Supports bilingual queries (Chinese and English) with comprehensive weather data including temperature, humidity, and wind speed.
  • A
    license
    -
    quality
    C
    maintenance
    Enables real-time weather queries for global cities via natural language, with support for Chinese and English city names and optional integration with OpenWeather API.
    15
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • Global weather via Open-Meteo: forecast, ERA5 archive, marine, air quality, geocoding, elevation.

  • Open-Meteo MCP — weather forecast + historical reanalysis + sister APIs

  • US weather & geo for AI agents: forecasts, alerts, earthquakes, elevation, geocoding. No keys.

View all MCP Connectors

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/wzp0720/weather-mcp'

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