天气数据服务

MCP天气服务器是一个提供全球天气数据的服务,自动选择API(美国地区使用NWS,全球其他地区使用Open-Meteo),无需API密钥即可获取天气警报和预报。

  • by alexylon
  • Rust
  • 本地部署
  • 更新于
在 GitHub 查看 alexylon/mcp-weather-server

使用说明

MCP气象服务器

具有自动API选择功能的全球天气MCP服务器-在美国地区使用NWS,在全球范围内使用Open-Meteo。

特性

  • 获取警报:美国各州的天气警报
  • 获取预测:全球天气预报(全球任何坐标)
  • 不需要API密钥
  • 基于位置的API自动选择

快速开始

cargo build --release
npx @modelcontextprotocol/inspector ./target/release/mcp-weather-server

打开 http://127.0.0.1:6274 并使用柏林(52.52,13.41)或纽约(40.7128,-74.0060)等坐标进行测试。

用法

MCP检验员测试

npx @modelcontextprotocol/inspector cargo run
# or
npx @modelcontextprotocol/inspector ./target/release/mcp-weather-server

克劳德桌面

添加到 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)或 %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "weather": {
      "command": "/path/to/mcp-weather-server/target/release/mcp-weather-server"
    }
  }
}

工具

获取警报

  • 输入: state (两个字母的美国代码,例如“CA”)
  • 输出:带有严重程度和描述的主动天气警报

获取预测

  • 输入: latitude, longitude (全球任何坐标)
  • 输出:天气预报(美国NWS,世界其他地区Open Meteo)

示例坐标:

  • 纽约:40.7128,74.0060
  • 柏林:52.52,13.41
  • 东京:35.6762139.6503

发展

# Run with logging
RUST_LOG=debug cargo run

# Build release
cargo build --release

资源