天气预警与预报服务

这是一个通过美国国家气象局API提供天气预警和天气预报的MCP服务器,适用于获取美国各州天气预警以及指定经纬度坐标天气信息的场景。

  • by Lingikaushikreddy
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 Lingikaushikreddy/weather-MCP

使用说明

MCP Weather Server 🌤️

A simple Model Context Protocol (MCP) server that provides weather alerts and forecasts using the National Weather Service (NWS) API.

Tools

  • get_alerts(state): Get weather alerts for a US state.
  • get_forecast(latitude, longitude): Get weather forecast for a specific location.

Setup

  1. Create a virtual environment:

    python3 -m venv .venv
    source .venv/bin/activate
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Run the server:

    python weather.py
    

Configuration (Claude for Desktop)

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "weather": {
      "command": "/absolute/path/to/weather/.venv/bin/python",
      "args": ["/absolute/path/to/weather/weather.py"]
    }
  }
}