Back to MCP directory
publicPublicdnsLocal runtime

MCP Weather Server

基于AccuWeather API的天气服务MCP服务器

article

README

🚀 MCP 天气服务器

MCP 天气服务器是一个简单的服务器,借助 AccuWeather API 为用户提供每小时的天气预报,满足对天气信息的实时需求。

🚀 快速开始

📦 安装指南

  1. 使用uv安装依赖:
uv venv
uv sync
  1. 创建包含您的 AccuWeather API 密钥的.env文件:
ACCUWEATHER_API_KEY=your_api_key_here

您可以在AccuWeather API注册以获取 API 密钥。

运行服务器

{
    "mcpServers": {
        "weather": {
            "command": "uvx",
            "args": ["--from", "git+https://github.com/adhikasp/mcp-weather.git", "mcp-weather"],
            "env": {
                "ACCUWEATHER_API_KEY": "your_api_key_here"
            }
        }
    }
}

💻 使用示例

基础用法

获取每小时天气预报

响应:

{
    "location": "Jakarta",
    "location_key": "208971",
    "country": "Indonesia",
    "current_conditions": {
        "temperature": {
            "value": 32.2,
            "unit": "C"
        },
        "weather_text": "Partly sunny",
        "relative_humidity": 75,
        "precipitation": false,
        "observation_time": "2024-01-01T12:00:00+07:00"
    },
    "hourly_forecast": [
        {
            "relative_time": "+1 hour",
            "temperature": {
                "value": 32.2,
                "unit": "C"
            },
            "weather_text": "Partly sunny",
            "precipitation_probability": 40,
            "precipitation_type": "Rain",
            "precipitation_intensity": "Light"
        }
    ]
}

API 提供以下信息:

  • 当前天气状况,包括温度、天气描述、湿度和降水状态
  • 12 小时预报,包含每小时数据:
    • 自当前时间起的相对时间
    • 摄氏温度值
    • 天气描述
    • 降水概率、类型和强度
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