天气数据服务器

一个基于MCP协议的天气数据服务器,提供美国实时天气警报和预报服务,适用于AI助手集成。

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

使用说明

MCP气象服务器

使用美国国家气象局API提供美国天气信息的MCP(模型上下文协议)服务器。该服务器允许Claude和其他兼容MCP的AI助手访问实时天气数据。

特性

  • 天气警报:获取美国任何州的当前天气警报
  • 天气预报:使用纬度和经度获取美国任何地点的详细天气预报

安装

对于用户

要将此MCP服务器与Claude或其他MCP兼容的AI助手一起使用:

# Install from PyPI
pip install mcp-weather

# Or install with uv
uv pip install mcp-weather

对于开发者

设置开发环境:

# Clone the repository
git clone https://github.com/michael7736/mcp-weather.git
cd mcp-weather

# Create a virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -e ".[dev]"

配置

Cline(VS代码扩展)

将以下内容添加到Cline MCP设置文件中(cline_mcp_settings.json):

{
  "mcpServers": {
    "weather": {
      "command": "mcp-weather",
      "disabled": false,
      "autoApprove": []
    }
  }
}

克劳德桌面应用程序

将以下内容添加到您的Claude Desktop配置文件中(claude_desktop_config.json):

{
  "mcpServers": {
    "weather": {
      "command": "mcp-weather",
      "disabled": false,
      "autoApprove": []
    }
  }
}

用法

配置后,您可以向Claude或其他兼容MCP的AI助手询问有关天气的问题:

  • “加利福尼亚州目前的天气警报是什么?”
  • “旧金山的天气预报是什么?”(助手将使用旧金山的坐标)

出版

要将此包发布到PyPI,请执行以下操作:

  1. 确保您拥有最新的构建工具:

    pip install --upgrade build twine
    
  2. 构建包:

    python -m build
    
  3. 上传到PyPI:

    python -m twine upload dist/*
    

许可证

此项目根据MIT许可证获得许可-有关详细信息,请参阅许可证文件。