Back to MCP directory
publicPublicdnsLocal runtime

Weather MCP Server

一个基于OpenWeatherMap API的天气信息MCP服务器,提供实时天气数据查询功能。

article

README

🚀 天气 MCP 服务器

一个使用 OpenWeatherMap API 提供天气信息的现代代码协议 (MCP) 服务器,能够帮助用户便捷地获取实时天气数据。

smithery 徽章

✨ 主要特性

  • 实时数据检索:可实时获取最新的天气数据。
  • 公制单位显示:温度采用公制单位进行显示。
  • 详细天气信息:提供丰富的天气详情,涵盖温度、湿度、风速、日出/日落时间以及天气描述等内容。

📦 安装指南

使用 Smithery 安装

通过 Smithery 可自动安装 Weather MCP Server for Claude Desktop:

npx -y @smithery/cli install @CodeByWaqas/weather-mcp-server --client claude

手动安装

  1. 克隆仓库。
  2. 创建虚拟环境:
python -m venv .venv
source .venv/bin/activate  # 在 Windows 上使用:.venv\Scripts\activate
  1. 安装依赖项:
pip install -e .

📚 详细文档

先决条件

  • Python 3.12 或更高版本。
  • OpenWeatherMap API 密钥。

设置说明

与 Claude Desktop 配合使用

# claude_desktop_config.json
# 可以通过以下位置找到位置:
# Claude -> Settings -> Developer -> Edit Config
{
  "mcpServers": {
      "mcp-weather-project": {
          "command": "uv",
          "args": [
              "--directory",
              "/<绝对路径>/weather-mcp-server/src/resources",
              "run",
              "server.py"
          ],
          "env": {
            "WEATHER_API_KEY": "YOUR_API_KEY"
          }
      }
  }
}

本地/开发设置说明

  • 克隆仓库
git clone https://github.com/CodeByWaqas/weather-mcp-server
  • 安装依赖项: 安装 MCP 服务器依赖:
cd weather-mcp-server

# 创建虚拟环境并激活它
uv venv

source .venv/bin/activate # MacOS/Linux
# 或者在 Windows 上
.venv/Scripts/activate

# 安装依赖
uv add "mcp[cli]" python-dotenv requests httpx

配置

  1. 复制 src/resources/env.examplesrc/resources/.env
  2. 将你的 OpenWeatherMap API 密钥添加到 .env 文件中:
WEATHER_API_KEY=your_api_key_here

使用方法

运行 Claude Desktop 并使用大语言模型(LLM)获取天气信息。

📄 许可证

此项目遵循 MIT 许可证 - 请查看 LICENSE 文件以获取详细信息。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client