MCP 天气服务器是一个可靠的服务,它集成了实时天气数据与 Claude for Desktop,能为用户提供便捷的天气查询体验,解决了获取实时天气信息和智能交互的问题。
uv venv
.\.venv\Scripts\activate
weather.py 文件。在 claude_desktop_config.json 中添加:
{
"mcpServers": {
"weather": {
"command": "python",
"args": ["weather.py"],
"cwd": "/absolute/path/to/project"
}
}
}
用户:旧金山的天气如何?
Claude:[使用 get_forecast(37.7749, -122.4194)]
| 问题 | 解决方案 |
|---|---|
| 连接失败 | 验证 Claude 的配置路径是否为绝对路径 |
| 没有天气数据 | 检查 NWS API 状态 api.weather.gov |
| 模块错误 | 执行 uv add mcp[cli] httpx |