
Weather MCP Server

Overview
基本能力
产品定位
Weather MCP Server 是一个提供天气信息服务的 MCP 服务器,主要用于获取天气警报和预报。
核心功能
- 天气工具:获取各州的天气警报和特定坐标的天气预报
- 系统工具:运行 shell 命令和查看系统进程信息
- MCP 集成:与 Claude Desktop 等 MCP 客户端无缝集成
适用场景
- 需要实时天气信息的应用
- 需要集成天气数据的聊天机器人
- 需要监控系统状态的工具
工具列表
- get_weather_alerts:获取指定州的天气警报
- get_forecast:获取指定坐标的天气预报
- run_shell_command:运行 shell 命令
- top_processes:查看系统进程信息
常见问题解答
- 如何连接到 Claude Desktop?
- 更新 Claude Desktop 配置,包含 weather 服务器信息
- 重启 Claude Desktop 应用更改
-
在 MCP 服务器下拉菜单中选择 "weather"
-
如何测试天气工具?
-
使用 MCP Inspector 测试
get_weather_alerts
和get_forecast
工具 -
如何添加新工具?
- 在适当的工具模块中创建函数
- 使用
@server.tool()
装饰器注册 - 更新
tools/__init__.py
中的工具注册
使用教程
使用依赖
- Python 3.11 或更高版本
- uv 包管理器
安装教程
-
克隆仓库:
bash git clone https://github.com/yourusername/weather.git cd weather
-
使用 uv 安装依赖:
bash make install
-
开发环境安装额外依赖:
bash make dev
运行服务器
启动 MCP 服务器:
make run
或直接使用 uv:
uv run python -m main
调试方式
- 使用 MCP CLI 工具测试服务器: ```bash # 列出所有可用工具 make inspector
# 调用天气工具 mcp call-tool http://localhost:8000 get_weather_alerts --args '{"state": "CA"}'
# 获取天气预报 mcp call-tool http://localhost:8000 get_forecast --args '{"latitude": 37.7749, "longitude": -122.4194}'
# 列出系统资源 mcp list-resources http://localhost:8000
# 获取系统进程 mcp get-resource http://localhost:8000 top_processes ```
-
开发模式下运行(自动重载):
bash make dev-server
访问 MCP Inspector:http://localhost:5173 -
停止服务器和 Inspector:
bash make stop-server