一个极简的天气查询工具,只需一句话即可查看全球天气,完美集成到Cursor编辑器中。
2.9w 查看 · 2026-07-07 更新
简介
一个极简的天气查询工具,只需一句话即可查看全球天气,完美集成到Cursor编辑器中。
简介
一个极简的天气查询工具,只需一句话即可查看全球天气,完美集成到Cursor编辑器中。
看看如何用自然语言轻松查询天气
✨ 特性
- 💡 极简: 一句话查询天气
- 🤖 智能: 支持中英文自然语言交互
- 🌏 全球: 支持所有主要城市
- 🔌 即插即用: 完美集成 Cursor
- 🚀 高性能: 异步处理,响应迅速
- 🎨 美观: 清晰直观的天气展示
🚀 快速开始
1. 获取 API Key
🔑 在开始之前,请先 获取 OpenWeather API Key
2. 一键安装(推荐)
使用 Smithery 一键安装和配置:
npx -y @smithery/cli@latest install @MrCare/mcp_tool --client cursor --config "{"openweathermapApiKey":"your_api_key_here","port":8000}"
如需安装 WindSurf 和 Cine 版本,请访问我们的 Smithery 仓库。
3. 手动安装
3.1 克隆并安装
git clone https://github.com/yourusername/weather-server.git && cd weather-server && pip install -e .
3.2 配置 API Key
方法一:使用配置文件(推荐)
复制示例配置文件并修改:
cp env.example .env
然后编辑 .env 文件,将 your_api_key_here 替换为你的 API Key。
方法二:使用环境变量
macOS/Linux:
export OPENWEATHERMAP_API_KEY="your_api_key"
Windows:
set OPENWEATHERMAP_API_KEY=your_api_key
3.3 启用工具
编辑 ~/.cursor/mcp.json (Windows: %USERPROFILE%.cursormcp.json):
{ "weather_fastmcp": { "command": "python", "args": ["-m", "weather_server.server"] } }
重启 Cursor 即可使用!
📝 使用示例
在 Cursor 中直接输入:
东京天气怎么样? 伦敦明天会下雨吗? 纽约的天气预报 巴黎今天温度多少?
就这么简单!
⚙️ 参数说明
如需更精确的查询,可以指定以下参数:
| 参数 | 说明 | 默认值 |
|---|---|---|
| city | 城市名称(支持中英文) | 必填 |
| days | 预报天数(1-5天) | 5 |
| units | 温度单位 (metric: 摄氏度, imperial: 华氏度) | metric |
| lang | 返回语言 (zh_cn: 中文, en: 英文) | zh_cn |
❓ 常见问题
-
工具不工作?
- 确保 API Key 设置正确
- 重启 Cursor
- 检查 Python 环境
-
找不到城市?
- 尝试使用英文名称
- 检查拼写
- 使用完整城市名
👨💻 作者
- Mr.Car
- Email: 534192336car@gmail.com
🙏 致谢
📄 许可证
本项目采用 MIT 许可证 - 详见 LICENSE 文件
工具列表
- get_weather: 获取指定城市的天气信息
Args: city: 城市名称(支持中文或英文,如:苏州、suzhou) units: 温度单位 (metric: 摄氏度, imperial: 华氏度) lang: 返回语言 (zh_cn: 中文, en: 英文)
Returns: WeatherData: 包含天气信息的对象
- get_weather_forecast: 获取指定城市的天气预报信息
Args: city: 城市名称(支持中文或英文,如:苏州、suzhou) days: 预报天数(最多5天) units: 温度单位 (metric: 摄氏度, imperial: 华氏度) lang: 返回语言 (zh_cn: 中文, en: 英文)
Returns: dict: 包含天气预报信息的字典
服务配置
[{'mcpServers': {'weather_fastmcp': {'args': ['-m', 'weather_server.server'], 'command': 'python'}}}]
来源
- 来源:github
- 链接:https://github.com/MrCare/mcp_tool