Claude 桌面版的天气 MCP 工具
一种 MCP(模型上下文协议)工具,使用 OpenWeatherMap API 提供实时天气数据、预报和历史天气信息,专为 Claude Desktop 设计。
教程
有关设置和使用此工具的详细指南,请查看我们全面的 Medium 教程: 教程:使用 Claude Desktop 和 Weather MCP 工具访问全球实时天气数据
特征
任何地点的实时天气状况
天气预报(最多 5 天)
历史天气数据(最近5天)
空气质量信息
天气警报和警告
位置搜索功能
设置
确保安装了 Python 3.10 或更高版本
安装依赖项:
从OpenWeatherMap获取 API 密钥(提供免费套餐)
注意:新的 API 密钥可能需要最多 24 小时才能激活
设置 API 密钥的环境变量(推荐方法):
在项目目录中创建
.env
文件将您的 API 密钥添加到文件:GXP2
将
.env
添加到.gitignore
文件以防止提交敏感数据
更新
main.py
以使用环境变量:
与 Claude Desktop 集成
通过将以下内容添加到您的 MCP 配置中,在 Claude Desktop 中配置您的 MCP 设置:
将路径替换为 main.py 文件的完整路径
使用以下命令运行服务器:
使用 Claude Desktop 时保持服务器运行
可用工具
1. 获取当前天气
获取某个地点的实时天气状况:
2. 获取天气预报
获取某个地点的天气预报:
3. 获取空气质量
获取某个地点的空气质量数据:
4. 获取历史天气
获取特定日期的历史天气数据:
5. 搜索位置
按名称搜索地点:
6. 获取天气警报
获取某个位置的天气警报:
示例查询
您可以向 Claude Desktop 询问以下问题:
“纽约现在的天气怎么样?”
“显示伦敦未来 5 天的天气预报”
“今天北京的空气质量怎么样?”
“3月14日巴黎的天气怎么样?”
“搜索名为‘东京’的地点”
“迈阿密有天气预警吗?”
“比较芝加哥、迈阿密和西雅图的当前天气”
“给我看看北京、洛杉矶和德里的空气质量对比”
错误处理
所有工具都包含适当的错误处理,如果出现问题,将返回错误消息:
故障排除
如果 MCP 服务器在 Claude Desktop 中无法运行:
确保服务器正在运行 - 启动脚本时您应该看到输出
验证设置中的路径是否正确且绝对
确保 Python 3.10+ 位于你的系统 PATH 中
检查所有依赖项是否已安装
尝试重启 Claude Desktop
检查日志中是否有任何错误消息
常见 API 问题
API 密钥激活:新的 OpenWeatherMap API 密钥可能需要长达 24 小时才能激活
无效 API 密钥错误:如果收到 401 错误,请验证您的 API 密钥是否正确且有效
速率限制:免费套餐允许每分钟最多 60 次通话,在高使用率时可能会超过此限制
速率限制
此工具使用 OpenWeatherMap API,该 API 具有速率限制。免费套餐每分钟最多允许 60 次调用,这足以满足个人使用需求。请注意,非常频繁的请求可能会受到 API 的限制。
执照
MIT 许可证
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
为 Claude Desktop 提供来自 OpenWeatherMap API 的实时天气数据、预报和历史天气信息,支持通过自然语言查询全球当前状况、预报、空气质量和天气警报。
Related MCP Servers
- -securityFlicense-qualityProvides current weather and air quality data for any city using WeatherAPI, easily integrating with MCP clients like n8n and Claude Desktop App.Last updated -441
- AsecurityFlicenseAqualityProvides real-time weather forecasts and alerts by fetching data from the National Weather Service API, allowing Claude to answer weather-related questions with up-to-date information.Last updated -2
- AsecurityFlicenseAqualityA Model Context Protocol server that retrieves current weather information for any city using the OpenWeatherMap API, designed for integration with Claude Code.Last updated -131
- AsecurityFlicenseAqualityProvides comprehensive weather information including current conditions, 7-day forecasts, and air quality data for any city worldwide using the Open-Meteo API. Features real-time weather data, hourly forecasts, sunrise/sunset times, and European Air Quality Index with human-readable descriptions.Last updated -321