天气数据服务

一个基于FastMCP构建的天气MCP服务器,提供当前天气数据和城市比较功能。

  • by glassBead-tc
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 glassbead-tc/weather-mcp

使用说明

气象MCP服务器

使用FastMCP构建的简单天气MCP服务器,提供当前天气数据和城市比较。

特性

  • 获取任何城市的当前天气
  • 比较多个城市的天气
  • 支持公制和英制单位
  • 可选详细预测

快速开始

通过Smithery安装

通过以下方式自动安装克劳德桌面天气服务器 史密瑟里:

npx -y @smithery/cli install @glassBead-tc/weather-mcp --client claude

手动安装

  1. 安装依赖项:

    pip install -r requirements.txt
    
  2. 在本地运行:

    python src/weather_server.py
    
  3. 使用克劳德桌面/代码进行测试: 添加到MCP配置中:

    {
      "mcpServers": {
        "weather": {
          "command": "python",
          "args": ["/path/to/weather-mcp/src/weather_server.py"]
        }
      }
    }
    

工具

get_weather

获取一个城市的当前天气。

  • city (string):城市名称
  • units (字符串,可选):公制或英制(默认值:公制)
  • detailed (布尔值,可选):包括3天预测(默认值:false)

比较天气

比较多个城市之间的天气(最多5个)。

  • cities (array):城市名称列表
  • metric (字符串,可选):按“温度”、“湿度”或“风”排序(默认:“温度”)

部署到Smithery

  1. 推送到GitHub
  2. 首选 史密斯·艾/新
  3. 连接您的存储库
  4. 部署!

示例用法

# Get weather for London
await get_weather("London")

# Get detailed weather with forecast
await get_weather("Tokyo", units="imperial", detailed=True)

# Compare temperatures across cities
await compare_weather(["New York", "Los Angeles", "Chicago"], metric="temperature")

EOF</dev/null