Weather Forecast MCP Server

Weather Forecast MCP Server

site icon
2025.04.20 3
Python天气服务数据查询位置服务
Weather Forecast MCP Server 是一个基于 Model Context Protocol (MCP) 的服务,用于通过 wttr.in 服务获取全球各地的天气信息。它提供了当前天气状况和多日天气预报的功能,支持中英文及其他语言的地点名称,并且可以轻松集成到支持 MCP 协议的客户端应用中。
View on GitHub

Overview

基本能力

产品定位

Weather Forecast MCP Server 是一个天气信息服务,旨在为开发者和应用程序提供全球天气数据的访问能力。

核心功能

  • 获取任意地点的当前天气状况
  • 获取多日天气预报(最多3天)
  • 支持中英文及其他语言的地点名称
  • 易于与 MCP 客户端应用集成

适用场景

  • 需要集成天气信息的应用程序
  • 需要实时天气数据的开发者
  • 支持多语言地点名称的天气查询服务

工具列表

  • get_weather - 获取指定地点的当前天气状况(最多3天)

常见问题解答

  • 问题:如何集成到 Cursor 中? 解答:通过运行 uv run weather-forecast-server 命令添加 stdio MCP。
  • 问题:如何获取天气数据? 解答:使用 get_current_weather 函数并传入地点名称(如 "baoding" 或 "保定")。

使用教程

使用依赖

无特殊前置依赖,直接安装即可。

安装教程

通过 pip 安装

uv pip install weather-forecast-server

pip install weather-forecast-server

从源码安装

git clone https://github.com/shibing624/mcp-server-weather.git
cd weather-forecast-server
pip install -e .

调试方式

Python 示例

from weather_forecast_server import get_current_weather
print(get_current_weather('baoding')) # 可以是 "baoding" 或 "保定"

作为独立 MCP 服务器运行

uvx weather-forecast-server

uv run weather-forecast-server

python -m weather_forecast_server

集成到 Cursor

uv run weather-forecast-server

许可证

该项目遵循 Apache-2.0 开源许可条款,请参阅 Apache-2.0 了解完整条款。