使用说明
🦙 Llama3 MCP 天气助手
实时NWS数据支持的本地AI天气聊天助手
使用Llama3 + MCP的离线AI,实时获取美国天气警报和预报! 无需API密钥,无需云端,100%私密。
🚀 它的功能
| 特性/功能 | 描述 | 示例 |
|---|---|---|
| 天气预警 | 获取 活跃的恶劣天气预警 适用于美国任何州 | Get alerts for CA “洛杉矶发布山洪暴发预警” |
| 5天天气预报 | 由……提供的详细预报 GPS坐标 | Forecast for NYC “星期一:72华氏度,晴天,风速10英里/小时” |
| 本地Llama3人工智能 | 智能路由—Llama3决定使用哪个工具 Is it safe to drive in Texas? → 自动获取警报 |
|
| 实时数据 | 由……提供技术支持 国家海洋和大气管理局/国家气象局API (免费,美国官方天气) | 永远实时更新,无速率限制 |
非常适合: 紧急警报、旅行规划、当地天气查询——所有离线AI驱动!
📦 快速设置(5分钟)
先决条件
- Python 3.8及以上版本
- 8GB+ 内存(用于 Llama3 8B)
- 紫外线 (快速包管理器)
步骤1:克隆并安装
# Clone this repo
git clone git@github.com:jonyx225/mcp-weather.git
cd mcp-weather
# Install dependencies (30s)
uv sync
步骤2:登录Hugging Face(仅限一次,用于Llama3)
# Get FREE access: huggingface.co/meta-llama/Llama-3.1-8B-Instruct
huggingface-cli login # Paste your token
🎯 运行示例
基本用法
# Terminal 1: Start Weather Server
uv run weather_server.py
# Terminal 2: Start Llama3 Client
uv run client-llama3.py ../mcp-server-weather/weather_server.py
聊天:
🦙 LOCAL Llama3 MCP Client Started!
Query: Get weather alerts for California
---
Event: Flash Flood Warning
Area: Los Angeles County
Severity: Moderate
Description: Heavy rain expected until 6PM
Instructions: Avoid low-lying areas
Query: Forecast for New York City
---
Monday:
Temperature: 68°F
Wind: 8mph SW
Forecast: Partly cloudy with 20% chance of rain
---
Tuesday:
Temperature: 72°F
...
智能查询(Llama3自动使用工具)
Query: Should I cancel my flight from Texas?
[Called get_alerts: {'state': 'TX'} → Tornado Warning in Dallas]
**Yes, cancel!** Tornado warning active in Dallas until 8PM.
Query: What's the weather like at 40.7128,-74.0060?
[Called get_forecast: {'latitude': 40.7128, 'longitude': -74.0060} → NYC Forecast]
**NYC 5-Day:** Sunny 72°F today, rain tomorrow...