天气MCP服务器
实现一个模型上下文协议(MCP)服务器,使AI助手能够与美国国家气象局API交互,提供实时天气警报和预报。
快速入门
前置条件
- 安装 Python (推荐 3.11.6 或更高版本)
- 安装 uv 包管理器 (macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
, Windows:powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
) - 安装依赖库:
pip install httpx fastmcp
安装与运行
- 克隆仓库:
git clone https://github.com/ankushmehta123/weather-mcp-server.git
- 安装依赖:
pip install -r requirements.txt
- 配置 MCP 服务器,在
claude_desktop_config.json
文件中添加配置。 - 运行主程序:
python main.py
使用方法
启动后,在 Claude Desktop 中即可使用天气相关的工具查询实时天气信息。